Back to index

plone3  3.1.7
Public Member Functions | Public Attributes | Static Public Attributes | Static Private Attributes
CMFEditions.StandardModifiers.SkipVersioningOfLargeFilesAndImages Class Reference
Inheritance diagram for CMFEditions.StandardModifiers.SkipVersioningOfLargeFilesAndImages:
Inheritance graph
[legend]
Collaboration diagram for CMFEditions.StandardModifiers.SkipVersioningOfLargeFilesAndImages:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def getOnCloneModifiers
def beforeSaveModifier
def afterRetrieveModifier
def edit
def getFieldNames
def getModifier

Public Attributes

 field_names
 max_size
 id
 title
 meta_type

Static Public Attributes

tuple field_names = ('file', 'image')
int max_size = 26214400
tuple modifierEditForm

Static Private Attributes

tuple __implements__

Detailed Description

Replaces any excessively large file and images stored as
annotations or attributes on the object with a marker.  On
retrieve, the marker will be replaced with the current value..

Definition at line 799 of file StandardModifiers.py.


Member Function Documentation

def CMFEditions.StandardModifiers.SkipVersioningOfLargeFilesAndImages.afterRetrieveModifier (   self,
  obj,
  repo_clone,
  preserve = () 
)
If we find any LargeFilePlaceHolders, replace them with the
values from the current working copy.  If the values are missing
from the working copy, remove them from the retrieved object.

Definition at line 831 of file StandardModifiers.py.

00831 
00832     def afterRetrieveModifier(self, obj, repo_clone, preserve=()):
00833         """If we find any LargeFilePlaceHolders, replace them with the
00834         values from the current working copy.  If the values are missing
00835         from the working copy, remove them from the retrieved object."""
00836         # Search for fields stored via AnnotationStorage
00837         annotations = getattr(obj, '__annotations__', None)
00838         orig_annotations = getattr(repo_clone, '__annotations__', None)
00839         for storage, name, orig_val in self._getFieldValues(repo_clone):
00840             if isinstance(orig_val, LargeFilePlaceHolder):
00841                 if storage == 'annotation':
00842                     val = _empty_marker
00843                     if annotations is not None:
00844                         val = annotations.get(name, _empty_marker)
00845                     if val is not _empty_marker:
00846                         orig_annotations[name] = val
00847                     else:
00848                         # remove the annotation if not present on the
00849                         # working copy, or if annotations are missing
00850                         # entirely
00851                         del orig_annotations[name]
00852                 else: # attribute storage
00853                     val = getattr(obj, name, _empty_marker)
00854                     if val is not _empty_marker:
00855                         setattr(repo_clone, name, val)
00856                     else:
00857                         delattr(repo_clone, name)
00858         return [], [], {}
00859 
00860 InitializeClass(SkipVersioningOfLargeFilesAndImages)
00861 
00862 
00863 #----------------------------------------------------------------------
00864 # Standard modifier configuration
00865 #----------------------------------------------------------------------

Here is the call graph for this function:

Does nothing, the pickler does the work

Definition at line 827 of file StandardModifiers.py.

00827 
00828     def beforeSaveModifier(self, obj, clone):
00829         """Does nothing, the pickler does the work"""
00830         return {}, [], []

def CMFEditions.StandardModifiers.AbortVersioningOfLargeFilesAndImages.edit (   self,
  enabled = None,
  condition = None,
  title = '',
  field_names = None,
  max_size = None,
  REQUEST = None 
) [inherited]
See IConditionalTalesModifier.

Definition at line 734 of file StandardModifiers.py.

00734 
00735              max_size=None, REQUEST=None):
00736         """See IConditionalTalesModifier.
00737         """
00738         if max_size is not None:
00739             self.max_size = int(max_size)
00740         if field_names is not None:
00741             field_names = tuple(s.strip() for s in field_names.split('\n') if s)
00742             if field_names != self.field_names:
00743                 self.field_names = field_names
00744         return ConditionalTalesModifier.edit(self, enabled, condition, title)

Here is the caller graph for this function:

For the edit form

Definition at line 745 of file StandardModifiers.py.

00745 
00746     def getFieldNames(self):
00747         """For the edit form"""
00748         return '\n'.join(self.field_names)

We are the modifier, not some silly wrapper. 

Definition at line 749 of file StandardModifiers.py.

00749 
00750     def getModifier(self):
00751         """We are the modifier, not some silly wrapper. """
00752         return self

Removes large file objects and returns them as references

Reimplemented from CMFEditions.StandardModifiers.AbortVersioningOfLargeFilesAndImages.

Definition at line 807 of file StandardModifiers.py.

00807 
00808     def getOnCloneModifiers(self, obj):
00809         """Removes large file objects and returns them as references
00810         """
00811         refs = {}
00812         ref_list = []
00813         for storage, name, val in self._getFieldValues(obj):
00814             ref_list.append(val)
00815             refs[id(val)] = True
00816 
00817         if not refs:
00818             return None # don't do anything
00819 
00820         def persistent_id(obj):
00821             return refs.get(id(obj), None)
00822 
00823         def persistent_load(ignored):
00824             return LargeFilePlaceHolder()
00825 
00826         return persistent_id, persistent_load, [], []

Here is the call graph for this function:


Member Data Documentation

Initial value:
(IConditionalTalesModifier, ICloneModifier,
                      ISaveRetrieveModifier)

Reimplemented from CMFEditions.StandardModifiers.AbortVersioningOfLargeFilesAndImages.

Definition at line 804 of file StandardModifiers.py.

Definition at line 715 of file StandardModifiers.py.

Definition at line 742 of file StandardModifiers.py.

Definition at line 728 of file StandardModifiers.py.

Definition at line 716 of file StandardModifiers.py.

Definition at line 738 of file StandardModifiers.py.

Definition at line 730 of file StandardModifiers.py.

Initial value:
PageTemplateFile('www/fieldModifierEditForm.pt',
                                        globals(),
                                        __name__='modifierEditForm')

Definition at line 720 of file StandardModifiers.py.

Definition at line 729 of file StandardModifiers.py.


The documentation for this class was generated from the following file: