Bugfix in new.py; added new user management.

This commit is contained in:
Gaetan Delannay 2010-09-02 16:16:08 +02:00
parent fa974239f3
commit eb52c1bb7d
30 changed files with 842 additions and 397 deletions

View file

@ -20,7 +20,6 @@ class <!flavourName!>(OrderedBaseFolder, FlavourMixin):
allowed_content_types = []
filter_content_types = 0
global_allow = 1
#content_icon = '<!flavourName!>.gif'
immediate_view = 'skyn/view'
default_view = 'skyn/view'
suppl_views = ()

View file

@ -1,38 +1,15 @@
<!codeHeader!>
from zExceptions import BadRequest
from Products.CMFCore.DirectoryView import manage_addDirectoryView
from Products.ExternalMethod.ExternalMethod import ExternalMethod
from Products.Archetypes.Extensions.utils import installTypes
from Products.Archetypes.Extensions.utils import install_subskin
from Products.Archetypes.config import TOOL_NAME as ARCHETYPETOOLNAME
from Products.Archetypes.atapi import listTypes
from Products.<!applicationName!>.config import applicationRoles,defaultAddRoles
from Products.<!applicationName!>.config import product_globals as GLOBALS
import appy.gen
from appy.gen.plone25.installer import PloneInstaller
<!imports!>
catalogMap = {}
<!catalogMap!>
appClasses = <!appClasses!>
appClassNames = [<!appClassNames!>]
allClassNames = [<!allClassNames!>]
workflows = {<!workflows!>}
showPortlet = <!showPortlet!>
import Products.<!applicationName!>.config as config
# ------------------------------------------------------------------------------
def install(self, reinstall=False):
'''Installation of product "<!applicationName!>"'''
ploneInstaller = PloneInstaller(reinstall, "<!applicationName!>", self,
<!minimalistPlone!>, appClasses, appClassNames, allClassNames,
catalogMap, applicationRoles, defaultAddRoles, workflows,
<!appFrontPage!>, showPortlet, globals())
return ploneInstaller.install()
'''Installation procedure.'''
return PloneInstaller(reinstall, self, config).install()
# ------------------------------------------------------------------------------
def uninstall(self, reinstall=False):
'''Uninstallation of product "<!applicationName!>"'''
ploneInstaller = PloneInstaller(reinstall, "<!applicationName!>", self,
<!minimalistPlone!>, appClasses, appClassNames, allClassNames,
catalogMap, applicationRoles, defaultAddRoles, workflows,
<!appFrontPage!>, showPortlet, globals())
return ploneInstaller.uninstall()
'''Uninstallation procedure.'''
return PloneInstaller(reinstall, self, config).uninstall()
# ------------------------------------------------------------------------------

View file

@ -14,19 +14,17 @@ class <!applicationName!>PodTemplate(BaseContent, PodTemplateMixin):
'''POD template.'''
security = ClassSecurityInfo()
__implements__ = (getattr(BaseContent,'__implements__',()),)
archetype_name = '<!applicationName!>PodTemplate'
meta_type = '<!applicationName!>PodTemplate'
portal_type = '<!applicationName!>PodTemplate'
allowed_content_types = []
filter_content_types = 0
global_allow = 1
#content_icon = '<!applicationName!>PodTemplate.gif'
immediate_view = 'skyn/view'
default_view = 'skyn/view'
suppl_views = ()
typeDescription = "<!applicationName!>PodTemplate"
typeDescMsgId = '<!applicationName!>_edit_descr'
typeDescMsgId = '<!applicationName!>PodTemplate_edit_descr'
wrapperClass = <!wrapperClass!>
schema = fullSchema
for elem in dir(PodTemplateMixin):

View file

