home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2010 November / maximum-cd-2010-11.iso / DiscContents / calibre-0.7.13.msi / file_1485 (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2010-08-06  |  2.2 KB  |  100 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. import cgi
  5. import cherrypy
  6.  
  7. class FieldStorage(cgi.FieldStorage):
  8.     
  9.     def __init__(self, *args, **kwds):
  10.         
  11.         try:
  12.             cgi.FieldStorage.__init__(self, *args, **kwds)
  13.         except ValueError:
  14.             ex = None
  15.             if str(ex) == 'Maximum content length exceeded':
  16.                 raise cherrypy.HTTPError(status = 413)
  17.             str(ex) == 'Maximum content length exceeded'
  18.             raise ex
  19.  
  20.  
  21.     
  22.     def read_lines_to_eof(self):
  23.         while None:
  24.             line = self.fp.readline(65536)
  25.             if not line:
  26.                 self.done = -1
  27.                 break
  28.             
  29.             continue
  30.             return None
  31.  
  32.     
  33.     def read_lines_to_outerboundary(self):
  34.         next = '--' + self.outerboundary
  35.         last = next + '--'
  36.         delim = ''
  37.         last_line_lfend = True
  38.         while None:
  39.             line = self.fp.readline(65536)
  40.             if not line:
  41.                 self.done = -1
  42.                 break
  43.             
  44.             if line[:2] == '--' and last_line_lfend:
  45.                 strippedline = line.strip()
  46.                 if strippedline == next:
  47.                     break
  48.                 
  49.                 if strippedline == last:
  50.                     self.done = 1
  51.                     break
  52.                 
  53.             
  54.             odelim = delim
  55.             if line[-2:] == '\r\n':
  56.                 delim = '\r\n'
  57.                 line = line[:-2]
  58.                 last_line_lfend = True
  59.             elif line[-1] == '\n':
  60.                 delim = '\n'
  61.                 line = line[:-1]
  62.                 last_line_lfend = True
  63.             else:
  64.                 delim = ''
  65.                 last_line_lfend = False
  66.             continue
  67.             return None
  68.  
  69.     
  70.     def skip_lines(self):
  71.         if not (self.outerboundary) or self.done:
  72.             return None
  73.         next = '--' + self.outerboundary
  74.         last = next + '--'
  75.         last_line_lfend = True
  76.         while None:
  77.             line = self.fp.readline(65536)
  78.             if not line:
  79.                 self.done = -1
  80.                 break
  81.             
  82.             if line[:2] == '--' and last_line_lfend:
  83.                 strippedline = line.strip()
  84.                 if strippedline == next:
  85.                     break
  86.                 
  87.                 if strippedline == last:
  88.                     self.done = 1
  89.                     break
  90.                 
  91.             
  92.             if line.endswith('\n'):
  93.                 last_line_lfend = True
  94.                 continue
  95.             last_line_lfend = False
  96.             continue
  97.             return None
  98.  
  99.  
  100.