Added a CSS parser; corrected bug that prevents Appy to create a root folder in a Plone site; allowed methods from an appy tool or flavour to be available in ZPTs.
This commit is contained in:
parent
741f760bb5
commit
f7143a2afd
5 changed files with 51 additions and 10 deletions
|
@ -149,8 +149,9 @@ class Generator(AbstractGenerator):
|
|||
destName = '%s.css.dtml' % self.applicationName)
|
||||
self.copyFile('do.py', self.repls, destFolder=self.skinsFolder,
|
||||
destName='%s_do.py' % self.applicationName)
|
||||
self.copyFile('colophon.pt', self.repls, destFolder=self.skinsFolder)
|
||||
self.copyFile('footer.pt', self.repls, destFolder=self.skinsFolder)
|
||||
if self.config.minimalistPlone:
|
||||
self.copyFile('colophon.pt', self.repls,destFolder=self.skinsFolder)
|
||||
self.copyFile('footer.pt', self.repls, destFolder=self.skinsFolder)
|
||||
# Create version.txt
|
||||
f = open(os.path.join(self.outputFolder, 'version.txt'), 'w')
|
||||
f.write(self.version)
|
||||
|
@ -502,6 +503,7 @@ class Generator(AbstractGenerator):
|
|||
parentWrapper = '%s_Wrapper' % k.name
|
||||
wrapperDef = 'class %s_Wrapper(%s, %s):\n' % \
|
||||
(c.name, parentWrapper, parentClass)
|
||||
wrapperDef += ' security = ClassSecurityInfo()\n'
|
||||
titleFound = False
|
||||
for attrName in c.orderedAttributes:
|
||||
if attrName == 'title':
|
||||
|
@ -519,12 +521,20 @@ class Generator(AbstractGenerator):
|
|||
# Implicitly, the title will be added by Archetypes. So I need
|
||||
# to define a property for it.
|
||||
wrapperDef += self.generateWrapperProperty('title', String())
|
||||
# For custom tool, flavour and pod template, add a call to a method
|
||||
# that allows to custom element to update the basic element.
|
||||
if isinstance(c, CustomToolClassDescriptor) or \
|
||||
isinstance(c, CustomFlavourClassDescriptor):
|
||||
wrapperDef += " if hasattr(%s, 'update'): %s.update(%s.__bases__[1])" % \
|
||||
(parentClass, parentClass, parentWrapper)
|
||||
# For custom tool and flavour, add a call to a method that
|
||||
# allows to customize elements from the base class.
|
||||
wrapperDef += " if hasattr(%s, 'update'):\n " \
|
||||
"%s.update(%s.__bases__[1])\n" % (
|
||||
parentClass, parentClass, parentWrapper)
|
||||
# For custom tool and flavour, add security declaration that
|
||||
# will allow to call their methods from ZPTs.
|
||||
wrapperDef += " for elem in dir(%s):\n " \
|
||||
"if not elem.startswith('_'): security.declarePublic" \
|
||||
"(elem)\n" % (parentClass)
|
||||
# Register the class in Zope.
|
||||
wrapperDef += 'InitializeClass(%s_Wrapper)\n' % c.name
|
||||
wrappers.append(wrapperDef)
|
||||
repls = self.repls.copy()
|
||||
repls['imports'] = '\n'.join(imports)
|
||||
|
|
|
@ -105,6 +105,9 @@ class PloneInstaller:
|
|||
if not hasattr(site.aq_base, self.productName):
|
||||
# Temporarily allow me to create Appy large plone folders
|
||||
getattr(site.portal_types, self.appyFolderType).global_allow = 1
|
||||
# Allow to create Appy large folders in the plone site
|
||||
getattr(site.portal_types,
|
||||
'Plone Site').allowed_content_types += (self.appyFolderType,)
|
||||
site.invokeFactory(self.appyFolderType, self.productName,
|
||||
title=self.productName)
|
||||
getattr(site.portal_types, self.appyFolderType).global_allow = 0
|
||||
|
|
|
@ -4,6 +4,8 @@ from appy.gen.plone25.wrappers import AbstractWrapper, FileWrapper
|
|||
from appy.gen.plone25.wrappers.ToolWrapper import ToolWrapper
|
||||
from appy.gen.plone25.wrappers.FlavourWrapper import FlavourWrapper
|
||||
from appy.gen.plone25.wrappers.PodTemplateWrapper import PodTemplateWrapper
|
||||
from Globals import InitializeClass
|
||||
from AccessControl import ClassSecurityInfo
|
||||
<!imports!>
|
||||
|
||||
class PodTemplate(PodTemplateWrapper):
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
'''This package contains base classes for wrappers that hide to the Appy
|
||||
developer the real classes used by the undelrying web framework.'''
|
||||
developer the real classes used by the underlying web framework.'''
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
import time, os.path, mimetypes
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue