Changeset 603


Ignore:
Timestamp:
Jun 13, 2008, 4:10:10 AM (16 years ago)
Author:
price
Message:

small code cleanups

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/sipb-xen-www/code/main.py

    r602 r603  
    117117
    118118DEFAULT_HEADERS = {'Content-Type': 'text/html'}
    119 
    120 def error(op, username, fields, err, emsg, traceback):
    121     """Print an error page when an exception occurs"""
    122     d = dict(op=op, user=username, fields=fields,
    123              errorMessage=str(err), stderr=emsg, traceback=traceback)
    124     details = templates.error_raw(searchList=[d])
    125     send_error_mail('xvm error on %s for %s: %s' % (op, username, err),
    126                     details)
    127     d['details'] = details
    128     return templates.error(searchList=[d])
    129119
    130120def invalidInput(op, username, fields, err, emsg):
     
    618608    p.wait()
    619609
     610def show_error(op, username, fields, err, emsg, traceback):
     611    """Print an error page when an exception occurs"""
     612    d = dict(op=op, user=username, fields=fields,
     613             errorMessage=str(err), stderr=emsg, traceback=traceback)
     614    details = templates.error_raw(searchList=[d])
     615    send_error_mail('xvm error on %s for %s: %s' % (op, username, err),
     616                    details)
     617    d['details'] = details
     618    return templates.error(searchList=[d])
     619
    620620def getUser(environ):
    621621    """Return the current user based on the SSL environment variables"""
     
    663663                new_headers, output = output
    664664                headers.update(new_headers)
    665             print 'MOO2'
    666665            e = revertStandardError()
    667666            if e:
     
    681680                    self.start('200 OK', [('Content-Type', 'text/html')])
    682681                    e = revertStandardError()
    683                     yield str(invalidInput(operation, self.username, fields, err, e))
     682                    yield str(invalidInput(operation, self.username, fields,
     683                                           err, e))
    684684                    return
    685685            import traceback
     
    687687                       [('Content-Type', 'text/html')])
    688688            e = revertStandardError()
    689             s = error(operation, self.username, fields,
     689            s = show_error(operation, self.username, fields,
    690690                           err, e, traceback.format_exc())
    691691            yield str(s)
Note: See TracChangeset for help on using the changeset viewer.