def __before__(self, action, **params): c.site_title = config.setdefault('site_title', 'Non-Bibliographica') # Why doesn't setting strict_c to False avoid this ...? for attr, val in { 'url': '', 'bindings': [], 'boolean': False, 'warnings': None, 'person_total': 0, 'manif_total': 0, 'work_total': 0, 'results': [], 'read_user': '', 'graph': None }.items(): if not hasattr(c, attr): setattr(c, attr, val) super(BaseController, self).__before__(action, **params) # WARNING: you must use request.GET as request.params appears to alter # request.body (it gets url-encoded) upon call to request.params c.q = c.query = request.GET.get("q", None) c.reqpage = to_int(request.params.get('page', 1), maxn=50) c.limit = to_int(request.GET.get('limit', '500'), maxn=5000) c.items_per_page = to_int(request.GET.get('items_per_page', 20)) c.offset = (c.reqpage - 1) * c.items_per_page c.deliverance_enabled = bool(config.get('deliverance.enabled', '')) self._set_user()
def configure(self, config): config.setdefault("cswservice.title", "Untitled Service - set cswservice.title in config") config.setdefault("cswservice.abstract", "Unspecified service description - set cswservice.abstract in config") config.setdefault("cswservice.keywords", "") config.setdefault("cswservice.keyword_type", "theme") config.setdefault("cswservice.provider_name", "Unnamed provider - set cswservice.provider_name in config") config.setdefault("cswservice.contact_name", "No contact - set cswservice.contact_name in config") config.setdefault("cswservice.contact_position", "") config.setdefault("cswservice.contact_voice", "") config.setdefault("cswservice.contact_fax", "") config.setdefault("cswservice.contact_address", "") config.setdefault("cswservice.contact_city", "") config.setdefault("cswservice.contact_region", "") config.setdefault("cswservice.contact_pcode", "") config.setdefault("cswservice.contact_country", "") config.setdefault("cswservice.contact_email", "") config.setdefault("cswservice.contact_hours", "") config.setdefault("cswservice.contact_instructions", "") config.setdefault("cswservice.contact_role", "") config["cswservice.rndlog_threshold"] = float(config.get("cswservice.rndlog_threshold", "0.01"))
def configure(self, config): config.setdefault("cswservice.title", "Untitled Service - set cswservice.title in config") config.setdefault( "cswservice.abstract", "Unspecified service description - set cswservice.abstract in config" ) config.setdefault("cswservice.keywords", "") config.setdefault("cswservice.keyword_type", "theme") config.setdefault( "cswservice.provider_name", "Unnamed provider - set cswservice.provider_name in config") config.setdefault( "cswservice.contact_name", "No contact - set cswservice.contact_name in config") config.setdefault("cswservice.contact_position", "") config.setdefault("cswservice.contact_voice", "") config.setdefault("cswservice.contact_fax", "") config.setdefault("cswservice.contact_address", "") config.setdefault("cswservice.contact_city", "") config.setdefault("cswservice.contact_region", "") config.setdefault("cswservice.contact_pcode", "") config.setdefault("cswservice.contact_country", "") config.setdefault("cswservice.contact_email", "") config.setdefault("cswservice.contact_hours", "") config.setdefault("cswservice.contact_instructions", "") config.setdefault("cswservice.contact_role", "") config["cswservice.rndlog_threshold"] = float( config.get("cswservice.rndlog_threshold", "0.01"))