Commit 42b9e4ae authored by Jean-Paul Smets's avatar Jean-Paul Smets

The changes enclosed fixe various issues in the previous implementation. It...

The changes enclosed fixe various issues in the previous implementation. It breaks webdav though (wait for next commit to get it back).

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@13439 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 14cf3c06
...@@ -179,6 +179,21 @@ class Document(XMLObject): ...@@ -179,6 +179,21 @@ class Document(XMLObject):
searchable text, explicit relations, implicit relations, searchable text, explicit relations, implicit relations,
metadata, versions, languages, etc. metadata, versions, languages, etc.
Documents may either store their content directly or
cache content which is retrieved from a specified URL.
The second case if often referred as "External Document".
Standalone "External Documents" may be created by specifying
a URL to the contribution tool which is in charge of initiating
the download process and selecting the appropriate document type.
Groups of "External Documents" may also be generated from
so-called "External Source" (refer to ExternalSource class
for more information).
External Documents may be downloaded once or at
regular interval. The later can be useful to update the content
of an external source. Previous versions may be stored
in place or kept in a separate file.
There are currently two types of Document subclasses: There are currently two types of Document subclasses:
* File for binary file based documents. File * File for binary file based documents. File
...@@ -188,7 +203,10 @@ class Document(XMLObject): ...@@ -188,7 +203,10 @@ class Document(XMLObject):
* TextDocument for text based documents. TextDocument * TextDocument for text based documents. TextDocument
has subclasses such as Wiki to implement specific has subclasses such as Wiki to implement specific
methods. methods. TextDocument itself has a subclass
(XSLTDocument) which provides XSLT based analysis
and transformation of XML content based on XSLT
templates.
Document classes which implement conversion should use Document classes which implement conversion should use
the ConversionCacheMixin class so that converted values are the ConversionCacheMixin class so that converted values are
...@@ -372,6 +390,13 @@ class Document(XMLObject): ...@@ -372,6 +390,13 @@ class Document(XMLObject):
""" """
pass pass
security.declareProtected(Permissions.View, 'asText')
def asText(self):
"""
Converts the content of the document to a textual representation.
"""
return self.convert('text')
security.declareProtected(Permissions.View, 'getSearchableText') security.declareProtected(Permissions.View, 'getSearchableText')
def getSearchableText(self, md=None): def getSearchableText(self, md=None):
""" """
...@@ -787,7 +812,8 @@ class Document(XMLObject): ...@@ -787,7 +812,8 @@ class Document(XMLObject):
kw = {} kw = {}
for id in self.propertyIds(): for id in self.propertyIds():
# We should not consider file data # We should not consider file data
if id is not 'data' and self.hasProperty(id): if id not in ('data', 'categories_list', 'uid', 'id', 'text_content', ) \
and self.hasProperty(id):
kw[id] = self.getProperty(id) kw[id] = self.getProperty(id)
self._backup_input = kw # We could use volatile and pass kw in activate self._backup_input = kw # We could use volatile and pass kw in activate
# if we are garanteed that _backup_input does not # if we are garanteed that _backup_input does not
...@@ -843,6 +869,7 @@ class Document(XMLObject): ...@@ -843,6 +869,7 @@ class Document(XMLObject):
del(kw['portal_type']) del(kw['portal_type'])
except KeyError: except KeyError:
pass pass
self.edit(**kw) self.edit(**kw)
# Finish in second stage # Finish in second stage
......
This diff is collapsed.
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