Changeset 140


Ignore:
Timestamp:
Oct 8, 2007, 3:39:40 AM (17 years ago)
Author:
ecprice
Message:

Python 2.4 support

Location:
trunk/web/templates
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/web/templates/main.py

    r139 r140  
    1414import datetime
    1515
    16 print 'Content-Type: text/html\n'
    1716sys.stderr = sys.stdout
    1817sys.path.append('/home/ecprice/.local/lib/python2.5/site-packages')
     
    6564    if name[0] in '-_' or len(name) > 22:
    6665        return False
    67     return all(x in charset for x in name)
     66    for x in name:
     67        if x not in charset:
     68            return False
     69    return True
    6870
    6971def kinit(username = 'tabbott/extra', keytab = '/etc/tabbott.keytab'):
     
    542544        email = 'moo@cow.com'
    543545    u = User()
     546    if 'SSL_CLIENT_S_DN_Email' in os.environ:
     547        username = os.environ[ 'SSL_CLIENT_S_DN_Email'].split("@")[0]
     548        u.username = username
     549        u.email = os.environ[ 'SSL_CLIENT_S_DN_Email']
     550    else:
     551        u.username = 'nobody'
     552        u.email = None
     553    connect('postgres://sipb-xen@sipb-xen-dev/sipb_xen')
    544554    operation = os.environ.get('PATH_INFO', '')
     555    #print 'Content-Type: text/plain\n'
     556    #print operation
    545557    if not operation:
    546         pass
    547         #XXX do redirect
     558        print "Status: 301 Moved Permanently"
     559        print 'Location: ' + os.environ['SCRIPT_NAME']+'/\n'
     560        sys.exit(0)
     561    print 'Content-Type: text/html\n'
    548562
    549563    if operation.startswith('/'):
Note: See TracChangeset for help on using the changeset viewer.