--- orig/MoinMoin/multiconfig.py
+++ mod/MoinMoin/multiconfig.py
@@ -10,101 +10,64 @@
 
 import re, os, sys
 from MoinMoin import error
-
+    
 
 _url_re = None
 def url_re():
     """ Return url matching regular expression
 
-    Using this regular expression, we find the config_module for each
+    Using this regular expression, we find the wiki package for each
     url.
     
-    Import wikis from 'farmconfig' on the first time, compile and cache url_re
+    Import wikis from farm onfig on the first time, compile and cache url_re
     regular expression, and return it.
 
-    Note: You must restart a long running process when you edit
-    farmconfig.py config file.
-
     @rtype: compiled re object
     @return: url to wiki config  matching re
     """
     global _url_re
     if not _url_re:
         try:
-            farmconfig = __import__('farmconfig', globals(), {})
+            from farm.config import wikis
             pattern = '|'.join([r'(?P<%s>%s)' % (name, regex)
-                                for name, regex in farmconfig.wikis])
+                                for name, regex in wikis])
             _url_re = re.compile(pattern)
-        except (ImportError, AttributeError):
-            # It is not there, so we maybe have only one config. Fall back to
-            # old config file name and use it for all urls we get.
-            # Or we have a farmconfig file, but it does not contain a wikis
-            # attribute (because of typo or everything commented out as in
-            # sample config).
-            _url_re = re.compile(r'(?P<wikiconfig>.)')
+        except ImportError:
+            # Either there is no farm config or it is bad. Use the
+            # default wiki name for all requests.
+            _url_re = re.compile(r'(?P<wiki>.+)')
     return _url_re
 
 
 def getConfig(url):
-    """ Make and return config object, or raise an error
-
-    If the config file is not found or broken, either because of a typo
-    in farmconfig or deleted file or some other error, we raise a
-    ConfigurationError which is handled by our client.
-    
-    @param url: the url from request, possibly matching specific wiki
-    @rtype: DefaultConfig subclass instance
-    @return: config object for specific wiki
-    """
+    """ Return a config object matching url """
     match = url_re().match(url)
-    if match and match.groups():
-        # Get config module name from match
+    if match:
         for name, value in match.groupdict().items():
             if value: break
-
-        # FIXME: we should cache config objects by wiki url and return
-        # here a ready to use config, instead of creating new instance
-        # for each request.
-        
+        # Try to import a Config class from name config
+        wikiConfig = 'farm.%s.config' % name
         try:
-            module =  __import__(name, globals(), {})
-            Config = getattr(module, 'Config', None)
-            if Config:
-                # Config found, return config instance using name as
-                # site identifier (name must be unique of our url_re).
-                cfg = Config(name)
-                return cfg
-            else:
-                # Broken config file, probably old config from 1.2
-                msg = '''
-Could not find required "Config" class in "%(name)s.py". This might
-happen if you are trying to use a pre 1.3 configuration file, or made a
-syntax or spelling error.
-
-Please check your configuration file. As an example for correct syntax,
-use the wikiconfig.py file from the distribution.
-''' % {'name': name}
-
-        # We don't handle fatal errors here
-        except error.FatalError, err:
-            raise err
-
-        # These errors will not be big surprise:       
+            module =  __import__(wikiConfig, globals(), {}, ['Config'])
+            Config = getattr(module, 'Config')
+            return Config(name)
         except ImportError, err:
             msg = '''
 Import of configuration file "%(name)s.py" failed because of
 ImportError: %(err)s.
 
-Check that the file is in the same directory as the server script. If
-it is not, you must add the path of the directory where the file is located
-to the python path in the server script. See the comments at the top of
-the server script.
-
-Check that the configuration file name is either "wikiconfig.py" or the
-module name specified in the wikis list in farmconfig.py. Note that the module
-name does not include the ".py" suffix.
-''' % {'name': name, 'err': str(err)}
+Check the path to the farm in the server script. Check that the
+configuration file name is "config.py".
+''' % {'name': wikiConfig, 'err': str(err)}
+        except AttributeError:
+            msg = '''
+Could not find required "Config" class in "%(name)s.py". This might
+happen if you are trying to use a pre 1.3 configuration file, or made a
+syntax or spelling error.
 
