moinsetup

Changeset

68:77363a567246
2013-01-10 Paul Boddie raw files shortlog changelog graph Attempted to generate cleaner URLs for use with mod_rewrite directives. Added a note about logging to the "to do" list.
TO_DO.txt (file) moinsetup.py (file)
     1.1 --- a/TO_DO.txt	Wed Dec 19 00:54:18 2012 +0100
     1.2 +++ b/TO_DO.txt	Thu Jan 10 22:06:27 2013 +0100
     1.3 @@ -1,3 +1,6 @@
     1.4 +Logging and error handling:
     1.5 +  WSGIServer(application, debug="web").run() # moin.cgi 1.9
     1.6 +
     1.7  Provide limited hosting environment site descriptions.
     1.8    Currently, the test for limited hosting is a lack of a site descriptions directory.
     1.9  
     2.1 --- a/moinsetup.py	Wed Dec 19 00:54:18 2012 +0100
     2.2 +++ b/moinsetup.py	Thu Jan 10 22:06:27 2013 +0100
     2.3 @@ -77,12 +77,12 @@
     2.4  # in different places, however.
     2.5  
     2.6  apache_htaccess_combined_mod_rewrite = """\
     2.7 -DirectoryIndex %(url_path)s/moin.cgi/
     2.8 +DirectoryIndex %(url_path_tr)s/moin.cgi/
     2.9  RewriteEngine On
    2.10  RewriteBase %(final_url_path)s
    2.11  RewriteCond %%{REQUEST_FILENAME} !-f
    2.12  RewriteCond %%{REQUEST_FILENAME} !-d
    2.13 -RewriteRule ^(.*) %(url_path)s/moin.cgi/$1 [PT,L,QSA]
    2.14 +RewriteRule ^(.*) %(url_path_tr)s/moin.cgi/$1 [PT,L,QSA]
    2.15  """
    2.16  
    2.17  # Post-setup templates.
    2.18 @@ -460,6 +460,8 @@
    2.19          self.url_path = self._tidy_url_path(url_path)
    2.20          self.static_url_path = static_url_path and self._tidy_url_path(static_url_path)
    2.21  
    2.22 +        self.url_path_tr = self._truncate_url_path(url_path)
    2.23 +
    2.24          # Define and create specific directories.
    2.25          # Here are the configuration and actual Wiki data directories.
    2.26  
    2.27 @@ -587,6 +589,12 @@
    2.28          else:
    2.29              return url_path
    2.30  
    2.31 +    def _truncate_url_path(self, url_path):
    2.32 +        if url_path.endswith("/"):
    2.33 +            return url_path[:-1]
    2.34 +        else:
    2.35 +            return url_path
    2.36 +
    2.37      def _set_pythonpath(self):
    2.38          path = os.environ.get("PYTHONPATH", "")
    2.39