allow assignment to type concepts

git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@3629 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
helmutm 2009-11-15 11:37:23 +00:00
parent 68c5dbbc08
commit 13ec1efea7
4 changed files with 14 additions and 9 deletions

View file

@ -395,12 +395,15 @@ class BaseView(GenericView, I18NView):
def conceptTypesForSearch(self):
general = [('loops:concept:*', 'Any Concept'),]
return util.KeywordVocabulary(general
+ self.listTypesForSearch(('concept',), ('system', 'hidden',),))
+ self.listTypesForSearch(('concept',),
('hidden',),))
#('system', 'hidden',),))
def resourceTypesForSearch(self):
general = [('loops:resource:*', 'Any Resource'),]
return util.KeywordVocabulary(general
+ self.listTypesForSearch(('resource',), ('system', 'hidden'),))
+ self.listTypesForSearch(('resource',),
('system', 'hidden',),))
# options/settings
@ -423,7 +426,7 @@ class BaseView(GenericView, I18NView):
@Lazy
def useVersioning(self):
if 'useVersioning' in self.loopsRoot.options:
if self.globalOptions('useVersioning'):
return True
options = getattr(self.controller, 'options', None)
if options:

View file

@ -317,9 +317,11 @@ class CreateObjectForm(ObjectForm):
def maybeAssignedAsParent(self, obj):
if not IConcept.providedBy(obj):
return False
if obj.conceptType == self.loopsRoot.getConceptManager().getTypeConcept():
qualifiers = IType(obj).qualifiers
if (obj.conceptType == self.conceptManager.getTypeConcept()
and not 'assign' in qualifiers):
return False
if 'noassign' in IType(obj).qualifiers:
if 'noassign' in qualifiers:
return False
adap = adapted(obj)
if 'noassign' in getattr(adap, 'options', []):

View file

@ -72,7 +72,7 @@ zcml in real life:
>>> t = searchView.conceptTypesForSearch()
>>> len(t)
9
11
>>> t.getTermByToken('loops:concept:*').title
'Any Concept'

View file

@ -109,7 +109,7 @@ class Search(BaseView):
types = [types]
for type in types:
result = self.executeQuery(title=title or None, type=type,
exclude=('system',))
exclude=('hidden',))
for o in result:
if o.getLoopsRoot() == self.loopsRoot:
adObj = adapted(o, self.languageInfo)