24
24
site_schema = models .TSiteSchema (many = True )
25
25
themes_sthemes_schema = models .CorSthemeThemeSchema (many = True )
26
26
27
+ def getCustomTpl (name ):
28
+ tpl_local = f'custom/{ name } _{ get_locale ().__str__ ()} .jinja'
29
+ tpl_common = f'custom/{ name } .jinja'
30
+ if os .path .exists (f'tpl/{ tpl_local } ' ):
31
+ return tpl_local
32
+ if os .path .exists (f'tpl/{ tpl_common } ' ):
33
+ return tpl_common
34
+ return None
35
+
27
36
def getThumborSignature (url ):
28
37
key = bytes (os .getenv ("THUMBOR_SECURITY_KEY" ), 'UTF-8' )
29
38
msg = bytes (url , 'UTF-8' )
@@ -148,12 +157,6 @@ def getDbConf():
148
157
149
158
return conf
150
159
151
-
152
- def isDbPagePublished (name ):
153
- dbconf = getDbConf ()
154
-
155
- return dbconf .get ('page_' + name + '_published_' + get_locale ().__str__ (), dbconf .get ('page_' + name + '_published' )) is True
156
-
157
160
def isMultiObservatories ():
158
161
# Pourrait passer par un count sql
159
162
sql = text ("SELECT id FROM geopaysages.t_observatory where is_published is true" )
@@ -163,18 +166,6 @@ def isMultiObservatories():
163
166
return True
164
167
return False
165
168
166
- def getDbPage (name ):
167
- dbconf = getDbConf ()
168
-
169
- locale = get_locale ()
170
- title_locale = dbconf .get ('page_' + name + '_title_' + locale .__str__ ())
171
- content_locale = dbconf .get ('page_' + name + '_content_' + locale .__str__ ())
172
-
173
- return {
174
- 'title' : title_locale if title_locale else dbconf .get ('page_' + name + '_title' , '' ),
175
- 'content' : content_locale if content_locale else dbconf .get ('page_' + name + '_content' , '' )
176
- }
177
-
178
169
def getFiltersData ():
179
170
sites = site_schema .dump (models .TSite .query .join (models .Observatory ).filter (models .TSite .publish_site == True , models .Observatory .is_published == True ).order_by (DEFAULT_SORT_SITES ))
180
171
for site in sites :
0 commit comments