Back to index

plone3  3.1.7
Public Member Functions | Public Attributes | Static Public Attributes
plone.app.linkintegrity.info.LinkIntegrityInfo Class Reference
Collaboration diagram for plone.app.linkintegrity.info.LinkIntegrityInfo:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def integrityCheckingEnabled
def getIntegrityInfo
def setIntegrityInfo
def getIntegrityBreaches
def setIntegrityBreaches
def getDeletedItems
def addDeletedItem
def getEnvMarker
def confirmedItems
def isConfirmedItem
def encodeConfirmedItems
def moreEventsToExpect

Public Attributes

 context

Static Public Attributes

string attribute = 'link_integrity_info'

Detailed Description

adapter for browserrequests to temporarily store information
    related to link integrity in the request object 

Definition at line 10 of file info.py.


Constructor & Destructor Documentation

Definition at line 17 of file info.py.

00017 
00018     def __init__(self, context):
00019         self.context = context      # the context is the request

Here is the caller graph for this function:


Member Function Documentation

remember an item deleted during the request 

Definition at line 63 of file info.py.

00063 
00064     def addDeletedItem(self, item):
00065         """ remember an item deleted during the request """
00066         info = self.getIntegrityInfo()
00067         info.setdefault('deleted', set()).add(item)
00068         self.setIntegrityInfo(info)     # unnecessary, but sticking to the api

Here is the call graph for this function:

return internal list of confirmed items 

Definition at line 74 of file info.py.

00074 
00075     def confirmedItems(self):
00076         """ return internal list of confirmed items """
00077         confirmed = self.context.environ.get(self.marker, [])
00078         if confirmed == 'all':
00079             confirmed = ['all']
00080         elif confirmed:
00081             confirmed = decodeInts(confirmed)
00082         return confirmed

Here is the call graph for this function:

Here is the caller graph for this function:

return the list of previously confirmed (for removeal) items,
    optionally adding the given items, encoded for usage in a form 

Definition at line 88 of file info.py.

00088 
00089     def encodeConfirmedItems(self, additions):
00090         """ return the list of previously confirmed (for removeal) items,
00091             optionally adding the given items, encoded for usage in a form """
00092         confirmed = self.confirmedItems()
00093         for obj in additions:
00094             confirmed.append(id(aq_base(obj)))
00095         return encodeInts(confirmed)

Here is the call graph for this function:

return information about all items deleted during the request 

Definition at line 59 of file info.py.

00059 
00060     def getDeletedItems(self):
00061         """ return information about all items deleted during the request """
00062         return self.getIntegrityInfo().get('deleted', set())

Here is the call graph for this function:

Here is the caller graph for this function:

return the marker string used to pass the already confirmed
    items across the retry exception 

Definition at line 69 of file info.py.

00069 
00070     def getEnvMarker(self):
00071         """ return the marker string used to pass the already confirmed
00072             items across the retry exception """
00073         return self.marker

return stored information regarding link integrity breaches
    after removing circular references, confirmed items etc 

Definition at line 38 of file info.py.

00038 
00039     def getIntegrityBreaches(self):
00040         """ return stored information regarding link integrity breaches
00041             after removing circular references, confirmed items etc """
00042         deleted = self.getDeletedItems()
00043         breaches = dict(self.getIntegrityInfo().get('breaches', {}))
00044         targets = breaches.keys()
00045         for target, sources in breaches.items():    # first remove deleted sources
00046             for source in list(sources):
00047                 if source in targets or source in deleted:
00048                     sources.remove(source)
00049         for target, sources in breaches.items():    # then remove "empty" targets
00050             if not sources or self.isConfirmedItem(target):
00051                 del breaches[target]
00052         return breaches

Here is the call graph for this function:

return stored information regarding link integrity 

Definition at line 30 of file info.py.

00030 
00031     def getIntegrityInfo(self):
00032         """ return stored information regarding link integrity """
00033         return getattr(self.context, self.attribute, {})

Here is the caller graph for this function:

determine if link integrity checking for the site is enabled 

Definition at line 20 of file info.py.

00020 
00021     def integrityCheckingEnabled(self):
00022         """ determine if link integrity checking for the site is enabled """
00023         ptool = queryUtility(IPropertiesTool)
00024         enabled = False
00025         if ptool is not None:
00026             props = getattr(ptool, 'site_properties', None)
00027             if props is not None:
00028                 enabled = props.getProperty('enable_link_integrity_checks', False)
00029         return enabled

indicate if the removal of the given object was confirmed 

Definition at line 83 of file info.py.

00083 
00084     def isConfirmedItem(self, obj):
00085         """ indicate if the removal of the given object was confirmed """
00086         confirmed = self.confirmedItems()
00087         return id(aq_base(obj)) in confirmed or 'all' in confirmed

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 96 of file info.py.

00096 
00097     def moreEventsToExpect(self):
00098         attr = 'link_integrity_events_counter'
00099         counter = getattr(self.context, attr, 0) + 1    # nr of events so far
00100         setattr(self.context, attr, counter)            # save for next time
00101         expected = self.context.get('link_integrity_events_to_expect', 0)
00102         return counter < expected
00103 
store information regarding link integrity breaches 

Definition at line 53 of file info.py.

00053 
00054     def setIntegrityBreaches(self, breaches):
00055         """ store information regarding link integrity breaches """
00056         info = self.getIntegrityInfo()
00057         info['breaches'] = breaches
00058         self.setIntegrityInfo(info)     # unnecessary, but sticking to the api

Here is the call graph for this function:

store information regarding link integrity 

Definition at line 34 of file info.py.

00034 
00035     def setIntegrityInfo(self, info):
00036         """ store information regarding link integrity """
00037         setattr(self.context, self.attribute, info)

Here is the caller graph for this function:


Member Data Documentation

string plone.app.linkintegrity.info.LinkIntegrityInfo.attribute = 'link_integrity_info' [static]

Definition at line 15 of file info.py.

Definition at line 18 of file info.py.


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