Changeset 3608 in products


Ignore:
Timestamp:
Oct 25, 2012 10:46:03 AM (11 years ago)
Author:
vmaksymiv
Message:

PPP fixes

Location:
quintagroup.plonetabs/trunk/quintagroup/plonetabs
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • quintagroup.plonetabs/trunk/quintagroup/plonetabs/browser/plonetabs.py

    r3598 r3608  
    223223            self.moveAction(id, cat_name, steps=1) 
    224224            IStatusMessage(self.request).addStatusMessage( 
    225                 _(u"'${id}' action moved up.", mapping={'id': id}), type="info") 
     225                _(u"'${id}' action moved up.", mapping={'id': id}), 
     226                type="info") 
    226227            self.redirect(search="category=%s" % cat_name) 
    227228            return False 
     
    687688                self.kss_toggleCollapsible( 
    688689                    ksscore.getCssSelector('form[name=addaction_form] ' 
    689                                            '.headerAdvanced'), collapse='false') 
     690                                           '.headerAdvanced'), 
     691                    collapse='false') 
    690692 
    691693            message = _(u"Please correct the indicated errors.") 
  • quintagroup.plonetabs/trunk/quintagroup/plonetabs/tests/test_controlpanel.py

    r3437 r3608  
    1111from quintagroup.plonetabs.browser.interfaces import IPloneTabsControlPanel 
    1212from quintagroup.plonetabs.browser.plonetabs \ 
    13                                       import PloneTabsControlPanel as ptp 
     13    import PloneTabsControlPanel as ptp 
    1414from quintagroup.plonetabs.tests.base import PloneTabsTestCase 
    1515from quintagroup.plonetabs.tests.data import PORTAL_ACTIONS 
     
    2222        self.loginAsPortalOwner() 
    2323        panel = getMultiAdapter((self.portal, self.portal.REQUEST), 
    24             name='plonetabs-controlpanel') 
     24                                name='plonetabs-controlpanel') 
    2525        # we need this to apply zope2 security (got from zope2 traverse method) 
    2626        self.panel = panel.__of__(self.portal) 
     
    3131        method = self.panel.redirect 
    3232        portal_url = getMultiAdapter((self.portal, self.portal.REQUEST), 
    33                                       name=u"plone_portal_state").portal_url() 
     33                                     name=u"plone_portal_state").portal_url() 
    3434        url = '%s/@@plonetabs-controlpanel' % portal_url 
    3535        method() 
    3636        self.assertEquals(response.headers.get('location', ''), url, 
    37             'Redirect method is not working properly.') 
     37                          'Redirect method is not working properly.') 
    3838 
    3939        # check query string and anchor hash 
    4040        method('http://quintagroup.com', 'q=test', 'hash_code') 
    4141        self.assertEquals(response.headers.get('location', ''), 
    42             'http://quintagroup.com?q=test#hash_code', 
    43             'Redirect method is not working properly.') 
     42                          'http://quintagroup.com?q=test#hash_code', 
     43                          'Redirect method is not working properly.') 
    4444 
    4545    def test_fixExpression(self): 
     
    4747        self.assertEquals(method('/slash'), 'string:${portal_url}/slash') 
    4848        self.assertEquals(method('https://test.com'), 
    49                                  'string:https://test.com') 
     49                          'string:https://test.com') 
    5050        self.assertEquals(method('python:True'), 'python:True') 
    5151        self.assertEquals(method('hello'), 'string:${object_url}/hello') 
     
    6464        errors = method('new_category', good_data) 
    6565        self.assertEquals(errors, {}, 
    66             'There should be no errors for valid data.') 
     66                          'There should be no errors for valid data.') 
    6767 
    6868        bad_data = {'id': '', 
     
    8888 
    8989        self.assertEquals(len(errors.keys()), 4, 
    90             'validateActionFields method is not working properly.') 
     90                          'validateActionFields method is not working ' 
     91                          'properly.') 
    9192        #### pyflakes.scripts.pyflakes ends. 
    9293 
     
    9596        errors = {'error': 'error message'} 
    9697        self.assertEquals(method(errors), errors, 
    97             'processErrors method is not working properly.') 
     98                          'processErrors method is not working properly.') 
    9899        self.assertEquals(method(errors, 'pre_', '_post'), 
    99             {'pre_error_post': 'error message'}, 
    100             'processErrors method is not working properly.') 
     100                          {'pre_error_post': 'error message'}, 
     101                          'processErrors method is not working properly.') 
    101102 
    102103    def test_parseEditForm(self): 
     
    110111                'available_expr_id1': 'expr2'} 
    111112        self.assertEquals(method(form), 
    112             ('id1', 'cat1', {'id': 'id_new', 
    113                              'title': 'title1', 
    114                              'url_expr': 'expr1', 
    115                              'available_expr': 'expr2', 
    116                              'visible': True}), 
    117             'parseEditForm method is not working properly.') 
     113                          ('id1', 'cat1', {'id': 'id_new', 
     114                                           'title': 'title1', 
     115                                           'url_expr': 'expr1', 
     116                                           'available_expr': 'expr2', 
     117                                           'visible': True}), 
     118                          'parseEditForm method is not working properly.') 
    118119 
    119120        del form['orig_id'] 
     
    129130                'available_expr': 'expr2'} 
    130131        self.assertEquals(method(form), 
    131             ('id1', 'cat1', {'id': 'id1', 
    132                              'visible': True, 
    133                              'title': 'title1', 
    134                              'url_expr': 'string:expr1', 
    135                              'available_expr': 'expr2'}), 
    136             'parseAddForm method is not working properly.') 
     132                          ('id1', 'cat1', {'id': 'id1', 
     133                                           'visible': True, 
     134                                           'title': 'title1', 
     135                                           'url_expr': 'string:expr1', 
     136                                           'available_expr': 'expr2'}), 
     137                          'parseAddForm method is not working properly.') 
    137138 
    138139        del form['id'] 
     
    146147        self.setupActions(self.tool) 
    147148        self.assertEquals(method('portal_tabs').id, 'portal_tabs', 
    148             'getActionCategory is not working properly.') 
     149                          'getActionCategory is not working properly.') 
    149150 
    150151    def test_getOrCreateCategory(self): 
     
    152153        self.purgeActions() 
    153154        self.assertEquals(method('portal_tabs').id, 'portal_tabs', 
    154             'getOrCreateCategory is not working properly.') 
     155                          'getOrCreateCategory is not working properly.') 
    155156 
    156157    def test_setSiteProperties(self): 
     
    158159        sp = getToolByName(self.portal, 'portal_properties').site_properties 
    159160        self.assertEquals(sp.getProperty('title'), 'Test Title', 
    160             'setSiteProperties method is not working properly.') 
     161                          'setSiteProperties method is not working properly.') 
    161162 
    162163    def test_renderViewlet(self): 
     
    195196        self.panel.addAction('new_category', {'id': 'id1', 'title': 'Test'}) 
    196197        self.failUnless('id1' in self.tool.new_category.objectIds(), 
    197             'addAction method is not workig properly') 
     198                        'addAction method is not workig properly') 
    198199 
    199200    def test_updateAction(self): 
     
    210211        method('home', 'portal_tabs', {'id': 'new_home'}) 
    211212        self.failUnless('new_home' in self.tool.portal_tabs.objectIds(), 
    212             'updateAction method is not workig properly') 
     213                        'updateAction method is not workig properly') 
    213214 
    214215    def test_deleteAction(self): 
     
    217218        self.panel.deleteAction('home', 'portal_tabs') 
    218219        self.failIf('home' in self.tool.portal_tabs.objectIds(), 
    219              'deleteAction method is not workig properly') 
     220                    'deleteAction method is not workig properly') 
    220221 
    221222    def test_moveAction(self): 
     
    224225        pos = self.tool.portal_tabs.getObjectPosition 
    225226        self.assertEquals(pos('home'), 0, 
    226             'moveAction method is not workig properly') 
     227                          'moveAction method is not workig properly') 
    227228        self.panel.moveAction('home', 'portal_tabs', -1) 
    228229        self.assertEquals(pos('home'), 1, 
    229              'moveAction method is not workig properly') 
     230                          'moveAction method is not workig properly') 
    230231 
    231232 
     
    237238        self.loginAsPortalOwner() 
    238239        panel = getMultiAdapter((self.portal, self.portal.REQUEST), 
    239             name='plonetabs-controlpanel') 
     240                                name='plonetabs-controlpanel') 
    240241        # we need this to apply zope2 security (got from zope2 traverse method) 
    241242        self.panel = panel.__of__(self.portal) 
     
    244245    def test_interface(self): 
    245246        self.failUnless(IPloneTabsControlPanel.implementedBy(ptp), 
    246             'PloneTabs control panel does not implement required interface.') 
     247                        'PloneTabs control panel does not implement ' 
     248                        'required interface.') 
    247249        self.failUnless(verifyClass(IPloneTabsControlPanel, ptp), 
    248             'PloneTabs control panel does not implement required interface.') 
     250                        'PloneTabs control panel does not implement ' 
     251                        'required interface.') 
    249252 
    250253    def test_getPageTitle(self): 
    251254        self.assertEquals(self.panel.getPageTitle(), 
    252             _(u"Portal Tabs Configuration"), 
    253             'getPageTitle method is broken') 
     255                          _(u"Portal Tabs Configuration"), 
     256                          'getPageTitle method is broken') 
    254257        self.assertEquals(self.panel.getPageTitle(category='notexists'), 
    255             _(u"Plone '${cat_name}' Configuration", 
    256               mapping={'cat_name': 'notexists'}), 
    257             'getPageTitle method is broken') 
     258                          _(u"Plone '${cat_name}' Configuration", 
     259                            mapping={'cat_name': 'notexists'}), 
     260                          'getPageTitle method is broken') 
    258261 
    259262    def test_hasActions(self): 
     
    262265        self.purgeActions() 
    263266        self.failIf(method(), 
    264             'There should be no portal_tab actions in portal') 
     267                    'There should be no portal_tab actions in portal') 
    265268 
    266269        # setup our own actions 
    267270        self.setupActions(self.tool) 
    268271        self.failUnless(method(), 
    269             'There should be portal_tab actions in portal') 
     272                        'There should be portal_tab actions in portal') 
    270273 
    271274    def test_getPortalActions(self): 
     
    273276        # purge any default portal actions 
    274277        self.purgeActions() 
    275         self.assertEquals(len(method()), 0, 
    276             'There should be no actions in portal_tabs category.') 
     278        self.assertEquals(len(method()), 0, 'There should be no actions in ' 
     279                          'portal_tabs category.') 
    277280 
    278281        # setup our own actions 
    279282        self.setupActions(self.tool) 
    280283        self.assertEquals(len(method()), 2, 
    281             'There should be 2 actions in portal_tabs category.') 
     284                          'There should be 2 actions in portal_tabs category.') 
    282285 
    283286        # marginal arguments 
    284287        self.assertEquals(len(method('notexistent_category')), 0, 
    285             'There should be no actions for not existed category.') 
     288                          'There should be no actions for not existed ' 
     289                          'category.') 
    286290 
    287291    def test_isGeneratedTabs(self): 
     
    304308        self.purgeActions() 
    305309        self.failIf('class="editform"' in method(), 
    306             'There should no be actions in actions list template.') 
     310                    'There should no be actions in actions list template.') 
    307311        self.setupActions(self.tool) 
    308312        self.failUnless('class="editform"' in method(), 
    309             'There are no actions in actions list template.') 
     313                        'There are no actions in actions list template.') 
    310314 
    311315    def test_getAutoGenereatedSection(self): 
    312316        method = self.panel.getAutoGenereatedSection 
    313317        self.failIf('<form' in method('user'), 
    314             'There should be no form in autogenerated tabs template ' 
    315             'for category other than portal_tabs.') 
     318                    'There should be no form in autogenerated tabs template ' 
     319                    'for category other than portal_tabs.') 
    316320        self.failUnless('<form' in method('portal_tabs'), 
    317             'There should be form in autogenerated tabs template ' 
    318             'for portal_tabs category.') 
     321                        'There should be form in autogenerated tabs template ' 
     322                        'for portal_tabs category.') 
    319323 
    320324    def test_getGeneratedTabs(self): 
     
    331335        self.purgeContent() 
    332336        self.assertEquals(len(method()), 0, 
    333             'There should be no root elements for navigation.') 
     337                          'There should be no root elements for navigation.') 
    334338 
    335339        # now add some testing content 
    336340        self.setupContent(self.portal) 
    337         self.assertEquals(len(method()), 2, 
    338             'There should be 2 elements in portal root for navigation.') 
     341        self.assertEquals(len(method()), 2, 'There should be 2 elements in ' 
     342                          'portal root for navigation.') 
    339343 
    340344        # now switch off autogeneration 
     
    342346        sp.manage_changeProperties(disable_folder_sections=True) 
    343347        self.assertEquals(len(method()), 0, 
    344             'There should be no root elements for navigation when ' 
    345             'tabs autogeneration is switched off.') 
     348                          'There should be no root elements for navigation ' 
     349                          'when tabs autogeneration is switched off.') 
    346350 
    347351    def test_getCategories(self): 
     
    349353        # purge any default portal actions 
    350354        self.purgeActions() 
    351         self.assertEquals(len(method()), 0, 
    352             'There should be no categories in portal_actions tool.') 
     355        self.assertEquals(len(method()), 0, 'There should be no categories ' 
     356                          'in portal_actions tool.') 
    353357 
    354358        # now setup actions 
    355359        self.setupActions(self.tool) 
    356360        self.assertEquals(method(), ['portal_tabs', 'new_category'], 
    357             'There should be exactly 2 categories in portal_actions tool.') 
     361                          'There should be exactly 2 categories in ' 
     362                          'portal_actions tool.') 
    358363 
    359364    def test_portal_tabs(self): 
     
    362367        self.purgeActions() 
    363368        self.assertEquals(len(method()), 0, 
    364             'There should be no portal tabs.') 
     369                          'There should be no portal tabs.') 
    365370 
    366371        # cleanup memoize cache 
     
    372377        self.setupActions(self.tool) 
    373378        self.assertEquals(len(method()), 2, 
    374             'There should be 2 portal tabs.') 
     379                          'There should be 2 portal tabs.') 
    375380 
    376381        # add content 
    377382        self.setupContent(self.portal) 
    378383        self.assertEquals(len(method()), 4, 
    379             'There should be 4 portal tabs.') 
     384                          'There should be 4 portal tabs.') 
    380385 
    381386    def test_selected_portal_tab(self): 
    382387        self.assertEquals(self.panel.selected_portal_tab(), 'index_html', 
    383             'index_html is not selected tab while being on configlet.') 
     388                          'index_html is not selected tab while being on ' 
     389                          'configlet.') 
    384390 
    385391    def test_test(self): 
    386392        self.assertEquals(self.panel.test(True, 'true', 'false'), 'true', 
    387             'Test function does not work properly.') 
     393                          'Test function does not work properly.') 
    388394 
    389395 
     
    395401        self.loginAsPortalOwner() 
    396402        panel = getMultiAdapter((self.portal, self.portal.REQUEST), 
    397             name='plonetabs-controlpanel') 
     403                                name='plonetabs-controlpanel') 
    398404        # we need this to apply zope2 security (got from zope2 traverse method) 
    399405        self.panel = panel.__of__(self.portal) 
     
    426432        self.failUnless('id1' in self.tool.cat1.objectIds()) 
    427433        self.failIf(postback, 
    428             'There should be redirect after successfull adding.') 
     434                    'There should be redirect after successfull adding.') 
    429435 
    430436    def test_manage_editAction(self): 
     
    445451        self.failUnless('id_new' in self.tool.portal_tabs.objectIds()) 
    446452        self.failIf(postback, 
    447             'There should be redirect after successfull edition.') 
     453                    'There should be redirect after successfull edition.') 
    448454 
    449455        form['category'] = 'non_existent' 
  • quintagroup.plonetabs/trunk/quintagroup/plonetabs/tests/test_erase.py

    r3563 r3608  
    99try: 
    1010    # Plone < 4.3 
    11     from zope.app.component import hooks  
     11    from zope.app.component import hooks 
    1212    setSite = hooks.setSite 
    1313    setHooks = hooks.setHooks 
    1414except ImportError: 
    15     # Plone >= 4.3  
     15    # Plone >= 4.3 
    1616    from zope.component.hooks import setSite, setHooks 
    1717 
     
    6161        tool = getToolByName(self.portal, 'portal_actionicons') 
    6262        icon_ids = [i._action_id for i in tool.listActionIcons()] 
    63         self.failIf('plonetabs' in icon_ids, 
    64             'There should be no plonetabs action icon after uninstall.') 
     63        self.failIf('plonetabs' in icon_ids, 'There should be no plonetabs ' 
     64                    'action icon after uninstall.') 
    6565 
    6666    def test_controlPanel(self): 
    6767        tool = getToolByName(self.portal, 'portal_controlpanel') 
    6868        action_ids = [a.id for a in tool.listActions()] 
    69         self.failIf('plonetabs' in action_ids, 
    70             'There should be no plonetabs configlet after after uninstall.') 
     69        self.failIf('plonetabs' in action_ids, 'There should be no plonetabs ' 
     70                    'configlet after after uninstall.') 
    7171 
    7272    def test_cssRegistry(self): 
     
    7474        css = tool.getResource('++resource++plonetabs.css') 
    7575        self.failUnless(css is None, 
    76             'There should be no ++resource++plonetabs.css stylesheets after' 
    77             ' uninstall.') 
     76                        'There should be no ++resource++plonetabs.css ' 
     77                        'stylesheets after uninstall.') 
    7878 
    7979    def test_jsRegistry(self): 
     
    8282        effects = tool.getResource('++resource++pt_effects.js') 
    8383        self.failUnless(effects is None, 
    84             'There should be no ++resource++pt_effects.js script after' 
    85             ' uninstall.') 
     84                        'There should be no ++resource++pt_effects.js script ' 
     85                        'after uninstall.') 
    8686 
    8787        dad = tool.getResource('++resource++sa_dragdrop.js') 
    8888        self.failUnless(dad is None, 
    89             'There should be no ++resource++sa_dragdrop.js script after' 
    90             ' uninstall.') 
     89                        'There should be no ++resource++sa_dragdrop.js script ' 
     90                        'after uninstall.') 
    9191 
    9292    def test_kssRegistry(self): 
     
    9494        kss = tool.getResource('++resource++plonetabs.kss') 
    9595        self.failUnless(kss is None, 
    96             'There should be no ++resource++plonetabs.kss sheets after' 
    97             ' uninstall.') 
     96                        'There should be no ++resource++plonetabs.kss sheets ' 
     97                        'after uninstall.') 
    9898        kss = tool.getResource('++resource++plonetabsmode.kss') 
    9999        self.failUnless(kss is None, 
    100             'There should be no ++resource++plonetabsmode.kss sheets after' 
    101             ' uninstall.') 
     100                        'There should be no ++resource++plonetabsmode.kss ' 
     101                        'sheets after uninstall.') 
    102102 
    103103    def test_propertiesTool(self): 
    104104        tool = getToolByName(self.portal, 'portal_properties') 
    105105        self.failUnless(hasattr(tool, 'tabs_properties'), 
    106             'There is no tabs_properties sheet in portal properties tool' 
    107             ' after uninstall.') 
     106                        'There is no tabs_properties sheet in portal ' 
     107                        'properties tool after uninstall.') 
    108108        titles = tool.tabs_properties.getProperty('titles', None) 
    109109        self.assertEquals(titles, 
    110             ('portal_tabs|Portal Tabs Configuration', 
    111              'portal_footer|Portal Footer Configuration'), 
    112             'titles plonetabs property was erased from portal_properties' 
    113             ' after uninstall.' 
    114         ) 
     110                          ('portal_tabs|Portal Tabs Configuration', 
     111                           'portal_footer|Portal Footer Configuration'), 
     112                          'titles plonetabs property was erased from ' 
     113                          'portal_properties after uninstall.' 
     114                          ) 
    115115 
    116116    def test_browserLayer(self): 
    117117        layers = [o.__name__ for o in registered_layers()] 
    118118        self.failIf('IPloneTabsProductLayer' in layers, 
    119             'There should be no quintagroup.plonetabs layer after uninstall.') 
     119                    'There should be no quintagroup.plonetabs layer after' 
     120                    ' uninstall.') 
    120121 
    121122 
  • quintagroup.plonetabs/trunk/quintagroup/plonetabs/tests/test_setup.py

    r3437 r3608  
    1616        tool = getToolByName(self.portal, 'portal_actionicons') 
    1717        icon_ids = [i._action_id for i in tool.listActionIcons()] 
    18         self.failUnless('plonetabs' in icon_ids, 
    19             'There is no plonetabs action icon in actionicons tool.') 
     18        self.failUnless('plonetabs' in icon_ids, 'There is no plonetabs action' 
     19                        'icon in actionicons tool.') 
    2020 
    2121    def test_controlPanel(self): 
     
    2323        action_ids = [a.id for a in tool.listActions()] 
    2424        self.failUnless('plonetabs' in action_ids, 
    25             'There is no plonetabs action in control panel.') 
     25                        'There is no plonetabs action in control panel.') 
    2626 
    2727    def test_cssRegistry(self): 
    2828        tool = getToolByName(self.portal, 'portal_css') 
    2929        css = tool.getResource('++resource++plonetabs.css') 
    30         self.failIf(css is None, 
    31             'There is no ++resource++plonetabs.css stylesheets registered.') 
     30        self.failIf(css is None, 'There is no ++resource++plonetabs.css ' 
     31                    'stylesheets registered.') 
    3232 
    3333    def test_jsRegistry(self): 
     
    3636        prototype = tool.getResource('++resource++prototype.js') 
    3737        self.failIf(prototype is None, 
    38             'There is no ++resource++prototype.js script registered.') 
     38                    'There is no ++resource++prototype.js script registered.') 
    3939        self.failUnless(prototype._data['enabled'], 
    40             '++resource++prototype.js script is disabled.') 
     40                        '++resource++prototype.js script is disabled.') 
    4141 
    4242        effects = tool.getResource('++resource++pt_effects.js') 
    4343        self.failIf(effects is None, 
    44             'There is no ++resource++pt_effects.js script registered.') 
     44                    'There is no ++resource++pt_effects.js script registered.') 
    4545 
    4646        dad = tool.getResource('++resource++sa_dragdrop.js') 
    47         self.failIf(dad is None, 
    48             'There is no ++resource++sa_dragdrop.js script registered.') 
     47        self.failIf(dad is None, 'There is no ++resource++sa_dragdrop.js ' 
     48                    'script registered.') 
    4949 
    5050    def test_kssRegistry(self): 
     
    5252        kss = tool.getResource('++resource++plonetabs.kss') 
    5353        self.failIf(kss is None, 
    54             'There is no ++resource++plonetabs.kss sheets registered.') 
     54                    'There is no ++resource++plonetabs.kss sheets registered.') 
    5555        kss = tool.getResource('++resource++plonetabsmode.kss') 
    56         self.failIf(kss is None, 
    57             'There is no ++resource++plonetabsmode.kss sheets registered.') 
     56        self.failIf(kss is None, 'There is no ++resource++plonetabsmode.kss ' 
     57                    'sheets registered.') 
    5858 
    5959    def test_propertiesTool(self): 
    6060        tool = getToolByName(self.portal, 'portal_properties') 
    61         self.failUnless(hasattr(tool, 'tabs_properties'), 
    62             'There is no tabs_properties sheet in portal properties tool.') 
     61        self.failUnless(hasattr(tool, 'tabs_properties'), 'There is no ' 
     62                        'tabs_properties sheet in portal properties tool.') 
    6363        titles = tool.tabs_properties.getProperty('titles', None) 
    6464        self.assertEquals(titles, 
    65             ('portal_tabs|Portal Tabs Configuration', 
    66              'portal_footer|Portal Footer Configuration'), 
    67             'Site properties was not setup properly' 
    68         ) 
     65                          ('portal_tabs|Portal Tabs Configuration', 
     66                           'portal_footer|Portal Footer Configuration'), 
     67                          'Site properties was not setup properly' 
     68                          ) 
    6969 
    7070    def test_browserLayerRegistered(self): 
    7171        layers = [o.__name__ for o in registered_layers()] 
    72         self.failUnless('IPloneTabsProductLayer' in layers, 
    73             'There should be quintagroup.ploentabs browser layer registered.') 
     72        self.failUnless('IPloneTabsProductLayer' in layers, 'There should be ' 
     73                        'quintagroup.ploentabs browser layer registered.') 
    7474 
    7575 
  • quintagroup.plonetabs/trunk/quintagroup/plonetabs/utils.py

    r3607 r3608  
    88 
    99 
    10 # TODO: Methods 'getViewletByName' and 'setupViewletByName' were copied 
    11 # from https://github.com/collective/collective.developermanual/blob/master/source/views/viewlets.rst#rendering-viewlet-by-name 
     10# TODO: Methods 'getViewletByName' and 'setupViewletByName' were copied from 
     11# https://github.com/collective/collective.developermanual/blob/master/source/ 
     12#                                 views/viewlets.rst#rendering-viewlet-by-name 
    1213# Better solution would be to use collective.fastview 
    1314# (http://svn.plone.org/svn/collective/collective.fastview/trunk/) 
     
    2728 
    2829        if v.provided == IViewlet: 
    29             # Note that we might have conflicting BrowserView with the same name, 
    30             # thus we need to check for provided 
     30            # Note that we might have conflicting BrowserView with the 
     31            # same name, thus we need to check for provided 
    3132            if v.name == name: 
    3233                return v 
     
    5960    except TypeError: 
    6061        # Bad constructor call parameters 
    61         raise RuntimeError("Unable to initialize viewlet %s. Factory method %s call failed." % (name, str(factory))) 
     62        raise RuntimeError("Unable to initialize viewlet %s. Factory " 
     63                           "method %s call failed." % (name, str(factory))) 
    6264 
    6365    return viewlet 
Note: See TracChangeset for help on using the changeset viewer.