Changes between Initial Version and Version 1 of Ticket #11584, comment 2


Ignore:
Timestamp:
Feb 20, 2014, 12:51:10 AM (10 years ago)
Author:
Ryan J Ollos
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #11584, comment 2

    initial v1  
    1 In [changeset:"13672"]:
    2 {{{
    3 #!CommitTicketReference repository="" revision="13672"
    4 Applied Trac 1.0 compatibility patch. Fixes #11584. Patch by bwanamarko.
     1Hi @rjollos,
     2
     3Oops! There were a few typos. I had tested an earlier version. I am so sorry! This version is now tested and running on Windows 7 with no errors. A new patch for r13672 is attached, with these changes:
     4
     51. On [http://trac-hacks.org/browser/windowsservicescript/tracservice.py#L67 L67] in `OPTS` each part of `auth` tuple should be enclosed in separate sets of quotes.
     62. Forgot to add quotes around string `'log'` on [http://trac-hacks.org/browser/windowsservicescript/tracservice.py#L76 L76].
     73. Since using tuple for `auth`, in `add_auths()` on [http://trac-hacks.org/browser/windowsservicescript/tracservice.py#L81 L81] remove [http://trac-hacks.org/browser/windowsservicescript/tracservice.py#L82 L82] and change input arg `vals` to `info`.
     84. `base_path` never had any default, so set its default to `None` after [http://trac-hacks.org/browser/windowsservicescript/tracservice.py#L132 L132].
     95. Can't split `None` so move [http://trac-hacks.org/browser/windowsservicescript/tracservice.py#L162 L162] into `if` block
     106. These are non-POSIX paths, so don't need to strip forward slashes, only backslashes.
     11
     12{{{#!diff
     13--- a/tracservice.py
     14+++ b/tracservice.py
     15@@ -64,7 +64,7 @@
     16 OPTS = [
     17     ('--hostname', 'mycomputer.mydomain.com'),
     18     ('--single-env', True),
     19-    ('--auth', ('trac,c:\\path\\to\\pswd\\file,TracRealm')),
     20+    ('--auth', ('TracProj', 'c:\\path\\to\\pswd\\file', 'TracRealm')),
     21     ('--port', '80'),
     22 ]
     23 
     24@@ -73,16 +73,15 @@
     25 # Other constants
     26 PYTHONDIR = sysconfig.get_python_lib()  # gets site-packages folder
     27 PYTHONSERVICE_EXE=os.path.join(PYTHONDIR, 'win32', 'pythonservice.exe')
     28-LOG_DIR = os.path.join(TRAC_PROJECT, log)
     29+LOG_DIR = os.path.join(TRAC_PROJECT, 'log')
     30 
     31 # Trac instance(s)
     32 ARGS = [TRAC_PROJECT]
     33 
     34-def add_auth(auths, vals, cls):
     35-    info = vals.split(',', 3)
     36+def add_auth(auths, info, cls):
     37     p, h, r = info
     38     if auths.has_key(p):
     39-        print >>sys.stderr, 'Ignoring duplicate authentication option for ' \
     40+        print >> sys.stderr, 'Ignoring duplicate authentication option for ' \
     41                             'project: %s' % p
     42     else:
     43         auths[p] = cls(h, r)
     44@@ -130,6 +129,7 @@
     45         hostname = ''
     46         auths = {}
     47         env_parent_dir = None
     48+        base_path = None
     49 
     50         for o, a in OPTS:
     51             if o in ("-a", "--auth"):
     52@@ -159,8 +159,8 @@
     53                 wsgi_app = AuthenticationMiddleware(wsgi_app, auths, project_name)
     54             else:
     55                 wsgi_app = AuthenticationMiddleware(wsgi_app, auths)
     56-        base_path = base_path.strip('/').strip('\\')
     57         if base_path:
     58+            base_path = base_path.strip('\\')
     59             wsgi_app = BasePathMiddleware(wsgi_app, base_path)
     60 
     61         sys.stdout = open(os.path.join(LOG_DIR, 'stdout.log'),'a')
     62
    563}}}