[albatross-users] [patch] to run from the command line

Gregory Bond gnb at itga.com.au
Tue Dec 17 14:15:18 EST 2002


It'd be nice to be able to run cgi albatross programs from the command line to
check things like "is this a compilable python file".  Much easier to check
these things from the command line that fossicking though web error logs!
Currently, if you try to run an albatross CGI from the command line, it errors
inside albatross trying to get REQUEST_URI from the environment.

This patch make the program at least run and produce useful output when run 
from the command line without a REQUEST_URI set.

*** /home/lightning/gnb/src/albatross-1.01/albatross/cgiapp.py  Tue Jul 30 17:33:49 2002
--- /usr/local/lib/python2.1/site-packages/albatross/cgiapp.py  Tue Dec 17 14:11:04 2002
***************
*** 26,32 ****
          return self.__fields.keys()
  
      def get_uri(self):
!         return os.environ['REQUEST_URI']
  
      def get_servername(self):
          return os.environ['SERVER_NAME']
--- 26,35 ----
          return self.__fields.keys()
  
      def get_uri(self):
!       try:
!             return os.environ['REQUEST_URI']
!       except KeyError:
!           return ''           # So we can run from the command line
  
      def get_servername(self):
          return os.environ['SERVER_NAME']





More information about the Albatross-users mailing list