home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2009 May / maximum-cd-2009-05.iso / DiscContents / XBMC_for_Windows-8.10.exe / system / python / spyce / run_spyceModpy.py < prev    next >
Encoding:
Python Source  |  2008-11-03  |  1.5 KB  |  50 lines

  1. #!/usr/bin/env python
  2.  
  3. ##################################################
  4. # SPYCE - Python-based HTML Scripting
  5. # Copyright (c) 2002 Rimon Barr.
  6. #
  7. # Refer to spyce.py
  8. # CVS: $Id: run_spyceModpy.py 5659 2006-04-27 16:15:15Z jwnmulder $
  9. ##################################################
  10.  
  11. __doc__ = '''Version checking spyceModpy.py wrapper.'''
  12.  
  13. try:
  14.   import _apache
  15.   from mod_python import apache
  16. except: pass
  17.  
  18. def spyceMain(apacheRequest):
  19.   return spyceMainVersion(apacheRequest)
  20.  
  21. def spyceMainVersion(apacheRequest):
  22.   "Version checking Apache entry point."
  23.   import verchk
  24.   if not verchk.checkversion(verchk.REQUIRED):
  25.     import sys
  26.     apacheRequest.content_type = 'text/plain'
  27.     apacheRequest.send_http_header()
  28.     apacheRequest.write('Spyce can not run on this version of Python.\n')
  29.     apacheRequest.write('Python version '+sys.version[:3]+' detected.\n')
  30.     apacheRequest.write('Python version '+verchk.REQUIRED+' or greater required.\n')
  31.     try:
  32.       return apache.OK
  33.     except: pass
  34.   else:
  35.     global spyceMain
  36.     import spyceModpy
  37.     spyceMain = spyceModpy.spyceMain
  38.     return spyceModpy.spyceMain(apacheRequest)
  39.  
  40. if __name__ == '__main__':
  41.   print "********** ERROR: **********"
  42.   print "This program can not be run from the command-line."
  43.   print "Use run_spyceCmd.py, or run via Apache."
  44.   print "For configuring Apache, have a look at 'spyceApache.conf'."
  45.   print
  46.   print "Also, please read the documentation at:"
  47.   print "  http://spyce.sourceforge.net"
  48.   print "for other options."
  49.  
  50.