@ -170,21 +170,13 @@ th {
/* overflow: visible; IE produces ugly results with this */
}
.listing {
margin: 0em 0em;
}
.listing { margin: 0em 0em; }
.listing td, .stx table td {
padding-right: 0.1em;
padding-left: 0.3em;
padding-top: 0.3em;
padding-bottom: 0em;
padding : 0.1em 0.3em 0.1em 0.3em;
border-top : 1px solid #8CACBB;
}
.vertical td {
padding-left: 0.3em;
}
.listing th, .stx table th { padding: 0.25em 0.3em; }
.vertical td { padding-left: 0.3em; }
.innerAppyTable {
border-width: 0px;

View file

@ -0,0 +1,34 @@
<!codeHeader!>
from AccessControl import ClassSecurityInfo
from Products.Archetypes.atapi import *
import Products.<!applicationName!>.config
from appy.gen.plone25.mixins.UserMixin import UserMixin
from Extensions.appyWrappers import <!wrapperClass!>
schema = Schema((<!fields!>
),)
fullSchema = BaseSchema.copy() + schema.copy()
class <!applicationName!>User(BaseContent, UserMixin):
'''Configuration flavour class for <!applicationName!>.'''
security = ClassSecurityInfo()
__implements__ = (getattr(BaseContent,'__implements__',()),)
archetype_name = '<!applicationName!>User'
meta_type = '<!applicationName!>User'
portal_type = '<!applicationName!>User'
allowed_content_types = []
filter_content_types = 0
global_allow = 1
immediate_view = 'skyn/view'
default_view = 'skyn/view'
suppl_views = ()
typeDescription = "<!applicationName!>User"
typeDescMsgId = '<!applicationName!>User_edit_descr'
i18nDomain = '<!applicationName!>'
schema = fullSchema
wrapperClass = <!wrapperClass!>
for elem in dir(UserMixin):
if not elem.startswith('__'): security.declarePublic(elem)
<!commonMethods!>
<!methods!>
registerType(<!applicationName!>User, '<!applicationName!>')

View file

@ -25,20 +25,8 @@ def countTest():
numberOfExecutedTests += 1
# ------------------------------------------------------------------------------
from config import *
from ZPublisher.HTTPRequest import BaseRequest
import logging
try:
import CustomizationPolicy
except ImportError:
CustomizationPolicy = None
from Products.CMFCore import utils as cmfutils
from Products.CMFCore import DirectoryView
from Products.CMFPlone.utils import ToolInit
from Products.Archetypes.atapi import *
from Products.Archetypes import listTypes
import config
from appy.gen.plone25.installer import ZopeInstaller
logger = logging.getLogger(PROJECTNAME)
# Zope-level installation of the generated product. ----------------------------
def initialize(context):
@ -46,8 +34,6 @@ def initialize(context):
# I need to do those imports here; else, types and add permissions will not
# be registered.
classes = [<!classes!>]
ZopeInstaller(context, PROJECTNAME,
<!applicationName!>Tool.<!applicationName!>Tool,
DEFAULT_ADD_CONTENT_PERMISSION, ADD_CONTENT_PERMISSIONS,
logger, globals(), classes).install()
ZopeInstaller(context, <!applicationName!>Tool.<!applicationName!>Tool,
config, classes).install()
# ------------------------------------------------------------------------------

View file

@ -4,6 +4,7 @@ from appy.gen.plone25.wrappers import AbstractWrapper
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 appy.gen.plone25.wrappers.UserWrapper import UserWrapper
from Globals import InitializeClass
from AccessControl import ClassSecurityInfo
<!imports!>
@ -11,6 +12,9 @@ from AccessControl import ClassSecurityInfo
class PodTemplate(PodTemplateWrapper):
'''This class represents a POD template for this application.'''
<!podTemplateBody!>
class User(UserWrapper):
'''This class represents a user.'''
<!userBody!>
class Flavour(FlavourWrapper):
'''This class represents the Appy class used for defining a flavour.'''
folder=True

View file

@ -10,10 +10,26 @@ import Extensions.appyWrappers as wraps
# every Archetype instance has a method "getProductConfig" that returns this
# module.
from persistent.list import PersistentList
from zExceptions import BadRequest
from ZPublisher.HTTPRequest import BaseRequest
try:
import CustomizationPolicy
except ImportError:
CustomizationPolicy = None
from OFS.Image import File
from DateTime import DateTime
from Products.CMFCore import utils as cmfutils
from Products.CMFCore.utils import getToolByName
from Products.CMFPlone.PloneBatch import Batch
from Products.CMFPlone.utils import ToolInit
from Products.CMFCore import DirectoryView
from Products.CMFCore.DirectoryView import manage_addDirectoryView
from Products.ExternalMethod.ExternalMethod import ExternalMethod
from Products.Archetypes.Extensions.utils import installTypes
from Products.Archetypes.Extensions.utils import install_subskin
from Products.Archetypes.config import TOOL_NAME as ARCHETYPETOOLNAME
from Products.Archetypes import listTypes, process_types
import appy.gen
import logging
logger = logging.getLogger('<!applicationName!>')
@ -25,10 +41,19 @@ DEFAULT_ADD_CONTENT_PERMISSION = "Add portal content"
ADD_CONTENT_PERMISSIONS = {
<!addPermissions!>}
setDefaultRoles(DEFAULT_ADD_CONTENT_PERMISSION, tuple(defaultAddRoles))
product_globals = globals()
applicationRoles = [<!roles!>]
rootClasses = [<!rootClasses!>]
# Applications classes, in various formats and flavours
rootClasses = [<!rootClasses!>]
appClasses = <!appClasses!>
appClassNames = [<!appClassNames!>]
allClassNames = [<!allClassNames!>]
# List of classes that must be hidden from the catalog
catalogMap = {}
<!catalogMap!>
# Dict whose keys are class names and whose values are workflow names (=the
# workflow used by the content type)
workflows = {<!workflows!>}
# In the following dict, we keep one instance for every Appy workflow defined
# in the application. Those prototypical instances will be used for executing
# user-defined actions and transitions. For each instance, we add a special
@ -43,4 +68,16 @@ attributes = {<!attributes!>}
# In the followinf dict, we store, for every Appy class, a dict of appy types
# keyed by their names.
attributesDict = {<!attributesDict!>}
# Application roles
applicationRoles = [<!roles!>]
applicationGlobalRoles = [<!gRoles!>]
grantableRoles = [<!grRoles!>]
# Configuration options
showPortlet = <!showPortlet!>
languages = [<!languages!>]
languageSelector = <!languageSelector!>
minimalistPlone = <!minimalistPlone!>
appFrontPage = <!appFrontPage!>
# ------------------------------------------------------------------------------