class ConsumerAndContext: def __init__(self, id, consumer, context): self.id = id self._consumer = consumer context.id = id self.context = context @property def consumer(self): return self._consumer() consumers = dict([ (re.sub('AuthConsumer$', '', name).lower(), cls) for name, cls in get_modules_script_classes('authentication', AuthenticationConsumer).items() if not re.search('AbstractAuthConsumer$', name) ]) contexts = dict([ (re.sub('AuthContext$', '', name).lower(), cls) for name, cls in get_modules_script_classes('authentication', ConsumerTemplateContext).items() ]) AUTH_PROVIDERS = dict([ (name, ConsumerAndContext(name, consumers[name], contexts[name])) for name in consumers.keys() if name in contexts ]) #todo: probably this don't belong here, also this post_stored routine needs a lot of work
def __init__(self, id, consumer, context): self.id = id self._consumer = consumer context.id = id self.context = context @property def consumer(self): return self._consumer() consumers = dict( [ (re.sub("AuthConsumer$", "", name).lower(), cls) for name, cls in get_modules_script_classes("authentication", AuthenticationConsumer).items() if not re.search("AbstractAuthConsumer$", name) ] ) contexts = dict( [ (re.sub("AuthContext$", "", name).lower(), cls) for name, cls in get_modules_script_classes("authentication", ConsumerTemplateContext).items() ] ) AUTH_PROVIDERS = dict( [(name, ConsumerAndContext(name, consumers[name], contexts[name])) for name in consumers.keys() if name in contexts] )
'Answer', 'AnswerRevision', 'AnonymousAnswer', 'Tag', 'Comment', 'Vote', 'FlaggedItem', 'MarkedTag', 'Badge', 'Award', 'Repute', 'Activity', 'EmailFeedSetting', 'ValidationHash', 'AuthKeyUserAssociation', 'User', ] from forum.modules import get_modules_script_classes for k, v in get_modules_script_classes('models', models.Model).items(): if not k in __all__: __all__.append(k) exec "%s = v" % k
'AnonymousNode', 'Question', 'FavoriteQuestion', 'QuestionSubscription', 'QuestionRevision', 'Answer', 'AnswerRevision', 'Tag', 'Comment', 'Vote', 'FlaggedItem', 'MarkedTag', 'Badge', 'Award', 'Repute', 'Activity', 'ValidationHash', 'AuthKeyUserAssociation', 'SubscriptionSettings', 'KeyValue', 'User', ] from forum.modules import get_modules_script_classes for k, v in get_modules_script_classes('models', models.Model).items(): if not k in __all__: __all__.append(k) exec "%s = v" % k NodeMetaClass.setup_relations()
class ConsumerAndContext: def __init__(self, id, consumer, context): self.id = id self._consumer = consumer context.id = id self.context = context @property def consumer(self): return self._consumer() consumers = dict([(re.sub('AuthConsumer$', '', name).lower(), cls) for name, cls in get_modules_script_classes( 'authentication', AuthenticationConsumer).items() if not re.search('AbstractAuthConsumer$', name)]) contexts = dict([(re.sub('AuthContext$', '', name).lower(), cls) for name, cls in get_modules_script_classes( 'authentication', ConsumerTemplateContext).items()]) AUTH_PROVIDERS = dict([(name, ConsumerAndContext(name, consumers[name], contexts[name])) for name in consumers.keys() if name in contexts]) #todo: probably this don't belong here, also this post_stored routine needs a lot of work user_logged_in = django.dispatch.Signal(providing_args=["user", "old_session"]) user_updated = django.dispatch.Signal( providing_args=["instance", "updated_by"])
import re from forum.badges.base import AbstractBadge from forum.modules import get_modules_script_classes ALL_BADGES = [ cls() for name, cls in get_modules_script_classes('badges', AbstractBadge).items() if not re.search('AbstractBadge$', name) ]
import re from forum.badges.base import BadgeImplementation from forum.modules import get_modules_script_classes ALL_BADGES = dict([ (re.sub('BadgeImpl', '', name).lower(), cls) for name, cls in get_modules_script_classes('badges', BadgeImplementation).items() if not re.search('AbstractBadgeImpl$', name) ])