diff options
author | Sebastian Silva <sebastian@sugarlabs.org> | 2011-09-28 00:19:33 (GMT) |
---|---|---|
committer | Sebastian Silva <sebastian@sugarlabs.org> | 2011-09-28 06:54:34 (GMT) |
commit | 5861585e94a32b3032ac473804bf90c6e1363940 (patch) | |
tree | fb3a5bab0d75bf8eb780e749737fea87369754db /websdk/flask/module.py | |
parent | be7aa93d7ba3682d5189e1a7d72169c0b02a1ec1 (diff) |
Migrated to Flask, added JQuery sugar theme, fixed race condition
Diffstat (limited to 'websdk/flask/module.py')
-rw-r--r-- | websdk/flask/module.py | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/websdk/flask/module.py b/websdk/flask/module.py new file mode 100644 index 0000000..1c4f466 --- /dev/null +++ b/websdk/flask/module.py @@ -0,0 +1,42 @@ +# -*- coding: utf-8 -*- +""" + flask.module + ~~~~~~~~~~~~ + + Implements a class that represents module blueprints. + + :copyright: (c) 2011 by Armin Ronacher. + :license: BSD, see LICENSE for more details. +""" + +import os + +from .blueprints import Blueprint + + +def blueprint_is_module(bp): + """Used to figure out if something is actually a module""" + return isinstance(bp, Module) + + +class Module(Blueprint): + """Deprecated module support. Until Flask 0.6 modules were a different + name of the concept now available as blueprints in Flask. They are + essentially doing the same but have some bad semantics for templates and + static files that were fixed with blueprints. + + .. versionchanged:: 0.7 + Modules were deprecated in favor for blueprints. + """ + + def __init__(self, import_name, name=None, url_prefix=None, + static_path=None, subdomain=None): + if name is None: + assert '.' in import_name, 'name required if package name ' \ + 'does not point to a submodule' + name = import_name.rsplit('.', 1)[1] + Blueprint.__init__(self, name, import_name, url_prefix=url_prefix, + subdomain=subdomain, template_folder='templates') + + if os.path.isdir(os.path.join(self.root_path, 'static')): + self._static_folder = 'static' |