diff --git a/smartvisu/svgenerator.py b/smartvisu/svgenerator.py
index e4852f887..b2fb6cdc9 100755
--- a/smartvisu/svgenerator.py
+++ b/smartvisu/svgenerator.py
@@ -25,13 +25,13 @@
from lib.item import Items
+
class SmartVisuGenerator:
valid_sv_page_entries = ['room', 'overview', 'separator', 'seperator',
- 'category', 'cat_overview', 'cat_separator','cat_seperator',
+ 'category', 'cat_overview', 'cat_separator', 'cat_seperator',
'room_lite', 'sv_overview']
-
def __init__(self, plugin_instance, visu_definition=None):
self.items = Items.get_instance()
@@ -43,9 +43,9 @@ def __init__(self, plugin_instance, visu_definition=None):
self.smartvisu_version = plugin_instance.smartvisu_version
self.overwrite_templates = plugin_instance.overwrite_templates
self.visu_style = plugin_instance.visu_style.lower()
- if not self.visu_style in ['std','blk']:
+ if self.visu_style not in ['std', 'blk']:
self.visu_style = 'std'
- self.logger.warning("SmartVisuGenerator: visu_style '{}' unknown, using visu_style '{1}'".format(plugin_instance.visu_style, self.visu_style))
+ self.logger.warning("SmartVisuGenerator: visu_style '{0}' unknown, using visu_style '{1}'".format(plugin_instance.visu_style, self.visu_style))
self.list_deprecated_warnings = plugin_instance.list_deprecated_warnings
self.logger.info("Generating pages for smartVISU v{}".format(self.smartvisu_version))
@@ -102,7 +102,6 @@ def initialize_visu_menu(self, nav_config, menu):
self.add_menuentry_to_list(menu, menu_entry)
self.logger.debug("initialize_visu_menu: '{}' menu_entry={}".format(menu, menu_entry))
-
def handle_heading_attributes(self, room):
if 'sv_heading_right' in room.conf:
heading_right = room.conf['sv_heading_right']
@@ -122,7 +121,6 @@ def handle_heading_attributes(self, room):
heading = ''
return heading
-
def get_widgetblocksize(self, item):
"""
Returns the blocksize for the block in which the item is to be displayed.
@@ -134,13 +132,12 @@ def get_widgetblocksize(self, item):
"""
if 'sv_blocksize' in item.conf:
blocksize = item.conf['sv_blocksize']
- if not blocksize in ['1','2','3']:
+ if blocksize not in ['1', '2', '3']:
blocksize = '2'
else:
blocksize = '2'
return blocksize
-
def get_attribute(self, attr, item):
if attr in item.conf:
attrvalue = item.conf[attr]
@@ -148,7 +145,6 @@ def get_attribute(self, attr, item):
attrvalue = ''
return attrvalue
-
def create_page(self, room, menu_entry):
"""
Interpretation of the room-specific item-attributes.
@@ -159,7 +155,7 @@ def create_page(self, room, menu_entry):
:return: html code to be included in the visu file for the room
:rtype: str
"""
- block_style = 'std' # 'std' or 'noh'
+ block_style = 'std' # 'std' or 'noh'
widgetblocktemplate = 'widgetblock_' + self.visu_style + '_' + block_style + '.html'
widgetblocktemplate2 = 'widgetblock2_' + self.visu_style + '_' + block_style + '.html'
widgets = ''
@@ -215,7 +211,6 @@ def create_page(self, room, menu_entry):
menu_entry['content'] += widgets
return r
-
def pages(self):
if not self.remove_oldpages():
return
@@ -284,13 +279,13 @@ def pages(self):
def create_menuentry(self, menu, entry_name, item_path, separator, img_name, nav_aside, nav_aside2, from_navconfig=False):
for menu_entry in self.navigation[menu]:
if menu_entry['name'] == entry_name:
- if menu_entry.get('img', '') == '' and menu_entry.get('img_set', False) == False:
+ if menu_entry.get('img', '') == '' and menu_entry.get('img_set', False) is False:
menu_entry['img'] = img_name
if menu_entry['item_path'] == '':
menu_entry['item_path'] = item_path
- if menu_entry.get('nav_aside', '') == ''and menu_entry.get('nav_aside_set', False) == False:
+ if menu_entry.get('nav_aside', '') == '' and menu_entry.get('nav_aside_set', False) is False:
menu_entry['nav_aside'] = nav_aside
- if menu_entry.get('nav_aside2', '') == '' and menu_entry.get('nav_aside2_set', False) == False:
+ if menu_entry.get('nav_aside2', '') == '' and menu_entry.get('nav_aside2_set', False) is False:
menu_entry['nav_aside2'] = nav_aside2
return menu_entry
@@ -299,7 +294,7 @@ def create_menuentry(self, menu, entry_name, item_path, separator, img_name, nav
menu_entry['item_path'] = item_path
menu_entry['separator'] = separator
menu_entry['page'] = menu + '.' + entry_name
- for ch in [' ',':','/','\\']:
+ for ch in [' ', ':', '/', '\\']:
if ch in menu_entry['page']:
menu_entry['page'] = menu_entry['page'].replace(ch, '_')
menu_entry['heading'] = ''
@@ -329,7 +324,6 @@ def create_menuentry(self, menu, entry_name, item_path, separator, img_name, nav
return menu_entry
-
def add_menuentry_to_list(self, menu, menu_entry):
for entry in self.navigation[menu]:
if entry['name'] == menu_entry['name']:
@@ -358,7 +352,7 @@ def write_navigation_and_pages(self, menu, navigation_file):
('{{ visu_aside2 }}', menu_entry['nav_aside2']),
('item.name', menu_entry['name']), ("'item", "'" + menu_entry['item_path'])
]
- if menu_entry['separator'] == True:
+ if menu_entry['separator'] is True:
nav_list += self.parse_tpl('navi_sep.html', [('{{ name }}', menu_entry['name'])])
else:
#menu_entry['html'] = self.parse_tpl('navi.html', parse_list)
@@ -371,7 +365,7 @@ def write_navigation_and_pages(self, menu, navigation_file):
nav_list += self.parse_tpl('navi.html', parse_list)
# build page code
- if menu_entry['separator'] == False:
+ if menu_entry['separator'] is False:
# build and write file for a single room
r = self.parse_tpl(menu+'_page.html', [('{{ visu_name }}', menu_entry['name']), ('{{ visu_widgets }}', menu_entry['content']),
('{{ visu_img }}', menu_entry['img']), ('{{ visu_heading }}', menu_entry['heading'])])
@@ -420,7 +414,6 @@ def parse_tpl(self, template, replace):
tpl = tpl.replace(s, rs)
return tpl
-
def write_parseresult(self, htmlfile, parseresult):
try:
with open(self.pages_dir + '/' + htmlfile, 'w') as f:
@@ -428,7 +421,6 @@ def write_parseresult(self, htmlfile, parseresult):
except Exception as e:
self.logger.warning("Could not write to {0}/{1}: {2}".format(self.pages_dir, htmlfile, e))
-
def copy_tpl(self, tplname, destname=''):
if destname == '':
destname = tplname
@@ -487,7 +479,7 @@ def copy_templates(self):
if self.smartvisu_version >= '2.9':
for fn in os.listdir(self.shng_tpldir):
- if (self.overwrite_templates) or (not os.path.isfile(os.path.join(self.gen_tpldir, fn)) ):
+ if (self.overwrite_templates) or (not os.path.isfile(os.path.join(self.gen_tpldir, fn))):
self.logger.debug("copy_templates: Copying template '{}' from plugin to smartVISU v{} ({})".format(fn, self.smartvisu_version, self.gen_tpldir))
shutil.copy2(os.path.join(self.shng_tpldir, fn), self.gen_tpldir)
shutil.copy2(os.path.join(self.sv_tpldir, 'index.html'), self.gen_tpldir)
@@ -503,10 +495,10 @@ def copy_templates(self):
pass
# Open file for twig import statements (for root.html)
for fn in os.listdir(self.shng_tpldir):
- if (self.overwrite_templates) or (not os.path.isfile(os.path.join(self.gen_tpldir, fn)) ):
+ if (self.overwrite_templates) or (not os.path.isfile(os.path.join(self.gen_tpldir, fn))):
self.logger.debug("copy_templates: Copying template '{}' from plugin to smartVISU v{}".format(fn, self.smartvisu_version))
try:
- shutil.copy2( os.path.join(self.shng_tpldir, fn), self.gen_tpldir )
+ shutil.copy2(os.path.join(self.shng_tpldir, fn), self.gen_tpldir)
except Exception as e:
self.logger.error("Could not copy {0} from {1} to {2}".format(fn, self.shng_tpldir, self.gen_tpldir))
return
diff --git a/visu_smartvisu/__init__.py b/visu_smartvisu/__init__.py
index 504d35b83..feaaa1d9f 100755
--- a/visu_smartvisu/__init__.py
+++ b/visu_smartvisu/__init__.py
@@ -41,10 +41,9 @@
#########################################################################
class SmartVisu(SmartPlugin):
- PLUGIN_VERSION="1.3.4"
+ PLUGIN_VERSION = "1.3.4"
ALLOW_MULTIINSTANCE = True
-
def my_to_bool(self, value, attr='', default=False):
try:
result = self.to_bool(value)
@@ -53,15 +52,14 @@ def my_to_bool(self, value, attr='', default=False):
self.logger.error("smartVISU: Invalid value '"+str(value)+"' configured for attribute "+attr+" in plugin.conf, using '"+str(result)+"' instead")
return result
-
- def __init__(self, smarthome, smartvisu_dir='', generate_pages='True', overwrite_templates='Yes', visu_style = 'std', handle_widgets='True' ):
+ def __init__(self, smarthome, smartvisu_dir='', generate_pages='True', overwrite_templates=True, visu_style='std', handle_widgets='True'):
self.logger = logging.getLogger(__name__)
self._sh = smarthome
self.smartvisu_dir = str(smartvisu_dir)
self._generate_pages = self.my_to_bool(generate_pages, 'generate_pages', True)
self.overwrite_templates = self.my_to_bool(overwrite_templates, 'overwrite_templates', True)
- if visu_style.lower() in ['std','blk']:
+ if visu_style.lower() in ['std', 'blk']:
self.visu_style = visu_style.lower()
else:
self.visu_style = 'std'
@@ -74,7 +72,6 @@ def __init__(self, smarthome, smartvisu_dir='', generate_pages='True', overwrite
# else:
# self.logger.log(logging.WARNING, "Handling for smartVISU v{} in directory {}".format(self.smartvisu_version, self.smartvisu_dir))
-
def run(self):
self.alive = True
if self.smartvisu_dir != '':
@@ -97,11 +94,9 @@ def run(self):
self.logger.exception("SmartVisuGenerator: Exception: {}".format(e))
self.logger.info("Finished smartVISU v{} handling".format(self.smartvisu_version))
-
def stop(self):
self.alive = False
-
def parse_item(self, item):
# Relative path support (release 1.3 and up)
item.expand_relativepathes('sv_widget', "'", "'")
@@ -109,15 +104,12 @@ def parse_item(self, item):
item.expand_relativepathes('sv_nav_aside', "'", "'")
item.expand_relativepathes('sv_nav_aside2', "'", "'")
-
def parse_logic(self, logic):
pass
-
def update_item(self, item, caller=None, source=None, dest=None):
pass
-
def get_smartvisu_version(self):
"""
Determine which smartVISU version is installed in 'smartvisu_dir'
@@ -147,7 +139,7 @@ def get_smartvisu_version(self):
class SmartVisuGenerator:
- def __init__(self, smarthome, smartvisu_dir='', overwrite_templates='Yes', visu_style='std', smartvisu_version=''):
+ def __init__(self, smarthome, smartvisu_dir='', overwrite_templates=True, visu_style='std', smartvisu_version=''):
self.logger = logging.getLogger(__name__)
self._sh = smarthome
self.items = Items.get_instance()
@@ -156,9 +148,9 @@ def __init__(self, smarthome, smartvisu_dir='', overwrite_templates='Yes', visu_
self.smartvisu_version = smartvisu_version
self.overwrite_templates = overwrite_templates
self.visu_style = visu_style.lower()
- if not self.visu_style in ['std','blk']:
+ if self.visu_style not in ['std', 'blk']:
self.visu_style = 'std'
- self.logger.warning("SmartVisuGenerator: visu_style '{}' unknown, using visu_style '{1}'".format(visu_style, self.visu_style))
+ self.logger.warning("SmartVisuGenerator: visu_style '{0}' unknown, using visu_style '{1}'".format(visu_style, self.visu_style))
self.logger.info("Generating pages for smartVISU v{}".format(self.smartvisu_version))
@@ -174,7 +166,6 @@ def __init__(self, smarthome, smartvisu_dir='', overwrite_templates='Yes', visu_
self.pages()
self.logger.info("Generating pages for smartVISU v{} End".format(self.smartvisu_version))
-
def handle_heading_attributes(self, room):
if 'sv_heading_right' in room.conf:
heading_right = room.conf['sv_heading_right']
@@ -194,7 +185,6 @@ def handle_heading_attributes(self, room):
heading = ''
return heading
-
def get_widgetblocksize(self, item):
"""
Returns the blocksize for the block in which the item is to be displayed.
@@ -206,13 +196,12 @@ def get_widgetblocksize(self, item):
"""
if 'sv_blocksize' in item.conf:
blocksize = item.conf['sv_blocksize']
- if not blocksize in ['1','2','3']:
+ if blocksize not in ['1', '2', '3']:
blocksize = '2'
else:
blocksize = '2'
return blocksize
-
def get_attribute(self, attr, item):
if attr in item.conf:
attrvalue = item.conf[attr]
@@ -220,14 +209,12 @@ def get_attribute(self, attr, item):
attrvalue = ''
return attrvalue
-
def room(self, room):
"""
Interpretation of the room-specific item-attributes.
This routine is called once per 'sv_page'.
:param room: Items (with room configuration)
- :param tpldir: Directory where the template files are stored (within smartVISU)
:return: html code to be included in the visu file for the room
:rtype: str
@@ -292,7 +279,6 @@ def room(self, room):
r = self.parse_tpl('roomlite.html', [('{{ visu_name }}', str(room)), ('{{ visu_widgets }}', widgets), ('{{ visu_img }}', rimg), ('{{ visu_heading }}', heading)])
return r
-
def pages(self):
if not self.remove_oldpages():
return
@@ -341,7 +327,6 @@ def pages(self):
lite_lis += self.parse_tpl('navi.html', [('{{ visu_page }}', item.property.path), ('{{ visu_name }}', str(item)), ('{{ visu_img }}', img), ('{{ visu_aside }}', nav_aside), ('{{ visu_aside2 }}', nav_aside2), ('item.name', str(item)), ("'item", "'" + item.property.path)])
self.write_parseresult(item.property.path+'.html', r)
-
nav = self.parse_tpl('navigation.html', [('{{ visu_navis }}', nav_lis)])
self.write_parseresult('room_nav.html', nav)
@@ -351,7 +336,6 @@ def pages(self):
nav = self.parse_tpl('navigation.html', [('{{ visu_navis }}', lite_lis)])
self.write_parseresult('roomlite_nav.html', nav)
-
self.copy_tpl('rooms.html')
self.copy_tpl('roomslite.html')
self.copy_tpl('category.html')
@@ -373,7 +357,6 @@ def parse_tpl(self, template, replace):
tpl = tpl.replace(s, r)
return tpl
-
def write_parseresult(self, htmlfile, parseresult):
try:
with open(self.outdir + '/' + htmlfile, 'w') as f:
@@ -381,14 +364,13 @@ def write_parseresult(self, htmlfile, parseresult):
except Exception as e:
self.logger.warning("Could not write to {0}/{1}: {2}".format(self.outdir, htmlfile, e))
-
def copy_tpl(self, tplname, destname=''):
if destname == '':
destname = tplname
try:
shutil.copy(self.tpldir + '/' + tplname, self.outdir + '/' + destname)
except Exception as e:
- self.logger.error("Could not copy {0} from {1} to {2}".format(tplname, tpldir, destdir))
+ self.logger.error("Could not copy {0} from {1} to {2}".format(tplname, self.tpldir, self.outdir))
#########################################################################
@@ -435,9 +417,9 @@ def copy_templates(self):
if self.smartvisu_version == '2.9':
for fn in os.listdir(srcdir):
- if (self.overwrite_templates) or (not os.path.isfile(os.path.join(self.tpldir, fn)) ):
+ if (self.overwrite_templates) or (not os.path.isfile(os.path.join(self.tpldir, fn))):
self.logger.debug("copy_templates: Copying template '{}' from plugin to smartVISU v{}".format(fn, self.smartvisu_version))
- shutil.copy2( os.path.join(srcdir, fn), self.tpldir )
+ shutil.copy2(os.path.join(srcdir, fn), self.tpldir)
else:
# create output directory
@@ -450,10 +432,10 @@ def copy_templates(self):
# Open file for twig import statements (for root.html)
for fn in os.listdir(srcdir):
- if (self.overwrite_templates) or (not os.path.isfile(os.path.join(self.tpldir, fn)) ):
+ if (self.overwrite_templates) or (not os.path.isfile(os.path.join(self.tpldir, fn))):
self.logger.debug("copy_templates: Copying template '{}' from plugin to smartVISU v{}".format(fn, self.smartvisu_version))
try:
- shutil.copy2( os.path.join(srcdir, fn), self.tpldir )
+ shutil.copy2(os.path.join(srcdir, fn), self.tpldir)
except Exception as e:
self.logger.error("Could not copy {0} from {1} to {2}".format(fn, srcdir, self.tpldir))
return
@@ -487,17 +469,16 @@ def __init__(self, smarthome, smartvisu_dir='', smartvisu_version=''):
self.install_widgets(self._sh)
-
def install_widgets(self, smarthome):
if not self.remove_oldfiles():
return
if self.smartvisu_version == '2.7' or self.smartvisu_version == '2.8':
# make a backup copy of root.html if it doesn't exist (for full integeration)
- if not os.path.isfile( self.pgbdir + '/root_master.html' ):
- self.logger.warning( "install_widgets: Creating a copy of root.html" )
+ if not os.path.isfile(self.pgbdir + '/root_master.html'):
+ self.logger.warning("install_widgets: Creating a copy of root.html")
try:
- shutil.copy2( self.pgbdir + '/root.html', self.pgbdir + '/root_master.html' )
+ shutil.copy2(self.pgbdir + '/root.html', self.pgbdir + '/root_master.html')
except Exception as e:
self.logger.error("Could not copy {} from {} to {}".format('root.html', self.pgbdir, self.pgbdir + '/root_master.html'))
return
@@ -506,17 +487,17 @@ def install_widgets(self, smarthome):
f_root = open(self.pgbdir + '/root_master.html', "r")
root_contents = f_root.readlines()
f_root.close()
- self.logger.debug( "root_contents: {0}".format(root_contents) )
+ self.logger.debug("root_contents: {0}".format(root_contents))
# find insert points in original root.html
- iln_html = self.findinsertline( root_contents, '{% import "plot.html" as plot %}' )
- iln_js = self.findinsertline( root_contents, "{% if isfile('pages/'~config_pages~'/visu.js') %}" )
- iln_css = self.findinsertline( root_contents, "{% if isfile('pages/'~config_pages~'/visu.css') %}" )
+ iln_html = self.findinsertline(root_contents, '{% import "plot.html" as plot %}')
+ iln_js = self.findinsertline(root_contents, "{% if isfile('pages/'~config_pages~'/visu.js') %}")
+ iln_css = self.findinsertline(root_contents, "{% if isfile('pages/'~config_pages~'/visu.css') %}")
# copy widgets from plugin directories of configured plugins
# read plungin.conf
_conf = lib.config.parse(smarthome._plugin_conf)
- self.logger.debug( "install_widgets: _conf = {}".format(str(_conf)) )
+ self.logger.debug("install_widgets: _conf = {}".format(str(_conf)))
mypluginlist = []
for plugin in _conf:
self.logger.debug("install_widgets: Plugin section '{}', class_path = '{}', plugin_name = '{}'".format(plugin, str(_conf[plugin].get('class_path', '')), str(_conf[plugin].get('plugin_name', ''))))
@@ -525,15 +506,15 @@ def install_widgets(self, smarthome):
plgdir = 'plugins.' + _conf[plugin].get('plugin_name', '')
if plgdir not in mypluginlist:
# process each plugin only once
- mypluginlist.append( plgdir )
+ mypluginlist.append(plgdir)
if self.smartvisu_version == '2.7' or self.smartvisu_version == '2.8':
- self.copy_widgets( plgdir.replace('.', '/'), root_contents, iln_html, iln_js, iln_css )
+ self.copy_widgets(plgdir.replace('.', '/'), root_contents, iln_html, iln_js, iln_css)
else:
- self.copy_widgets( plgdir.replace('.', '/') )
+ self.copy_widgets(plgdir.replace('.', '/'))
if self.smartvisu_version == '2.7' or self.smartvisu_version == '2.8':
# write root.html with additions for widgets
- self.logger.info( "Adding import statements to root.html" )
+ self.logger.info("Adding import statements to root.html")
f_root = open(self.pgbdir + '/root.html', "w")
root_contents = "".join(root_contents)
f_root.write(root_contents)
@@ -542,16 +523,15 @@ def install_widgets(self, smarthome):
#########################################################################
- def findinsertline(self, root_contents, searchstring ):
+ def findinsertline(self, root_contents, searchstring):
# look for insert point in root.html: find and return line that contains the searchstring
iln = ''
for ln in root_contents:
- if ln.find( searchstring ) != -1:
+ if ln.find(searchstring) != -1:
iln = ln
if iln == '':
self.logger.warning("findinsertline: No insert point for pattern {0}".format(searchstring))
- return( iln )
-
+ return(iln)
def copy_widgets(self, plgdir, root_contents='', iln_html='', iln_js='', iln_css=''):
wdgdir = 'sv_widgets'
@@ -569,47 +549,45 @@ def copy_widgets(self, plgdir, root_contents='', iln_html='', iln_js='', iln_css
if self.smartvisu_version == '2.9':
if os.path.splitext(fn)[1] == '.png':
# copy icons to the icons directory
- shutil.copy2( os.path.join(srcdir, fn), self.icndir )
+ shutil.copy2(os.path.join(srcdir, fn), self.icndir)
else:
# the rest to the widgets directory & strip 'widgets_' from name
if fn.startswith('widget_'):
dn = fn[len('widget_'):]
- shutil.copy2( os.path.join(srcdir, fn), os.path.join(self.outdir, dn) )
+ shutil.copy2(os.path.join(srcdir, fn), os.path.join(self.outdir, dn))
else:
- shutil.copy2( os.path.join(srcdir, fn), self.outdir )
+ shutil.copy2(os.path.join(srcdir, fn), self.outdir)
else:
# v2.7 & v2.8
- shutil.copy2( srcdir + '/' + fn, self.outdir )
+ shutil.copy2(srcdir + '/' + fn, self.outdir)
if self.smartvisu_version == '2.7' or self.smartvisu_version == '2.8':
if (fn[0:7] == "widget_") and (fn[-5:] == ".html"):
self.logger.info("- Installing for SV v{} from '{}': {}".format(self.smartvisu_version, plgdir, '\t' + fn))
if iln_html != '':
- self.create_htmlinclude(fn, fn[7:-5] , root_contents, iln_html)
+ self.create_htmlinclude(fn, fn[7:-5], root_contents, iln_html)
if (fn[0:7] == "widget_") and (fn[-3:] == ".js"):
if iln_js != '':
- self.create_jsinclude(fn, fn[7:-3] , root_contents, iln_js)
+ self.create_jsinclude(fn, fn[7:-3], root_contents, iln_js)
if (fn[0:7] == "widget_") and (fn[-4:] == ".css"):
if iln_css != '':
- self.create_cssinclude(fn, fn[7:-4] , root_contents, iln_css)
+ self.create_cssinclude(fn, fn[7:-4], root_contents, iln_css)
return
-
def create_htmlinclude(self, filename, classname, root_contents, iln_html):
insertln = root_contents.index(iln_html) +1
# Insert widget statements to root_contents
if insertln != 0:
- self.logger.debug( "create_htmlinclude: Inserting in root.html at line {0} after '{1}'".format(insertln, iln_html) )
+ self.logger.debug("create_htmlinclude: Inserting in root.html at line {0} after '{1}'".format(insertln, iln_html))
twig_statement = '\t{% import "' + self.shwdgdir + '/' + filename + '" as ' + classname + ' %}'
root_contents.insert(insertln, twig_statement+'\n')
-
def create_jsinclude(self, filename, classname, root_contents, iln_js):
insertln = root_contents.index(iln_js)
# Insert widget statements to root_contents
if insertln > -1:
- self.logger.debug( "create_jsinclude: Inserting in root.html at line {0} before '{1}'".format(insertln, iln_js) )
+ self.logger.debug("create_jsinclude: Inserting in root.html at line {0} before '{1}'".format(insertln, iln_js))
twig_statement1 = "\t{% if isfile('widgets/sh_widgets/" + filename + "') %}"
twig_statement2 = '\t\t{% endif %}'
self.logger.debug('create_jsinclude: {0}'.format(twig_statement1))
@@ -617,12 +595,11 @@ def create_jsinclude(self, filename, classname, root_contents, iln_js):
root_contents.insert(insertln, twig_statement2+'\n')
root_contents.insert(insertln, twig_statement1+'\n')
-
def create_cssinclude(self, filename, classname, root_contents, iln_css):
insertln = root_contents.index(iln_css)
# Insert widget statements to root_contents
if insertln > -1:
- self.logger.debug( "create_jsinclude: Inserting in root.html at line {0} before '{1}'".format(insertln, iln_css) )
+ self.logger.debug("create_jsinclude: Inserting in root.html at line {0} before '{1}'".format(insertln, iln_css))
twig_statement1 = "\t{% if isfile('widgets/sh_widgets/" + filename + "') %}"
twig_statement2 = '\t\t{% endif %}'
self.logger.debug('create_cssinclude: {0}'.format(twig_statement1))
@@ -630,7 +607,6 @@ def create_cssinclude(self, filename, classname, root_contents, iln_css):
root_contents.insert(insertln, twig_statement2+'\n')
root_contents.insert(insertln, twig_statement1+'\n')
-
def remove_oldfiles(self):
# clear temp directory
if not os.path.isdir(self.tmpdir):
@@ -668,4 +644,3 @@ def remove_oldfiles(self):
self.logger.warning("Could not delete file {0}: {1}".format(fp, e))
return True
-