Several bugfixes while handling abstract classes (appy.gen) and added a first code chunk used while installing a gen-application for Plone 3.
This commit is contained in:
		
							parent
							
								
									ca7b688c00
								
							
						
					
					
						commit
						46cda3f755
					
				
					 7 changed files with 49 additions and 3 deletions
				
			
		|  | @ -237,6 +237,7 @@ class PloneInstaller: | |||
|         # Creates the new-way templates for Pod fields if they do not exist. | ||||
|         for contentType, attrNames in self.attributes.iteritems(): | ||||
|             appyClass = self.tool.getAppyClass(contentType) | ||||
|             if not appyClass: continue # May be an abstract class | ||||
|             for attrName in attrNames: | ||||
|                 appyType = getattr(appyClass, attrName) | ||||
|                 if appyType.type == 'Pod': | ||||
|  |  | |||
|  | @ -261,7 +261,7 @@ class FlavourMixin(AbstractMixin): | |||
|            being effectively used in the search screen.''' | ||||
|         res = [] | ||||
|         appyClass = self.getAppyClass(contentType) | ||||
|         for attrName in getattr(self, 'searchFieldsFor%s' % contentType): | ||||
|         for attrName in getattr(self, 'searchFieldsFor%s' % contentType, ()): | ||||
|             attr = getattr(appyClass, attrName) | ||||
|             dAttr = self._appy_getTypeAsDict(attrName, attr, appyClass) | ||||
|             res.append((attrName, dAttr)) | ||||
|  |  | |||
|  | @ -333,13 +333,14 @@ class ToolMixin(AbstractMixin): | |||
|         '''Gets the Appy Python class that is related to p_contentType.''' | ||||
|         # Retrieve first the Archetypes class corresponding to p_ContentType | ||||
|         portalType = self.portal_types.get(contentType) | ||||
|         if not portalType: return None | ||||
|         atClassName = portalType.getProperty('content_meta_type') | ||||
|         appName = self.getProductConfig().PROJECTNAME | ||||
|         exec 'from Products.%s.%s import %s as atClass' % \ | ||||
|             (appName, atClassName, atClassName) | ||||
|         # Get then the Appy Python class | ||||
|         return atClass.wrapperClass.__bases__[-1] | ||||
|          | ||||
| 
 | ||||
|     def getCreateMeans(self, contentTypeOrAppyClass): | ||||
|         '''Gets the different ways objects of p_contentTypeOrAppyClass (which | ||||
|            can be a Plone content type or a Appy class) can be created | ||||
|  |  | |||
|  | @ -261,7 +261,10 @@ class AbstractMixin: | |||
|                         return t('%s_%s_list_%s' % (self.meta_type, name, v)) | ||||
|             if not isinstance(v, basestring): | ||||
|                 # Archetypes "Description" fields may hold a BaseUnit instance. | ||||
|                 v = unicode(v) | ||||
|                 try: | ||||
|                     v = unicode(v) | ||||
|                 except UnicodeDecodeError: | ||||
|                     v = str(v) | ||||
|             return v | ||||
|         elif vType == 'Boolean': | ||||
|             if v: return self.translate('yes', domain='plone') | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Gaetan Delannay
						Gaetan Delannay