etwist/server.py
changeset 7275 bb3bb8104134
parent 7273 a949fc438029
child 7276 f9a68136eb87
equal deleted inserted replaced
7274:4653a2a5110b 7275:bb3bb8104134
    84         self.here = path
    84         self.here = path
    85         # backward-compatiblity: take care fckeditor may appears as
    85         # backward-compatiblity: take care fckeditor may appears as
    86         # root directory or as a data subdirectory. XXX (adim) : why
    86         # root directory or as a data subdirectory. XXX (adim) : why
    87         # that ?
    87         # that ?
    88         self.putChild('fckeditor', FCKEditorResource(self.config, ''))
    88         self.putChild('fckeditor', FCKEditorResource(self.config, ''))
       
    89         self._defineChildResources()
       
    90 
       
    91     def _defineChildResources(self):
       
    92         self.putChild(self.config.instance_md5_version(), self)
    89 
    93 
    90     def getChild(self, path, request):
    94     def getChild(self, path, request):
    91         if not path:
    95         if not path:
    92             return self.directoryListing()
    96             return self.directoryListing()
    93         childpath = join(self.here, path)
    97         childpath = join(self.here, path)
   131       http://localhost:8080/data-2.48.2/cubicweb.css
   135       http://localhost:8080/data-2.48.2/cubicweb.css
   132       http://localhost:8080/data-2.49.0/cubicweb.css
   136       http://localhost:8080/data-2.49.0/cubicweb.css
   133       etc.
   137       etc.
   134 
   138 
   135     """
   139     """
       
   140     def _defineChildResources(self):
       
   141         pass
       
   142 
   136     def render(self, request):
   143     def render(self, request):
   137         # XXX: Don't provide additional resource information to error responses
   144         # XXX: Don't provide additional resource information to error responses
   138         #
   145         #
   139         # the HTTP RFC recommands not going further than 1 year ahead
   146         # the HTTP RFC recommands not going further than 1 year ahead
   140         expires = date.today() + timedelta(days=6*30)
   147         expires = date.today() + timedelta(days=6*30)
   154         global MAX_POST_LENGTH
   161         global MAX_POST_LENGTH
   155         MAX_POST_LENGTH = config['max-post-length']
   162         MAX_POST_LENGTH = config['max-post-length']
   156         self.putChild('static', NoListingFile(config.static_directory))
   163         self.putChild('static', NoListingFile(config.static_directory))
   157         self.putChild('fckeditor', FCKEditorResource(self.config, ''))
   164         self.putChild('fckeditor', FCKEditorResource(self.config, ''))
   158         self.putChild('data', DataLookupDirectory(self.config, ''))
   165         self.putChild('data', DataLookupDirectory(self.config, ''))
   159         self.putChild('data%s' % config.instance_md5_version(),
       
   160                       LongTimeExpiringFile(self.config, ''))
       
   161 
   166 
   162     def init_publisher(self):
   167     def init_publisher(self):
   163         config = self.config
   168         config = self.config
   164         # when we have an in-memory repository, clean unused sessions every XX
   169         # when we have an in-memory repository, clean unused sessions every XX
   165         # seconds and properly shutdown the server
   170         # seconds and properly shutdown the server