Commit 5374351a authored by Mario Jorge Amaral's avatar Mario Jorge Amaral

Remove cache.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk/utils@45557 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent af24fbe8
...@@ -181,14 +181,11 @@ class OOGranulator(object): ...@@ -181,14 +181,11 @@ class OOGranulator(object):
#this function will be use to pick up the attibutes name and style-name #this function will be use to pick up the attibutes name and style-name
def _getFrameImageList(self): def _getFrameImageList(self):
RELEVANT_IMAGE_CACHE = getattr(self, "RELEVANT_PARAGRAPH_CACHE", None) relevant_image_list = self.document.parsed_content.xpath(
if RELEVANT_IMAGE_CACHE is None:
relevant_image_list = self.document.parsed_content.xpath(
IMAGE_DRAW_NAME_AND_STYLENAME_XPATH_QUERY, IMAGE_DRAW_NAME_AND_STYLENAME_XPATH_QUERY,
namespaces=self.document.parsed_content.nsmap) namespaces=self.document.parsed_content.nsmap)
setattr(self, "RELEVANT_IMAGE_CACHE", relevant_image_list)
return self.RELEVANT_IMAGE_CACHE return relevant_image_list
def getImageItemList(self): def getImageItemList(self):
"""Return a list of tuples with the id and title of image files""" """Return a list of tuples with the id and title of image files"""
...@@ -223,16 +220,11 @@ class OOGranulator(object): ...@@ -223,16 +220,11 @@ class OOGranulator(object):
return self.document.getFile(path) return self.document.getFile(path)
def _getRelevantParagraphList(self): def _getRelevantParagraphList(self):
""" This should use memcache or another cache infrastructure. relevant_paragraph_list = self.document.parsed_content.xpath(
"""
RELEVANT_PARAGRAPH_CACHE = getattr(self, "RELEVANT_PARAGRAPH_CACHE", None)
if RELEVANT_PARAGRAPH_CACHE is None:
relevant_paragraph_list = self.document.parsed_content.xpath(
RELEVANT_PARAGRAPH_XPATH_QUERY, RELEVANT_PARAGRAPH_XPATH_QUERY,
namespaces=self.document.parsed_content.nsmap) namespaces=self.document.parsed_content.nsmap)
setattr(self, "RELEVANT_PARAGRAPH_CACHE", relevant_paragraph_list)
return self.RELEVANT_PARAGRAPH_CACHE return relevant_paragraph_list
def getParagraphItemList(self): def getParagraphItemList(self):
"""Returns the list of paragraphs in the form of (id, class) where class """Returns the list of paragraphs in the form of (id, class) where class
...@@ -265,16 +257,10 @@ class OOGranulator(object): ...@@ -265,16 +257,10 @@ class OOGranulator(object):
return (text, p_class) return (text, p_class)
def _getChapterList(self): def _getChapterList(self):
""" This should use memcache or another cache infrastructure. chapter_list = self.document.parsed_content.xpath(
"""
CHAPTER_CACHE = getattr(self, "CHAPTER_CACHE", None)
if CHAPTER_CACHE is None:
chapter_list = self.document.parsed_content.xpath(
CHAPTER_XPATH_QUERY, CHAPTER_XPATH_QUERY,
namespaces=self.document.parsed_content.nsmap) namespaces=self.document.parsed_content.nsmap)
return chapter_list
setattr(self, "CHAPTER_CACHE", chapter_list)
return self.CHAPTER_CACHE
def getChapterItemList(self): def getChapterItemList(self):
"""Returns the list of chapters in the form of (id, level).""" """Returns the list of chapters in the form of (id, level)."""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment