Conjunto de mudanças 6511 no repositório publico
- Timestamp:
- 17/06/2012 15:51:05 (9 anos atrás)
- Localização:
- PortalInterlegis/produtos/il.portalinterlegis/trunk/src/il/portalinterlegis
- Arquivos:
-
- 11 editados
Legenda:
- Não Modificado
- Adicionado
- Removido
-
PortalInterlegis/produtos/il.portalinterlegis/trunk/src/il/portalinterlegis/browser/boxes/interfaces.py
r6495 r6511 14 14 """ 15 15 16 16 17 # decorator 17 18 def rich(*args, **kwargs): … … 22 23 return cls 23 24 return f 25 24 26 25 27 @rich('text', target=AutocompleteFieldWidget) … … 32 34 required=False) 33 35 36 34 37 @rich('text', target=AutocompleteFieldWidget) 35 38 class ICarousel(BoxSchema): … … 39 42 source=PathSourceBinder(portal_type='Document')) 40 43 44 41 45 class ICalendar(BoxSchema): 42 46 pass 47 43 48 44 49 class IAcompanheOInterlegis(BoxSchema): 45 50 pass 46 51 52 47 53 class ITabsPilares(BoxSchema): 48 54 pass 49 55 56 50 57 class IHighlight(BoxSchema): 51 58 pass 59 52 60 53 61 def box_schemas(): -
PortalInterlegis/produtos/il.portalinterlegis/trunk/src/il/portalinterlegis/browser/boxes/manager.py
r6510 r6511 17 17 from interfaces import box_schemas 18 18 19 19 20 class PersistentDictionaryField(datamanager.DictionaryField): 20 21 adapts(PersistentDict, IField) … … 23 24 24 25 template_factory = Environment(loader=PackageLoader(__name__)) 26 25 27 26 28 class TemplateAware(object): … … 42 44 def __call__(self, context): 43 45 return self.template.render( 44 box =self,45 has_permission =self.has_permission(context),46 inner =self.inner_render(context))46 box=self, 47 has_permission=self.has_permission(context), 48 inner=self.inner_render(context)) 47 49 48 50 def has_permission(self, context): … … 69 71 self.schema = schema 70 72 self.number = number 71 self.form_label = form_label or u'Edite os valore desta caixa' #TODO: improve this text73 self.form_label = form_label or u'Edite os valore desta caixa' # TODO: improve this text 72 74 73 75 @property … … 90 92 return 'box_%s' % self.id 91 93 92 edit_href = form_name # To be overridden independently94 edit_href = form_name # To be overridden independently 93 95 94 96 … … 126 128 return BoxEditForm 127 129 130 128 131 def build_many_box_forms(schema, max_number): 129 for number in range(1, max_number +1):132 for number in range(1, max_number + 1): 130 133 build_box_form(Box(schema, number)) 134 131 135 132 136 def get_or_create_persistent_dict(dictionary, key): … … 135 139 dictionary[key] = value = PersistentDict() 136 140 return value 141 137 142 138 143 # ROWS … … 143 148 def __init__(self, *row_spec): 144 149 try: 145 for (width, renderable) in row_spec: pass 150 for (width, renderable) in row_spec: 151 pass 146 152 except ValueError, e: 147 153 e.args += row_spec … … 162 168 `row_spec` is a sequence of cell specs: [(width, schema, number), ...] 163 169 """ 164 return self.template.render(cells =self.cells(context))170 return self.template.render(cells=self.cells(context)) 165 171 166 172 … … 181 187 for s in box_schemas(): 182 188 build_many_box_forms(s, 10) 183 -
PortalInterlegis/produtos/il.portalinterlegis/trunk/src/il/portalinterlegis/browser/homes.py
r6497 r6511 19 19 return 'TODO: TAB %s' % self.title 20 20 21 21 22 class TabbedPane(object): 22 23 … … 30 31 FULL = 16 31 32 ___, _ = DtRow, Box 33 32 34 33 35 class Home(GridView): … … 51 53 ___((4, _(IHighlight, 1)), (4, _(ISimpleBox, 1)), (4, _(ISimpleBox, 2)), (4, _(ISimpleBox, 3)),), 52 54 ] 55 53 56 54 57 class Carousel(GridView): -
PortalInterlegis/produtos/il.portalinterlegis/trunk/src/il/portalinterlegis/browser/interfaces.py
r6495 r6511 12 12 # HOMES 13 13 14 14 15 class IComunidadeLegislativa(Interface): 15 16 "Marker interface para home" 17 16 18 17 19 class IInformacao(Interface): 18 20 "Marker interface para home" 19 21 22 20 23 class ICapacitacao(Interface): 21 24 "Marker interface para home" 25 22 26 23 27 class ITecnologia(Interface): 24 28 "Marker interface para home" 25 29 30 26 31 class IComunicacao(Interface): 27 32 "Marker interface para home" -
PortalInterlegis/produtos/il.portalinterlegis/trunk/src/il/portalinterlegis/config.py
r6394 r6511 1 1 # -*- coding: utf-8 -*- 2 # File: config.py3 4 2 5 3 __author__ = """Interlegis <spdt@interlegis.leg.br>""" 6 4 __docformat__ = 'plaintext' 7 -
PortalInterlegis/produtos/il.portalinterlegis/trunk/src/il/portalinterlegis/content/createcontent.py
r6430 r6511 5 5 import logging 6 6 from Products.Five.utilities.marker import mark 7 7 8 8 9 # codigo de … … 21 22 22 23 new_objects = [ 23 { 'id': 'some-id',24 25 26 27 28 29 30 31 32 24 {'id': 'some-id', 25 'title': 'Some Title', 26 'description': 'Some Description', 27 'type': 'Folder', 28 'layout': 'folder_contents', 29 'workflow_transition': 'retract', 30 'exclude_from_nav': True, 31 'children': profile_children, 32 'marker_interface': marker_interface 33 }, 33 34 ] 34 35 35 36 * layout: optional, it sets a different default layout 36 37 * workflow_transition: optional, it tries to start that state transition 37 after the object is created. (You cannot directly set the workflow to 38 after the object is created. (You cannot directly set the workflow to 38 39 any state, but you must push it through legal state transitions.) 39 40 * exclude_from_nav: optional, excludes item from navigation … … 62 63 if obj.Type() != new_object['type']: 63 64 logger.info("types don't match!") 64 else: 65 if new_object.has_key('layout'):65 else: 66 if 'layout' in new_object: 66 67 obj.setLayout(new_object['layout']) 67 if new_object.has_key('workflow_transition'):68 if 'workflow_transition' in new_object: 68 69 try: 69 workflowTool.doActionFor(obj, 70 workflowTool.doActionFor(obj, 70 71 new_object['workflow_transition']) 71 72 except WorkflowException: 72 73 logger.info( 73 74 "WARNING: couldn't do workflow transition") 74 if new_object.has_key('exclude_from_nav'):75 if 'exclude_from_nav' in new_object: 75 76 obj.setExcludeFromNav(new_object['exclude_from_nav']) 76 if new_object.has_key('marker_interface'):77 if 'marker_interface' in new_object: 77 78 mark(obj, new_object['marker_interface']) 78 79 obj.reindexObject() 79 children = new_object.get('children', [])80 children = new_object.get('children', []) 80 81 if len(children) > 0: 81 82 createObjects(obj, children) -
PortalInterlegis/produtos/il.portalinterlegis/trunk/src/il/portalinterlegis/setuphandlers.py
r6441 r6511 4 4 from content.createcontent import createObjects 5 5 from browser.homes import IComunidadeLegislativa, IInformacao, ICapacitacao, ITecnologia, IComunicacao 6 6 7 7 8 def setupVarious(context): … … 24 25 # navegacao de 1o nivel 25 26 normalizer = getUtility(IIDNormalizer) 26 folders_do_menu = [{'id': normalizer.normalize(title), 27 folders_do_menu = [{'id': normalizer.normalize(title), 27 28 'title': title, 28 29 'description': u'Seção %s' % title, … … 41 42 createObjects(portal, folders_do_menu) 42 43 43 # esconde todo o resto !44 # esconde todo o resto 44 45 ids_folders_do_menu = [f['id'] for f in folders_do_menu] + ['front-page'] 45 46 for id in portal.objectIds(): … … 48 49 if hasattr(obj, 'exclude_from_nav'): 49 50 obj.setExcludeFromNav(True) 50 obj.reindexObject() # nao sei exatamente pq isso, mas nao custa colocar51 obj.reindexObject() # nao sei exatamente pq isso, mas nao custa colocar -
PortalInterlegis/produtos/il.portalinterlegis/trunk/src/il/portalinterlegis/tests/fixtures.py
r6496 r6511 1 1 # -*- coding: utf-8 -*- 2 from persistent.dict import PersistentDict2 #from persistent.dict import PersistentDict 3 3 from plone.app.testing import PLONE_FIXTURE, PloneSandboxLayer, IntegrationTesting, applyProfile 4 from z3c.form import datamanager5 from z3c.form.interfaces import IDataManager4 #from z3c.form import datamanager 5 #from z3c.form.interfaces import IDataManager 6 6 from zope.component import adapts, provideAdapter 7 7 from zope.configuration import xmlconfig 8 from zope.interface import implements9 from zope.schema.interfaces import IField8 #from zope.interface import implements 9 #from zope.schema.interfaces import IField 10 10 from integrationtestutils import BrowserAwareIntegrationTesting 11 11 12 12 13 class IlPortalinterlegis(PloneSandboxLayer): … … 21 22 </configure> 22 23 """, context=configurationContext) 23 24 24 25 25 # Load ZCML for this package … … 36 36 plone.formwidget.contenttree, 37 37 context=configurationContext) 38 import il.portalinterlegis39 38 xmlconfig.file('configure.zcml', 40 39 il.portalinterlegis, -
PortalInterlegis/produtos/il.portalinterlegis/trunk/src/il/portalinterlegis/tests/integrationtestutils.py
r6485 r6511 36 36 """ 37 37 return self._auth_browser(TEST_USER_NAME, TEST_USER_PASSWORD) 38 -
PortalInterlegis/produtos/il.portalinterlegis/trunk/src/il/portalinterlegis/tests/testintegration.py
r6499 r6511 50 50 u'Capacitação', 51 51 u'Tecnologia', 52 u'Comunicação' ,],52 u'Comunicação'], 53 53 [li.text_content() for li in dom.cssselect('#portal-globalnav li')]) 54 54 55 55 def test_homes_marcadas_e_com_layout_home(self): 56 56 for id, marker in [('comunidade-legislativa', IComunidadeLegislativa), 57 ('informacao', 58 ('capacitacao', 59 ('tecnologia', 60 ('comunicacao', 57 ('informacao', IInformacao), 58 ('capacitacao', ICapacitacao), 59 ('tecnologia', ITecnologia), 60 ('comunicacao', IComunicacao), 61 61 ]: 62 62 obj = self.portal[id] -
PortalInterlegis/produtos/il.portalinterlegis/trunk/src/il/portalinterlegis/tests/testunitboxes.py
r6510 r6511 8 8 9 9 diff_count = count(1) 10 10 11 11 12 class TestUnitBoxes(unittest.TestCase): … … 37 38 38 39 box = Box(IStubBox, 1) 39 box.content = Mock(return_value ={'var': 'XXXX'})40 box.content = Mock(return_value={'var': 'XXXX'}) 40 41 context = object() 41 42 self.assertMultiLineEqual(''' … … 51 52 52 53 box = Box(IStubBox, 1) 53 box.content = Mock(return_value ={'var': 'XXXX'})54 box.content = Mock(return_value={'var': 'XXXX'}) 54 55 context = object() 55 56 self.assertMultiLineEqual(''' … … 92 93 from jinja2 import Template 93 94 95 94 96 class TemplateFactoryStub(object): 95 97
Note: Veja
TracChangeset
para ajuda no uso do visualizador de conjunto de mudanças.