Back to index

plone3  3.1.7
Public Member Functions | Static Public Attributes | Static Private Attributes
ATContentTypes.criteria.relativepath.ATRelativePathCriterion Class Reference
Inheritance diagram for ATContentTypes.criteria.relativepath.ATRelativePathCriterion:
Inheritance graph
[legend]
Collaboration diagram for ATContentTypes.criteria.relativepath.ATRelativePathCriterion:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def getNavTypes
def getCriteriaItems

Static Public Attributes

tuple security = ClassSecurityInfo()
 schema = ATRelativePathCriterionSchema
string meta_type = 'ATRelativePathCriterion'
string archetype_name = 'Relative Path Criterion'
string shortDesc = 'Location in site relative to the current location'

Static Private Attributes

tuple __implements__ = ATBaseCriterion.__implements__+(IATTopicSearchCriterion, )

Detailed Description

A path criterion

Definition at line 66 of file relativepath.py.


Member Function Documentation

Definition at line 82 of file relativepath.py.

00082 
00083     def getCriteriaItems(self):
00084         result = []
00085         depth = (not self.Recurse() and 1) or -1
00086         relPath = self.getRelativePath()
00087         
00088         # sanitize a bit: you never know, with all those windoze users out there
00089         relPath = relPath.replace("\\","/") 
00090 
00091         # get the path to the portal object 
00092         portalPath = list(getToolByName(self, 'portal_url').getPortalObject().getPhysicalPath())
00093     
00094         if relPath[0]=='/':
00095             # someone didn't enter a relative path.
00096             # simply use that one, relative to the portal
00097             path = '/'.join(portalPath) + relPath
00098         elif relPath=='..' or relPath=='../':
00099             # do a shortcut
00100             path = '/'.join(self.aq_parent.aq_parent.getPhysicalPath())
00101         else:
00102             folders = relPath.split('/')
00103 
00104             # set the path to the collections path
00105             path = list(self.aq_parent.getPhysicalPath()) 
00106             
00107             # now construct an aboslute path based on the relative custom path
00108             # eat away from 'path' whenever we encounter a '..' in the relative path
00109             # apend all other elements other than ..
00110             for folder in folders:
00111                 if folder == '..':
00112                     # chop off one level from path
00113                     if path == portalPath:
00114                         # can't chop off more
00115                         # just return this path and leave the loop
00116                         break
00117                     else:
00118                         path = path[:-1]
00119                 elif folder == '.': 
00120                     # don't really need this but for being complete
00121                     # strictly speaking some user may use a . aswell
00122                     pass # do nothing
00123                 else:
00124                     path.append(folder)
00125             path = '/'.join(path)
00126 
00127         if path is not '':
00128             result.append((self.Field(), {'query': path, 'depth': depth}))
00129 
00130         return tuple(result)
00131 
00132 
00133 registerCriterion(ATRelativePathCriterion, PATH_INDICES)

Here is the call graph for this function:

Definition at line 76 of file relativepath.py.

00076 
00077     def getNavTypes(self):
00078         ptool = self.plone_utils
00079         nav_types = ptool.typesToList()
00080         return nav_types


Member Data Documentation

tuple ATContentTypes.criteria.relativepath.ATRelativePathCriterion.__implements__ = ATBaseCriterion.__implements__+(IATTopicSearchCriterion, ) [static, private]

Definition at line 69 of file relativepath.py.

Definition at line 73 of file relativepath.py.

Definition at line 72 of file relativepath.py.

Definition at line 71 of file relativepath.py.

Definition at line 70 of file relativepath.py.

string ATContentTypes.criteria.relativepath.ATRelativePathCriterion.shortDesc = 'Location in site relative to the current location' [static]

Definition at line 74 of file relativepath.py.


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