Commit a0c883c7 authored by Bartek Górny's avatar Bartek Górny

implemented getWikiPredecessor/SuccessorValueList

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@9480 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 92a9c1ff
......@@ -208,7 +208,45 @@ class DMSFile(XMLObject,File):
for k,v in m.groupdict().items():
self.setProperty(k,v)
security.declareProtected(Permissions.View, 'getWikiSuccessorReferenceList')
def getWikiSuccessorReferenceList(self):
'''
find references in text_content, return matches
with this we can then find objects
'''
rx_search=re.compile(self.portal_preferences.getPreferredDmsReferenceRegexp())
try:
res=rx_search.finditer(self.getTextContent())
except AttributeError:
return []
res=[(r.group(),r.groupdict()) for r in res]
return res
security.declareProtected(Permissions.View, 'getWikiSuccessorValueList')
def getWikiSuccessorValueList(self):
'''
getWikiSuccessorValueList - the way to find objects is on
implementation level
'''
lst=[]
for ref in self.getWikiSuccessorReferenceList():
res=self.DMS_findDocument(ref)
if len(res)>0:
lst.append(res[0].getObject())
return lst
security.declareProtected(Permissions.View, 'getWikiPredecessorValueList')
def getWikiPredecessorValueList(self):
'''
it is mostly implementation level - depends on what parameters we use to identify
document, and on how a doc must reference me to be my predecessor (reference only,
or with a language, etc
'''
lst=self.DMS_findPredecessors()
lst=[r.getObject() for r in lst]
di=dict.fromkeys(lst) # make it unique
ref=self.getReference()
return [o for o in di.keys() if o.getReference()!=ref] # every object has its own reference in SearchableText
# BG copied from File in case
index_html = CMFFile.index_html
......
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