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

Fixed code according with pylint, pyflakes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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): 
Note: See TracChangeset for help on using the changeset viewer.