class InstanceBadgeFacet(SolrFacet): name = 'instancebadge' entity_type = model.Badge title = lazy_ugettext(u'Badge') solr_field = 'facet.instance.badges' show_current_empty = False @classmethod def add_data_to_index(cls, instance, index): if not isinstance(instance, model.Instance): return d = [ref_attr_value(badge) for badge in instance.badges] index[cls.solr_field] = d
class InstanceFacet(SolrFacet): name = 'instance' entity_type = model.Instance title = lazy_ugettext(u'Instance') solr_field = 'facet.instances' @classmethod def add_data_to_index(cls, user, index): if not isinstance(user, model.User): return index[cls.solr_field] = [ ref_attr_value(instance) for instance in user.instances ]
class DelegateableBadgeFacet(SolrFacet): """Index all delegateable badges""" name = 'delegateablebadge' entity_type = model.Badge title = lazy_ugettext(u'Categories') solr_field = 'facet.delegateable.badge' show_current_empty = False @classmethod def add_data_to_index(cls, entity, data): if not isinstance(entity, model.Delegateable): return d = [ref_attr_value(badge) for badge in entity.badges] data[cls.solr_field] = d
class DelegateableMilestoneFacet(SolrFacet): name = 'delegateablemilestone' entity_type = model.Milestone title = lazy_ugettext(u'Milestones') solr_field = 'facet.delegateable.milestones' show_current_empty = False @classmethod def add_data_to_index(cls, entity, data): if not isinstance(entity, model.Delegateable): return if entity.milestone is not None: data[cls.solr_field] = [entity.milestone.id] else: return []
class DelegateableTags(SolrFacet): name = 'delegateabletags' entity_type = model.Tag title = lazy_ugettext(u'Tags') solr_field = 'facet.delegateable.tags' show_current_empty = False @classmethod def add_data_to_index(cls, entity, data): if not isinstance(entity, model.Delegateable): return tags = [] for tag, count in entity.tags: tags.extend([ref_attr_value(tag)] * count) data[cls.solr_field] = tags
class DelegateableAddedByBadgeFacet(SolrFacet): name = 'added_by_badge' entity_type = model.Badge title = lazy_ugettext(u'Created by') solr_field = 'facet.delegateable.added.by.badge' show_current_empty = False @classmethod def add_data_to_index(cls, entity, data): if not isinstance(entity, model.Delegateable): return data[cls.solr_field] = [ ref_attr_value(badge) for badge in entity.creator.badges if (badge.instance is entity.instance or badge.instance is None) ]
def __init__(self, menu=[]): if not menu: base = self.base make_controller = self.make_controller def make_item(make_controller, base, name, display_name, item_class=MenuItem): return name, item_class(make_controller, base, name, display_name) menu = [ make_item(make_controller, base, name, value.display_name) for name, value in sorted(posy_services()) ] menu.append(make_item(make_controller, base, 'general', lazy_ugettext('General'), GeneralSettingsItem)) super(Menu, self).__init__(menu)
class DelegateableBadgeCategoryFacet(SolrFacet): """Index all delegateable badge categories""" name = 'delegateablebadgecategory' entity_type = model.Badge title = lazy_ugettext(u'Categories') solr_field = 'facet.delegateable.badgecategory' @property def show_current_empty(self): return not asbool( config.get('adhocracy.hide_empty_categories_in_facet_list', 'false')) @classmethod def add_data_to_index(cls, entity, data): if not isinstance(entity, model.Delegateable): return data[cls.solr_field] = [ ref_attr_value(badge) for badge in entity.categories ]
from pylons.i18n import _ from pylons.i18n import lazy_ugettext from pylons.controllers.util import abort from paste.urlparser import PkgResourcesParser from pylons.controllers.util import forward from adhocracy import config from adhocracy.lib.base import BaseController from adhocracy.lib.templating import render BODY_RE = re.compile("<br \/><br \/>(.*)<\/body", re.S) ERROR_MESSAGES = { 404: lazy_ugettext(u"The requested page could not be found."), 503: lazy_ugettext(u"The system is currently down for maintenance. " u"Please check back soon!"), } ERROR_NAMES = { 400: lazy_ugettext("Bad Request"), 401: lazy_ugettext("Unauthorized"), 403: lazy_ugettext("Forbidden"), 404: lazy_ugettext("Not Found"), 418: lazy_ugettext("I'm a teapot"), 500: lazy_ugettext("Internal Server Error"), 503: lazy_ugettext("Service Unavailable"), } class ErrorController(BaseController):
from pylons.i18n import _ from pylons.i18n import lazy_ugettext from pylons.controllers.util import abort from paste.urlparser import PkgResourcesParser from pylons.controllers.util import forward from adhocracy import config from adhocracy.lib.base import BaseController from adhocracy.lib.templating import render BODY_RE = re.compile("<br \/><br \/>(.*)<\/body", re.S) ERROR_MESSAGES = { 404: lazy_ugettext(u"The requested page could not be found."), 503: lazy_ugettext(u"The system is currently down for maintenance. " u"Please check back soon!"), } ERROR_NAMES = { 400: lazy_ugettext('Bad Request'), 401: lazy_ugettext('Unauthorized'), 403: lazy_ugettext('Forbidden'), 404: lazy_ugettext('Not Found'), 418: lazy_ugettext('I\'m a teapot'), 500: lazy_ugettext('Internal Server Error'), 503: lazy_ugettext('Service Unavailable'), } class ErrorController(BaseController):