[Fusionforge-commits] r14655 - in trunk: . src/plugins/moinmoin/etc src/plugins/moinmoin/lib

Roland Mas lolando at fusionforge.org
Fri Oct 14 18:08:06 CEST 2011


Author: lolando
Date: 2011-10-14 18:08:06 +0200 (Fri, 14 Oct 2011)
New Revision: 14655

Modified:
   trunk/
   trunk/src/plugins/moinmoin/etc/PROJECT_NAME.py.tmpl
   trunk/src/plugins/moinmoin/lib/farmconfig.py
Log:
Move all of the project initialization of the instance Config object
to the generic farmconfig module, so that it is properly shared across
instances.


Modified: trunk/src/plugins/moinmoin/etc/PROJECT_NAME.py.tmpl
===================================================================
--- trunk/src/plugins/moinmoin/etc/PROJECT_NAME.py.tmpl	2011-10-14 16:07:57 UTC (rev 14654)
+++ trunk/src/plugins/moinmoin/etc/PROJECT_NAME.py.tmpl	2011-10-14 16:08:06 UTC (rev 14655)
@@ -1,21 +1,6 @@
-# This is a template to instantiate a wiki for a given project
-# The only parameter is the project name which should correspond
-# to the unix_group_name associated with the project in the forge
+# This is the MoinMoin configuration for @PROJECT_NAME@
 
 from farmconfig import FarmConfig
-import fusionforge
 
 class Config(FarmConfig):
-    project_name = "@PROJECT_NAME@"
-    # Substituted by create-wikis.php
-
-    sitename = u'%s' % project_name
-    interwikiname = u'%s' % project_name
-    page_front_page = u'FrontPage'
-
-    data_dir = '/var/lib/gforge/plugins/moinmoin/wikidata/%s/data' % project_name
-    data_underlay_dir = '/var/lib/gforge/plugins/moinmoin/wikidata/%s/underlay' % project_name
-
-    ffsa = fusionforge.FusionForgeSessionAuth()
-    acl_rights_default = ffsa.get_moinmoin_acl_string(project_name)
-    
+    pass

Modified: trunk/src/plugins/moinmoin/lib/farmconfig.py
===================================================================
--- trunk/src/plugins/moinmoin/lib/farmconfig.py	2011-10-14 16:07:57 UTC (rev 14654)
+++ trunk/src/plugins/moinmoin/lib/farmconfig.py	2011-10-14 16:08:06 UTC (rev 14655)
@@ -6,23 +6,40 @@
 
 class FarmConfig(multiconfig.DefaultConfig):
 
-    # basic options (you normally need to change these)
-    sitename = u'ForgeWiki' # [Unicode]
-    interwikiname = u'ForgeWiki' # [Unicode]
+    # Common declarations
 
     page_front_page = u"FrontPage"
+    theme_default = 'mentalwealth'
 
     ffsa = fusionforge.FusionForgeSessionAuth()
     ff_host = fusionforge.FusionForgeLink().get_config('web_host')
 
     auth = [ffsa]
-    theme_default = 'mentalwealth'
 
+    # Defaults (overridden per project)
+
+    sitename = u'ForgeWiki' # [Unicode]
+    interwikiname = u'ForgeWiki' # [Unicode]
+
     acl_rights_default = \
       string.join (map (lambda u: u+":read,write,delete,revert,admin",
                         ffsa.admins)
                    + ["All:"])
 
+    def __init__(self, project_name):
+        self.project_name = project_name
+        self.sitename = u'%s' % project_name
+        self.interwikiname = u'%s' % project_name
+        self.data_dir = '/var/lib/gforge/plugins/moinmoin/wikidata/%s/data' % project_name
+        self.data_underlay_dir = '/var/lib/gforge/plugins/moinmoin/wikidata/%s/underlay' % project_name
+
+        self.acl_rights_default = self.ffsa.get_moinmoin_acl_string(project_name)
+
+        # Call inherited constructor once instance specific variables
+        # have been set.
+
+        multiconfig.DefaultConfig.__init__(self, project_name)
+
     def groups (self, request):
         from MoinMoin.datastruct import WikiGroups, CompositeGroups
         from ff_groups import FFLazyGroups




More information about the Fusionforge-commits mailing list