Skip to content

Commit ef9a87b

Browse files
committed
code: fix for no Flash for pdf generation
1 parent 78e4d45 commit ef9a87b

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/obj/Song.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,14 @@
22
import os
33
import itertools
44
import re
5-
from flask import url_for
65
from src.obj.Config import config
76

7+
try:
8+
from flask import url_for
9+
except ImportError:
10+
flaskSupported = False
11+
else:
12+
flaskSupported = True
813

914
class Song:
1015
def __init__(self, title: str, category: str):
@@ -41,7 +46,10 @@ def expandedSections(self):
4146

4247
@property
4348
def linkedTitle(self) -> str:
44-
return f"{'&nbsp;'*8}<a href={url_for('start', category=self.category, song=self.title.replace('/', ''), chordShift=0)}>{self.title}</a>"
49+
if flaskSupported:
50+
return f"{'&nbsp;'*8}<a href={url_for('start', category=self.category, song=self.title.replace('/', ''), chordShift=0)}>{self.title}</a>"
51+
else:
52+
return f"""{'&nbsp;'*8}<a href={f'/{self.category}/{self.title.replace("/", "")}/0'}>{self.title}</a>"""
4553

4654
@property
4755
def filterString(self) -> str:

0 commit comments

Comments
 (0)