diff MoinMoin/config/multiconfig.py @ 2307:fe37834deb3d

Move a list of event handlers and subscribable events to config.
author Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
date Fri, 22 Jun 2007 17:15:26 +0200
parents c8ff348927db
children c142804478c7
line wrap: on
line diff
--- a/MoinMoin/config/multiconfig.py	Thu Jun 21 23:40:21 2007 +0200
+++ b/MoinMoin/config/multiconfig.py	Fri Jun 22 17:15:26 2007 +0200
@@ -14,6 +14,7 @@
 
 from MoinMoin import config, error, util, wikiutil
 import MoinMoin.auth as authmodule
+import MoinMoin.events as events
 from MoinMoin import session
 from MoinMoin.packages import packLine
 from MoinMoin.security import AccessControlList
@@ -446,6 +447,7 @@
     show_version = False
     siteid = 'default'
     stylesheets = [] # list of tuples (media, csshref) to insert after theme css, before user css
+    _subscribable_events = None # A list of event types that user can subscribe to
     subscribed_pages_default = [] # preload user subscribed pages with this page list
     subscribed_events_default = [] # preload user subscribed events with this list
     superuser = [] # list of unicode user names that have super powers :)
@@ -700,6 +702,10 @@
 
         if self.url_prefix_local is None:
             self.url_prefix_local = self.url_prefix_static
+            
+        # Register a list of available event handlers - this has to stay at the
+        # end, because loading plugins depends on having a config object
+        self.event_handlers = events.get_handlers(self)
 
 
     def load_meta_dict(self):
@@ -718,6 +724,15 @@
         return property(getter)
     iwid = make_iwid_property("_iwid")
     iwid_full = make_iwid_property("_iwid_full")
+    
+    # lazily load a list of events a user can subscribe to
+    def make_subscribable_events_prop():
+        def getter(self):
+            if getattr(self, "_subscribable_events", None) is None:
+                self._subscribable_events = events.get_subscribable_events()
+            return getattr(self, "_subscribable_events")
+        return property(getter)
+    subscribable_events = make_subscribable_events_prop()
 
     def load_IWID(self):
         """ Loads the InterWikiID of this instance. It is used to identify the instance