def __init__(self, views, objects=tuple(), conf={}): self._conf = getConf(conf) self._logger_store = LoggerStore(self._conf['logger_store']) self._objects = [ security.db.User, security.db.Role, security.db.Permission, security.db.Grant, security.db.Session, ] assert hasattr(objects, '__iter__') self._objects.extend(objects) self._views = {} self._auth_plugins = {} if 'auth' in self._conf: for plugin_name, plugin_conf in self._conf['auth'].iteritems(): plugin_table, plugin = self.available_auth_plugins[plugin_name] self.logger.debug("Register auth plugin: %s" % plugin_name) self._objects.append(plugin_table) self._auth_plugins[plugin_name] = plugin(plugin_conf) for id, view in views.iteritems(): if not hasattr(view, '__template_dir__') or \ view.__template_dir__ is None: view.__template_dir__ = self._conf['template_dir'] self._registerView(view, id)
def Application(views, objects=[], conf={}, initial_data=[]): conf = getConf(conf) if conf.get('database') is None: return BaseApplication(views, objects=objects, conf=conf) else: return DBApplication(views, objects=objects, conf=conf, initial_data=initial_data)