+Please check your configuration file. As an example for correct syntax,
+use the config.py file from the distribution.
+''' % {'name': wikiConfig}
         except IndentationError, err:
             msg = '''
 Import of configuration file "%(name)s.py" failed because of
@@ -113,10 +76,7 @@
 The configuration files are python modules. Therefore, whitespace is
 important. Make sure that you use only spaces, no tabs are allowed here!
 You have to use four spaces at the beginning of the line mostly.
-''' % {'name': name, 'err': str(err)}
-
-        # But people can have many other errors. We hope that the python
-        # error message will help them.
+''' % {'name': wikiConfig, 'err': str(err)}
         except:
             err = sys.exc_info()[1]
             msg = '''
@@ -126,10 +86,8 @@
 We hope this error message make sense. If not, you are welcome to ask on
 the page http://moinmoin.wikiwikiweb.de/MoinMoinQuestions/ConfigFiles
 or the #moin channel on irc.freenode.net or on the mailing list.
-''' % {'name': name, 'class': err.__class__.__name__, 'err': str(err)}
-
+''' % {'name': wikiConfig, 'class': err.__class__.__name__, 'err': str(err)}
     else:
-        # URL did not match anything, probably error in farmconfig.wikis 
         msg = '''
 Could not find a match for url: "%(url)s".
 
@@ -174,8 +132,11 @@
     chart_options = None
     config_check_enabled = 0
     cookie_lifetime = 12 # 12 hours from now
-    data_dir = './data/'
-    data_underlay_dir = './underlay/'
+
+    # Lazy initialized
+    data_dir = None
+    data_underlay_dir = None
+
     date_fmt = '%Y-%m-%d'
     datetime_fmt = '%Y-%m-%d %H:%M:%S'
     default_lang = 'en'
@@ -270,9 +231,10 @@
     
     SecurityPolicy = None
 
-    def __init__(self, siteid):
+    def __init__(self, siteid='wiki'):
         """ Init Config instance """
         self.siteid = siteid
+        self._initializeDirectories()
         if self.config_check_enabled:
             self._config_check()
             
@@ -281,9 +243,6 @@
 
         # Make sure directories are accessible
         self._check_directories()
-
-        # Load plugin module
-        self._loadPluginModule()
         
         # Normalize values
         self.default_lang = self.default_lang.lower()
@@ -401,6 +360,15 @@
                                 raise error.ConfigurationError(message %
                                                                {'name': name})
 
+    def _initializeDirectories(self):
+        """ Use default directories paths unless overridden """
+        import farm
+        farmPath = os.path.abspath(os.path.dirname(farm.__file__))
+        if self.data_underlay_dir is None:
+            self.data_underlay_dir = os.path.join(farmPath, 'underlay')
+        if self.data_dir is None:
+            self.data_dir = os.path.join(farmPath, self.siteid, 'data')
+
     def _check_directories(self):
         """ Make sure directories are accessible
 
@@ -408,15 +376,13 @@
         execute.
         """
         mode = os.F_OK | os.R_OK | os.W_OK | os.X_OK
-        for attr in ('data_dir', 'data_underlay_dir'):
+        for attr, required in (('data_dir', 1), ('data_underlay_dir', 0)):
             path = getattr(self, attr)
-            
-            # allow an empty underlay path or None
-            if attr == 'data_underlay_dir' and not path:
+            if path == '' and not required:
                 continue
-
-            path_pages = os.path.join(path, "pages")
-            if not (os.path.isdir(path_pages) and os.access(path_pages, mode)):
+            pages = os.path.join(path, "pages")
+            # TODO: access should not be used here!
+            if not (os.path.isdir(pages) and os.access(pages, mode)):
                 msg = '''
 "%(attr)s" does not exists at "%(path)s", or has incorrect ownership and
 permissions.
