devtools/livetest.py
branchtls-sprint
changeset 1138 22f634977c95
parent 0 b97547f5f1fa
child 1802 d628defebc17
equal deleted inserted replaced
1135:00eb43688a57 1138:22f634977c95
    34 
    34 
    35     def locateChild(self, request, segments):
    35     def locateChild(self, request, segments):
    36         """Indicate which resource to use to process down the URL's path"""
    36         """Indicate which resource to use to process down the URL's path"""
    37         if len(segments) and segments[0] == 'data':
    37         if len(segments) and segments[0] == 'data':
    38             # Anything in data/ is treated as static files
    38             # Anything in data/ is treated as static files
    39             dirlist = [self.data_dir, join(dirname(cubicweb.web.__file__), 'data')]
    39             datadir = self.config.locate_resource(segments[1])
    40             for alternative in dirlist:
    40             if datadir:
    41                 filepath = join(alternative, *segments[1:]) 
    41                 return static.File(str(datadir), segments[1:])
    42                 if exists(filepath):
       
    43                     self.info('publish static file: %s', '/'.join(segments))
       
    44                     return static.File(filepath), ()
       
    45         # Otherwise we use this single resource
    42         # Otherwise we use this single resource
    46         return self, ()
    43         return self, ()
    47     
    44     
    48     
    45     
    49     
    46