fix check for predicate option

This commit is contained in:
Helmut Merz 2011-10-24 10:38:54 +02:00
parent 26ef8449b5
commit 0c601f373b
4 changed files with 23 additions and 4 deletions

View file

@ -311,7 +311,8 @@ class ConceptView(BaseView):
break
if skip:
continue
if IOptions(adapted(r.predicate))('hide_children'):
options = IOptions(adapted(r.predicate), None)
if options is not None and options('hide_children'):
continue
if fv.check(r.context):
yield r

15
external/README.txt vendored
View file

@ -54,6 +54,19 @@ Creating the corresponding objects
>>> adMyquery.options
[u'option1', u'option2']
Importing types
---------------
>>> input = ("type('mytype', u'My Type',"
... " typeInterface='loops.expert.concept.IQueryConcept')")
>>> reader = PyReader()
>>> elements = reader.read(input)
>>> loader = Loader(loopsRoot)
>>> loader.load(elements)
>>> adapted(concepts['mytype']).typeInterface
<InterfaceClass loops.expert.concept.IQueryConcept>
Working with resources
----------------------
@ -118,7 +131,7 @@ Extracting elements
>>> extractor = Extractor(loopsRoot, os.path.join(dataDirectory, 'export'))
>>> elements = list(extractor.extract())
>>> len(elements)
52
53
Writing object information to the external storage
--------------------------------------------------

3
external/element.py vendored
View file

@ -126,6 +126,9 @@ class TypeElement(ConceptElement):
loader.typeConcept, **kw)
instance = self.getInstance(omit=['title', 'typeInterface'])
formState = instance.applyTemplate(data=kw, ignoreValidation=True)
if ti:
# overwrite type interface, might have been ignored in addConcept
adapted(self.object).typeInterface = kw['typeInterface']
class ChildElement(Element):

View file

@ -74,7 +74,8 @@ class MemberRegistrationManager(object):
self.createPrincipal(pfName, userId, password, lastName, firstName)
groups = options(self.groups_key, ())
self.setGroupsForPrincipal(pfName, userId, groups=groups)
self.createPersonForPrincipal(self, pfName, userId, lastName, firstName=firstName, useExisting=useExisting, **kw)
self.createPersonForPrincipal(pfName, userId, lastName, firstName,
useExisting, **kw)
def createPrincipal(self, pfName, userId, password, lastName,
firstName=u'', groups=[], useExisting=False, **kw):
@ -109,7 +110,8 @@ class MemberRegistrationManager(object):
members.append(pFolder.prefix + userId)
group.principals = members
def createPersonForPrincipal(self, pfName, userId, lastName, firstName=u'', useExisting=False, **kw):
def createPersonForPrincipal(self, pfName, userId, lastName, firstName=u'',
useExisting=False, **kw):
concepts = self.context.getConceptManager()
personType = adapted(concepts[self.person_typeName])
pFolder = getPrincipalFolder(self.context, pfName)