Exemplo n.º 1
0
	def _process(self, content):
		"""
		@return: the processed CSS file as a C{str} and a C{list} of
			L{ReferencedFile}s whose contents affect the processed CSS
			file.
		"""
		fixedContent, references = fixUrls(self._fileCache, self._request, content)
		out = '/* CSSResource processed %s */\n%s' % (
			md5hexdigest(content), fixedContent)
		return out, references
Exemplo n.º 2
0
    def _process(self, content):
        """
		@return: the processed CSS file as a C{str} and a C{list} of
			L{ReferencedFile}s whose contents affect the processed CSS
			file.
		"""
        fixedContent, references = fixUrls(self._fileCache, self._request,
                                           content)
        out = '/* CSSResource processed %s */\n%s' % (md5hexdigest(content),
                                                      fixedContent)
        return out, references
Exemplo n.º 3
0
	def _getProcessedCSS(self):
		"""
		@return: a C{str}, the processed CSS (new or from cache).

		This also updates the cache entry if necessary.
		"""
		content, maybeNew = self._fileCache.getContent(self._path)
		if not maybeNew and not self._haveUpdatedReferences():
			try:
				entry = self._cssCache[self._path]
				return entry.processed
			except KeyError:
				pass

		processed, references = self._process(content)
		entry = _CSSCacheEntry(processed, md5hexdigest(processed), references)
		self._cssCache[self._path] = entry

		return processed
Exemplo n.º 4
0
    def _getProcessedCSS(self):
        """
		@return: a C{str}, the processed CSS (new or from cache).

		This also updates the cache entry if necessary.
		"""
        content, maybeNew = self._fileCache.getContent(self._path)
        if not maybeNew and not self._haveUpdatedReferences():
            try:
                entry = self._cssCache[self._path]
                return entry.processed
            except KeyError:
                pass

        processed, references = self._process(content)
        entry = _CSSCacheEntry(processed, md5hexdigest(processed), references)
        self._cssCache[self._path] = entry

        return processed