Permalink
Browse files

Quick revision to 0.1.1, added attribute to themes.

  • Loading branch information...
1 parent 2252888 commit 46a3931b5e8579b498bc4fcbb5f37a90a322e129 @sysr-q committed Feb 11, 2013
Showing with 16 additions and 3 deletions.
  1. +2 −1 base_theme/info.json
  2. +5 −0 docs/index.rst
  3. +2 −1 example/themes/calmblue/info.json
  4. +2 −1 example/themes/plain/info.json
  5. +5 −0 flask_themes2/__init__.py
@@ -7,5 +7,6 @@
"website": "http://leafstorm.us/",
"license": "Public Domain",
"preview": "preview.png",
- "doctype": "html5"
+ "doctype": "html5",
+ "version": "1.0.0"
}
View
@@ -131,6 +131,11 @@ function:
``html5`` to be safe. HTML5 is used by the majority of Flask users, so
it's best to use it.)
+``version``
+ This is simply to make it easier to distinguish between what version
+ of your theme people are using. It's up to the theme/layout to decide
+ whether or not to show this, though.
+
``options``
If this is given, it should be a dictionary (object in JSON parlance)
containing application-specific options. You will need to check the
@@ -4,5 +4,6 @@
"name": "Calm Blue",
"author": "LeafStorm",
"description": "A calm, blue theme based on Flaskr.",
- "license": "MIT/X11"
+ "license": "MIT/X11",
+ "version": "1.0.1"
}
@@ -4,5 +4,6 @@
"name": "Plain",
"author": "LeafStorm",
"license": "MIT/X11",
- "description": "An easy-to-read, green-based theme!"
+ "description": "An easy-to-read, green-based theme!",
+ "version": "1.0.0"
}
@@ -78,6 +78,8 @@ def global_theme_get_info(ctx, attribute_name, fallback=''):
theme = get_theme(active_theme(ctx))
try:
info = getattr(theme, attribute_name)
+ if info is None:
+ raise AttributeError("Got None for getattr(theme, '{0}')".format(attribute_name))
return info
except AttributeError:
pass
@@ -440,6 +442,9 @@ def __init__(self, path):
#: with html5 being the default if not specified.
self.doctype = i.get('doctype', 'html5')
+ #: The theme's version string.
+ self.version = i.get('version')
+
#: Any additional options. These are entirely application-specific,
#: and may determine other aspects of the application's behavior.
self.options = i.get('options', {})

0 comments on commit 46a3931

Please sign in to comment.