Permalink
Browse files

wip

  • Loading branch information...
1 parent c6a36d0 commit 05d797f21d494b30a6eae8cfb1bb7ba1767488ae @pjstevns committed Mar 29, 2012
@@ -8,13 +8,13 @@
fields. It has methods to register special/custom vocabulary
types
</property>
- <property name="content_icon">folder_icon.gif</property>
+ <property name="icon_expr">string:${portal_url}/folder_icon.gif</property>
<property name="content_meta_type">VocabularyLibrary</property>
<property name="product">ATVocabularyManager</property>
<property name="factory">addVocabularyLibrary</property>
<property name="immediate_view">vocabularytool_view</property>
<property name="global_allow">False</property>
- <property name="filter_content_types">False</property>
+ <property name="filter_content_types">True</property>
<property name="allowed_content_types">
<element value="AliasVocabulary"/>
<element value="SimpleVocabulary"/>
@@ -114,23 +114,6 @@ def _makeCacheKeywords(self, vocab):
#Methods
- def allowedContentTypesForContainer(self, containername):
- """ return all allowed fti for a containertype """
- tt = getToolByName(self, 'portal_types')
-
- if not containername in _vocabterm_types.keys():
- return []
-
- allowed = [tt[tn] for tn in [klass.meta_type \
- for klass in _vocabterm_types[containername]]]
-
- return allowed
-
- def allowedMetaTypesForContainer(self, containername):
- """ return all allowed meta_types's for a containertype """
- allowed = self.allowedContentTypesForContainer(containername)
- return [fti.content_meta_type for fti in allowed]
-
def getVocabularyByName(self, vocabname):
""" returns a vocabulary or None if no vocab with this name found """
if shasattr(self, vocabname):
@@ -96,38 +96,6 @@ class SimpleVocabulary(OrderedBaseFolder):
),
))
- # Methods for fti modification - better make a mixin class from it?
-
- def allowedContentTypes(self):
- tt = getToolByName(self, 'portal_types')
- cv=self.contentValues()
- if len(cv):
- tt = getToolByName(self, 'portal_types')
- allowed=[tt[cv[0].meta_type], ]
- else:
- vt = getToolByName(self, VOCABTOOL_NAME)
- allowed= vt.allowedContentTypesForContainer(self.meta_type)
- return allowed
-
- def updateRegisteredTypes(self):
- """ updates own fti based on registered containers """
- tt = getToolByName(self, 'portal_types')
- ti = tt[self.meta_type]
-
- vt = getToolByName(self, VOCABTOOL_NAME)
- allowedmetatypes = vt.allowedMetaTypesForContainer(self.meta_type)
- ti.allowed_content_types=tuple(allowedmetatypes)
-
- security.declareProtected(AddPortalContent, 'invokeFactory')
- def invokeFactory(self, type_name, id, RESPONSE=None, *args, **kw):
- """ Invokes the portal_types tool """
- try:
- return OrderedBaseFolder.invokeFactory(self, type_name, id, RESPONSE, *args, **kw)
- except:
- # at this point the whole isnt 100% clean and needs slight refactoring
- self.updateRegisteredTypes()
- return OrderedBaseFolder.invokeFactory(self, type_name, id, RESPONSE, *args, **kw)
-
def isLinguaPloneInstalled(self):
""" checks if LinguaPlone is installed """
return ILinguaPloneProductLayer in registered_layers() \

0 comments on commit 05d797f

Please sign in to comment.