Templates: Create default dir (to be used by all templates as fallback)
authorReinhold Kainhofer <reinhold@kainhofer.com>
Sat, 3 Nov 2012 19:47:27 +0000 (3 20:47 +0100)
committerReinhold Kainhofer <reinhold@kainhofer.com>
Sat, 3 Nov 2012 19:47:27 +0000 (3 20:47 +0100)
Templates/default/webshop_descriptions.def [moved from Templates/EK_Full/webshop_descriptions.def with 94% similarity]
generate_oly_score.py

similarity index 94%
rename from Templates/EK_Full/webshop_descriptions.def
rename to Templates/default/webshop_descriptions.def
index 7f70121..47bb8a3 100644 (file)
@@ -14,4 +14,6 @@
     "<< e.sku >>": {"ismn": "<<e.ismn>>", "comment": "<<e.comment>>", "price": <<e.price|default(0.00)>>}, # << e.type >>
 <$- endfor $>
   },
+  "Productimages": [
+  ],
 }
index 3b1110b..047fb41 100755 (executable)
@@ -186,9 +186,10 @@ class Settings:
     global program_name;
     global script_path;
     templatename = self.get_template_name ();
+    self.defaulttemplatepath = script_path + '/Templates/default';
     self.templatepath = script_path + '/Templates/' + templatename;
     self.template_env = Environment (
-          loader = FileSystemLoader(self.templatepath),
+          loader = FileSystemLoader([self.templatepath,self.defaulttemplatepath]),
           block_start_string = '<$', block_end_string = '$>',
           variable_start_string = '<<', variable_end_string = '>>',
           comment_start_string = '<#', comment_end_string = '#>',
@@ -369,7 +370,7 @@ def write_settings_file_if_exists (settings, score_settings, template, filename)
     filename = settings.assemble_settings_filename (basename, filename);
     write_file (settings.out_dir, filename, template.render (score_settings));
     return filename;
-  except jinja2.exceptions.TemplateNotFound:
+  except jinja2.exceptions.TemplateNotFound as e:
     return None;
 
 def generate_settings_files (score_name, score_settings, settings, settings_files):