[gen] Added the possibility to define searches for User, Group, Translation and Page classes.
This commit is contained in:
parent
e031e5b138
commit
10b9e60395
|
@ -702,6 +702,7 @@ class ZopeGenerator(Generator):
|
||||||
klass.generateSchema()
|
klass.generateSchema()
|
||||||
self.i18n(klass.name, klassType, nice=False)
|
self.i18n(klass.name, klassType, nice=False)
|
||||||
self.i18n('%s_plural' % klass.name, klass.name+'s', nice=False)
|
self.i18n('%s_plural' % klass.name, klass.name+'s', nice=False)
|
||||||
|
self.generateSearches(klass)
|
||||||
repls = self.repls.copy()
|
repls = self.repls.copy()
|
||||||
if klass.isFolder():
|
if klass.isFolder():
|
||||||
parents = 'BaseMixin, Folder'
|
parents = 'BaseMixin, Folder'
|
||||||
|
@ -731,6 +732,17 @@ class ZopeGenerator(Generator):
|
||||||
'classDoc': 'Tool class for %s' % self.applicationName})
|
'classDoc': 'Tool class for %s' % self.applicationName})
|
||||||
self.copyFile('Class.pyt', repls, destName='%s.py' % self.tool.name)
|
self.copyFile('Class.pyt', repls, destName='%s.py' % self.tool.name)
|
||||||
|
|
||||||
|
def generateSearches(self, classDescr):
|
||||||
|
'''Generates i18n labels for searches defined on p_classDescr.'''
|
||||||
|
for search in classDescr.getSearches(classDescr.klass):
|
||||||
|
label = '%s_search_%s' % (classDescr.name, search.name)
|
||||||
|
self.i18n(label, search.name)
|
||||||
|
self.i18n('%s_descr' % label, ' ', nice=False)
|
||||||
|
# Generate labels for groups of searches
|
||||||
|
if search.group and not search.group.label:
|
||||||
|
search.group.generateLabels(self.labels, classDescr, set(),
|
||||||
|
content='searches')
|
||||||
|
|
||||||
def generateClass(self, classDescr):
|
def generateClass(self, classDescr):
|
||||||
'''Is called each time an Appy class is found in the application, for
|
'''Is called each time an Appy class is found in the application, for
|
||||||
generating the corresponding Archetype class.'''
|
generating the corresponding Archetype class.'''
|
||||||
|
@ -754,14 +766,7 @@ class ZopeGenerator(Generator):
|
||||||
self.i18n(classDescr.name, k.__name__)
|
self.i18n(classDescr.name, k.__name__)
|
||||||
self.i18n('%s_plural' % classDescr.name, k.__name__+'s')
|
self.i18n('%s_plural' % classDescr.name, k.__name__+'s')
|
||||||
# Create i18n labels for searches
|
# Create i18n labels for searches
|
||||||
for search in classDescr.getSearches(k):
|
self.generateSearches(classDescr)
|
||||||
label = '%s_search_%s' % (classDescr.name, search.name)
|
|
||||||
self.i18n(label, search.name)
|
|
||||||
self.i18n('%s_descr' % label, ' ', nice=False)
|
|
||||||
# Generate labels for groups of searches
|
|
||||||
if search.group and not search.group.label:
|
|
||||||
search.group.generateLabels(self.labels, classDescr, set(),
|
|
||||||
content='searches')
|
|
||||||
# Generate the resulting Zope class.
|
# Generate the resulting Zope class.
|
||||||
self.copyFile('Class.pyt', repls, destName=fileName)
|
self.copyFile('Class.pyt', repls, destName=fileName)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue