web/propertysheet.py
changeset 10614 57dfde80df11
parent 10505 a9becf2cce8b
child 10615 6c497fe389d2
equal deleted inserted replaced
10613:8d9fe02387e3 10614:57dfde80df11
    94                        rdirectory, rid, cachefile)
    94                        rdirectory, rid, cachefile)
    95             rcachedir = osp.dirname(cachefile)
    95             rcachedir = osp.dirname(cachefile)
    96             if not osp.exists(rcachedir):
    96             if not osp.exists(rcachedir):
    97                 os.makedirs(rcachedir)
    97                 os.makedirs(rcachedir)
    98             sourcefile = osp.join(rdirectory, rid)
    98             sourcefile = osp.join(rdirectory, rid)
    99             content = file(sourcefile).read()
    99             content = open(sourcefile).read()
   100             # XXX replace % not followed by a paren by %% to avoid having to do
   100             # XXX replace % not followed by a paren by %% to avoid having to do
   101             # this in the source css file ?
   101             # this in the source css file ?
   102             try:
   102             try:
   103                 content = self.compile(content)
   103                 content = self.compile(content)
   104             except ValueError as ex:
   104             except ValueError as ex:
   105                 self.error("can't process %s/%s: %s", rdirectory, rid, ex)
   105                 self.error("can't process %s/%s: %s", rdirectory, rid, ex)
   106                 adirectory = rdirectory
   106                 adirectory = rdirectory
   107             else:
   107             else:
   108                 stream = file(cachefile, 'w')
   108                 stream = open(cachefile, 'w')
   109                 stream.write(content)
   109                 stream.write(content)
   110                 stream.close()
   110                 stream.close()
   111                 adirectory = self._cache_directory
   111                 adirectory = self._cache_directory
   112             self._cache[rid] = (adirectory, rdirectory, os.stat(sourcefile).st_mtime)
   112             self._cache[rid] = (adirectory, rdirectory, os.stat(sourcefile).st_mtime)
   113             return adirectory
   113             return adirectory