Permalink
Browse files

Split up blog_features into parts:

 * blog_controller
 * blog_filters
 * blog_templates

This is so we can later on instantiate the controller seperately.
  • Loading branch information...
EnigmaCurry committed Feb 6, 2011
1 parent 33af500 commit 9135468846a7b60dc80f7fe51c903ae4c706a69f
Showing with 17 additions and 13 deletions.
  1. +17 −13 blogofile/site_init/__init__.py
  2. 0 blogofile/site_init/{blog_features → blog_controller}/_controllers/blog/__init__.py
  3. 0 blogofile/site_init/{blog_features → blog_controller}/_controllers/blog/archives.py
  4. 0 blogofile/site_init/{blog_features → blog_controller}/_controllers/blog/categories.py
  5. 0 blogofile/site_init/{blog_features → blog_controller}/_controllers/blog/chronological.py
  6. 0 blogofile/site_init/{blog_features → blog_controller}/_controllers/blog/feed.py
  7. 0 blogofile/site_init/{blog_features → blog_controller}/_controllers/blog/permapage.py
  8. 0 blogofile/site_init/{blog_features → blog_controller}/_controllers/blog/post.py
  9. 0 blogofile/site_init/{blog_features → blog_controller}/_controllers/org.py
  10. 0 blogofile/site_init/{blog_features → blog_filters}/_filters/markdown_template.py
  11. 0 blogofile/site_init/{blog_features → blog_filters}/_filters/rst_template.py
  12. 0 blogofile/site_init/{blog_features → blog_filters}/_filters/syntax_highlight.py
  13. 0 blogofile/site_init/{blog_features → blog_filters}/_filters/textile_template.py
  14. 0 blogofile/site_init/{blog_features → blog_templates}/_templates/blog/atom.mako
  15. 0 blogofile/site_init/{blog_features → blog_templates}/_templates/blog/chronological.mako
  16. 0 blogofile/site_init/{blog_features → blog_templates}/_templates/blog/permapage.mako
  17. 0 blogofile/site_init/{blog_features → blog_templates}/_templates/blog/post.mako
  18. 0 blogofile/site_init/{blog_features → blog_templates}/_templates/blog/post_excerpt.mako
  19. 0 blogofile/site_init/{blog_features → blog_templates}/_templates/blog/rss.mako
@@ -28,7 +28,8 @@
"simple_blog": ["blog_features"],
"simple_html5_blog": ["blog_features", "html5_blog_features"],
"blog_unit_test":["blog_features"],
- "blog_features":[(util.rewrite_strings_in_files,
+ "blog_features":["blog_controller","blog_templates","blog_filters",
+ (util.rewrite_strings_in_files,
{"existing_string":"@BLOGOFILE_VERSION_REPLACED_HERE@",
"replacement_string":bf_version,
"paths":["_controllers/blog/__init__.py"]})]
@@ -89,7 +90,6 @@ def import_site_init(feature):
if type(feature) == tuple:
feature[0](**feature[1])
return
-
path = os.path.join(os.path.split(__file__)[0], feature)
if os.path.isdir(path):
logger.info(u"Initializing site from directory: " + path)
@@ -106,17 +106,21 @@ def import_site_init(feature):
mod.do_init()
#Otherwise, load it from the zip file
else:
- logger.info("Initializing feature from zip file: {0}".format(feature))
- zip_data = pkgutil.get_data("blogofile.site_init", feature + ".zip")
- zip_file = zipfile.ZipFile(StringIO.StringIO(zip_data))
- for name in zip_file.namelist():
- if name.endswith('/'):
- util.mkdir(name)
- else:
- util.mkdir(os.path.split(name)[0])
- f = open(name, 'wb')
- f.write(zip_file.read(name))
- f.close()
+ try:
+ zip_data = pkgutil.get_data("blogofile.site_init", feature + ".zip")
+ except IOError:
+ pass
+ else:
+ logger.info("Initializing feature from zip file: {0}".format(feature))
+ zip_file = zipfile.ZipFile(StringIO.StringIO(zip_data))
+ for name in zip_file.namelist():
+ if name.endswith('/'):
+ util.mkdir(name)
+ else:
+ util.mkdir(os.path.split(name)[0])
+ f = open(name, 'wb')
+ f.write(zip_file.read(name))
+ f.close()
#Recursively import child features of this feature
try:
child_features = extra_features[feature]

0 comments on commit 9135468

Please sign in to comment.