Commits

Anonymous committed 5598879

identity & babel config in separate methods

  • Participants
  • Parent commits dfb060f

Comments (0)

Files changed (1)

File newsmeme/application.py

         def authenticate():
             g.user = getattr(g.identity, 'user', None)
 
-
     def configure_context_processors(self):
 
         @self.app.context_processor
         oid.init_app(self.app)
         cache.init_app(self.app)
 
-        babel = Babel(self.app)
         setup_themes(self.app)
+
+        # more complicated setups
+
+        self.configure_identity()
+        self.configure_i18n()
+        
+    def configure_identity(self):
+
         Principal(self.app)
 
-        # identity loading
-
         @identity_loaded.connect_via(self.app)
         def on_identity_loaded(sender, identity):
             if identity.name and identity.name != 'anon':
                 identity.user = user
                 identity.provides.update(user.provides)
 
-        # babel configuration
+    def configure_i18n(self):
+
+        babel = Babel(self.app)
 
         @babel.localeselector
         def get_locale():