source: publico/ILCertificador/trunk/Extensions/AppInstall.py @ 2712

Última Alteração nesse arquivo desde 2712 foi 2712, incluída por jeanferri, 14 anos atrás

Corrigidos problemas de prmissão por causo da mudança de nome

File size: 3.6 KB
Linha 
1from StringIO import StringIO
2from Products.CMFCore.utils import getToolByName
3
4def addToListProperty(self, out, propertySheet, property, value):
5    """Add the given value to the list in the given property"""
6    current = list(propertySheet.getProperty(property))
7    if value not in current:
8        current.append(value)
9        propertySheet.manage_changeProperties(**{property : current})
10
11    print >> out, "Added %s to %s" % (value, property)
12
13def addFormControllerAction(self, out, controller, template, status,
14                                contentType, button, actionType, action):
15    """Add the given action to the portalFormController"""
16    controller.addFormAction(template, status, contentType,
17                                button, actionType, action)
18    print >> out, "Added action %s to %s" % (action, template)
19
20def install(self):
21
22    out = StringIO()
23
24    # Add catalog index/metadata
25    catalog = getToolByName(self, 'portal_catalog')
26    if 'UID' not in catalog.schema():
27        catalog.addColumn('UID')
28        print >> out, "[portal_catalog] Added 'UID' metadata column."
29
30    ## Set parentMetaTypesNotToQuery
31    portalProperties = getToolByName(self, 'portal_properties')
32    navtreeProps = getattr(portalProperties, 'navtree_properties')
33    addToListProperty(self, out, navtreeProps, 'parentMetaTypesNotToQuery', 'Certificador')
34
35    ## Set metaTypesNotToList
36    addToListProperty(self, out, navtreeProps, 'metaTypesNotToList', 'AssinaturaCertificado')
37    addToListProperty(self, out, navtreeProps, 'metaTypesNotToList', 'TemplateCertificado')
38    addToListProperty(self, out, navtreeProps, 'metaTypesNotToList', 'EventoCertificado')
39    addToListProperty(self, out, navtreeProps, 'metaTypesNotToList', 'Certificado')
40
41    ## Set types_not_searched
42    siteProps = getattr(portalProperties, 'site_properties')
43    addToListProperty(self, out, siteProps, 'types_not_searched', 'Certificador')
44
45    ## Give the response types a redirection to it parent's folder
46    controller = getToolByName(self, 'portal_form_controller')
47    addFormControllerAction(self, out, controller, 'validate_integrity',
48                            'success', 'Certificado', None, 'redirect_to', 'string:${folder_url}')
49    addFormControllerAction(self, out, controller, 'validate_integrity',
50                            'success', 'EventoCertificado', None, 'redirect_to', 'python:folder.aq_parent.absolute_url()+"/evento_certificado_list"')
51    addFormControllerAction(self, out, controller, 'validate_integrity',
52                            'success', 'AssinaturaCertificado', None, 'redirect_to', 'string:${folder_url}/assinatura_certificado_list')
53    addFormControllerAction(self, out, controller, 'validate_integrity',
54                            'success', 'TemplateCertificado', None, 'redirect_to', 'string:${folder_url}/template_certificado_list')
55    addFormControllerAction(self, out, controller, 'content_status_modify',
56                            'success', 'Certificado', None, 'redirect_to', 'string:${folder_url}')
57    addFormControllerAction(self, out, controller, 'content_status_modify',
58                            'success', 'EventoCertificado', None, 'redirect_to', 'python:folder.aq_parent.absolute_url()+"/evento_certificado_list"')
59    addFormControllerAction(self, out, controller, 'content_status_modify',
60                            'success', 'AssinaturaCertificado', None, 'redirect_to', 'string:${folder_url}/assinatura_certificado_list')
61    addFormControllerAction(self, out, controller, 'content_status_modify',
62                            'success', 'TemplateCertificado', None, 'redirect_to', 'string:${folder_url}/template_certificado_list')
63
64    return out.getvalue()
65
Note: Veja TracBrowser para ajuda no uso do navegador do trac.
 

The contents and data of this website are published under license:
Creative Commons 4.0 Brasil - Atribuir Fonte - Compartilhar Igual.