Changeset 3403 in products


Ignore:
Timestamp:
Apr 3, 2012 11:40:34 AM (8 years ago)
Author:
potar
Message:

Fixed code according with pylint, pyflakes

Location:
quintagroup.plonetabs/branches/tests
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • quintagroup.plonetabs/branches/tests/quintagroup/plonetabs/Extensions/Install.py

    r3402 r3403  
    5454        portal_setup.runAllImportStepsFromProfile('profile-%s' % extension_id, 
    5555                                                  purge_old=False) 
    56         product_name = extension_id.split(':')[0] 
    5756        transaction.savepoint() 
  • quintagroup.plonetabs/branches/tests/quintagroup/plonetabs/browser/plonetabs.py

    r3402 r3403  
    2424from Products.statusmessages.interfaces import IStatusMessage 
    2525 
    26 from quintagroup.plonetabs.config import * 
     26from quintagroup.plonetabs.config import PROPERTY_SHEET, FIELD_NAME 
    2727from quintagroup.plonetabs import messageFactory as _ 
    2828from interfaces import IPloneTabsControlPanel 
     
    6161        postback = True 
    6262        errors = {} 
    63         context = aq_inner(self.context) 
    6463 
    6564        form = self.request.form 
    66         action = form.get("action", "") 
    6765        submitted = form.get('form.submitted', False) 
    6866 
     
    430428        actions = getMultiAdapter((self.context, self.request), 
    431429                                   name=u'plone_context_state').actions() 
     430        actions_tabs = [] 
    432431        try: 
    433432            # Plone 4 and higher 
    434433            import plone.app.upgrade 
    435             if 'portal_tabs' in actions: 
    436                 actions_tabs = actions['portal_tabs'] 
    437             else: 
    438                 actions_tabs = [] 
     434            plone.app.upgrade  # pyflakes 
    439435        except ImportError: 
    440436            actions_tabs = actions 
     437        if not actions_tabs and 'portal_tabs' in actions: 
     438            actions_tabs = actions['portal_tabs'] 
    441439 
    442440        portal_tabs_view = getMultiAdapter((self.context, self.request), 
     
    540538 
    541539        if obj_id not in portal.objectIds(): 
    542             raise KSSExplicitError, \ 
    543                   _(u"Object with '${id}' id doesn't exist in portal root.", 
    544                     mapping={'id': obj_id}) 
     540            raise KSSExplicitError("Object with %s id doesn't" +\ 
     541                                   " exist in portal root." % obj_id) 
    545542 
    546543        if checked == '1': 
     
    624621        # if not errors find (or create) category and set action to it 
    625622        ksscore = self.getCommandSet('core') 
    626         kssplone = self.getCommandSet('plone') 
    627623        if not errors: 
    628624            action = self.addAction(cat_name, data) 
     
    753749        html_id = '%s%s%s' % (self.prefix, id, self.sufix) 
    754750        ksscore = self.getCommandSet('core') 
    755         kssplone = self.getCommandSet('plone') 
    756751        if not errors: 
    757752            action = self.updateAction(id, cat_name, data) 
     
    978973            category = self.getActionCategory(cat_name) 
    979974        except Exception: 
    980             raise KSSExplicitError, \ 
    981                   _(u"'${cat_name}' action category does not exist.", 
    982                     mapping={'cat_name': cat_name}) 
     975            raise KSSExplicitError(u"%s action category does not exist." %\ 
     976                                   cat_name) 
    983977 
    984978        # extract action id from given list item id on client 
     
    988982            action = category[action_id] 
    989983        except Exception: 
    990             raise KSSExplicitError, \ 
    991                   _(u"No '${id}' action in '${cat_name}' category.", 
    992                     mapping={'id': action_id, 'cat_name': cat_name}) 
     984            raise KSSExplicitError("No %s action in %s category." %\ 
     985                                              (action_id, cat_name)) 
    993986 
    994987        return (action_id, category, action) 
     
    10341027                                           selector) 
    10351028        if collapsed is not None: 
    1036             data = command.addParam('collapsed', collapsed) 
     1029            command.addParam('collapsed', collapsed) 
    10371030        if expanded is not None: 
    1038             data = command.addParam('expanded', expanded) 
     1031            command.addParam('expanded', expanded) 
    10391032        if collapse is not None: 
    1040             data = command.addParam('collapse', collapse) 
     1033            command.addParam('collapse', collapse) 
    10411034 
    10421035    def kss_resetForm(self, selector): 
    10431036        """KSS Server command to reset form on client""" 
    1044         command = self.commands.addCommand('plonetabs-resetForm', selector) 
    10451037 
    10461038    def kss_blur(self, selector): 
    10471039        """KSS Server command to remove focus from input""" 
    1048         command = self.commands.addCommand('plonetabs-blur', selector) 
     1040        self.commands.addCommand('plonetabs-blur', selector) 
    10491041 
    10501042    def kss_replaceOrInsert(self, selector, parentSelector, html, 
     
    10551047        command = self.commands.addCommand('plonetabs-replaceOrInsert', 
    10561048            selector) 
    1057         data = command.addParam('selector', parentSelector) 
    1058         data = command.addHtmlParam('html', html) 
    1059         data = command.addParam('withKssSetup', withKssSetup) 
     1049        command.addParam('selector', parentSelector) 
     1050        command.addHtmlParam('html', html) 
     1051        command.addParam('withKssSetup', withKssSetup) 
    10601052        if alternativeHTML: 
    1061             data = command.addHtmlParam('alternativeHTML', alternativeHTML) 
     1053            command.addHtmlParam('alternativeHTML', alternativeHTML) 
    10621054        if selectorType: 
    1063             data = command.addParam('selectorType', selectorType) 
     1055            command.addParam('selectorType', selectorType) 
    10641056        if position: 
    1065             data = command.addParam('position', position) 
     1057            command.addParam('position', position) 
    10661058        if positionSelector: 
    1067             data = command.addParam('positionSelector', positionSelector) 
     1059            command.addParam('positionSelector', positionSelector) 
    10681060        if positionSelectorType: 
    1069             data = command.addParam('positionSelectorType', 
    1070                                     positionSelectorType) 
     1061            command.addParam('positionSelectorType', 
     1062                              positionSelectorType) 
    10711063 
    10721064    def kss_issueMessage(self, message, msgtype="info"): 
     
    10831075    def kss_timeout(self, selector, **kw): 
    10841076        """KSS Server command to execute plonetabs-timeout client action""" 
    1085         command = self.commands.addCommand('plonetabs-timeout', selector, **kw) 
     1077        self.commands.addCommand('plonetabs-timeout', selector, **kw) 
    10861078 
    10871079    def renderViewlet(self, manager, name): 
  • quintagroup.plonetabs/branches/tests/quintagroup/plonetabs/tests/base.py

    r3402 r3403  
    88from  Testing import ZopeTestCase as ztc 
    99from  Products.Five import zcml 
    10 from  Products.Five import fiveconfigure 
    1110from Products.CMFCore.utils import getToolByName 
    12 from Products.CMFCore.interfaces import IAction, IActionCategory 
    1311from Products.CMFCore.ActionInformation import Action, ActionCategory 
    1412from  Products.PloneTestCase import PloneTestCase as ptc 
  • quintagroup.plonetabs/branches/tests/quintagroup/plonetabs/tests/selenium/zopeconfig.py

    r3402 r3403  
    44    KSSSeleniumTestCase 
    55 
    6 from plone.app.kss.demo.zopeconfig import PloneSiteLayer, \ 
    7     LoggedInManagerLayer, LoggedInUserLayer, IResource 
     6from plone.app.kss.demo.zopeconfig import LoggedInManagerLayer, IResource 
    87 
    98 
  • quintagroup.plonetabs/branches/tests/quintagroup/plonetabs/tests/test_controlpanel.py

    r3402 r3403  
    66 
    77from Products.CMFCore.utils import getToolByName 
    8 from Products.CMFCore.ActionInformation import Action, ActionCategory 
     8from Products.CMFCore.ActionInformation import Action 
    99 
    1010from quintagroup.plonetabs import messageFactory as _ 
     
    7373        # Revert PloneTestCase's optimization 
    7474        # because this breaks our test 
     75        #### pyflakes.scripts.pyflakes, modified: 
     76        ## - return array of warnings instead of printing them 
     77        ## - honour pyflakes:ignore comments 
    7578        def __init__(self, text): 
    7679            self.text = text 
     
    7881                self._v_compiled = getEngine().compile(text) 
    7982        from Products.CMFCore.Expression import Expression 
     83 
    8084        optimized__init__ = Expression.__init__ 
    8185        Expression.__init__ = __init__ 
     
    8690        self.assertEquals(len(errors.keys()), 4, 
    8791            'validateActionFields method is not working properly.') 
     92        #### pyflakes.scripts.pyflakes ends. 
    8893 
    8994    def test_processErrors(self): 
  • quintagroup.plonetabs/branches/tests/quintagroup/plonetabs/tests/test_erase.py

    r3402 r3403  
    66from Testing import ZopeTestCase as ztc 
    77 
    8 from zope.component import getSiteManager 
    98from zope.app.component.hooks import setHooks, setSite 
    109 
     
    108107 
    109108    def test_browserLayer(self): 
    110         sm = getSiteManager(self.portal) 
    111109        layers = [o.__name__ for o in registered_layers()] 
    112110        self.failIf('IPloneTabsProductLayer' in layers, 
  • quintagroup.plonetabs/branches/tests/quintagroup/plonetabs/tests/test_setup.py

    r3402 r3403  
    11import unittest 
    2  
    3 from zope.component import getSiteManager 
    42 
    53from plone.browserlayer.utils import registered_layers 
     
    7169 
    7270    def test_browserLayerRegistered(self): 
    73         sm = getSiteManager(self.portal) 
    7471        layers = [o.__name__ for o in registered_layers()] 
    7572        self.failUnless('IPloneTabsProductLayer' in layers, 
  • quintagroup.plonetabs/branches/tests/setup.py

    r3402 r3403  
    3333      install_requires=[ 
    3434          'setuptools', 
    35           'plone.browserlayer', 
    3635          # -*- Extra requirements: -*- 
    3736      ], 
Note: See TracChangeset for help on using the changeset viewer.