Changeset 3635 in products


Ignore:
Timestamp:
Mar 7, 2013 1:07:56 PM (9 years ago)
Author:
kroman0
Message:

Pep8,pyflakes

Location:
quintagroup.portlet.pfg/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • quintagroup.portlet.pfg/trunk/quintagroup/portlet/pfg/pfg.py

    r2816 r3635  
    1010from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile 
    1111from Products.CMFPlone import PloneMessageFactory as _ 
    12 from Products.CMFCore.utils import getToolByName 
    1312 
    14 from Products.PloneFormGen.interfaces import  IPloneFormGenForm 
     13from Products.PloneFormGen.interfaces import IPloneFormGenForm 
    1514from plone.app.vocabularies.catalog import SearchableTextSourceBinder 
    1615from plone.app.form.widgets.uberselectionwidget import UberSelectionWidget 
     16 
    1717 
    1818class IPFGPortlet(IPortletDataProvider): 
    1919 
    2020    target_form = schema.Choice( 
    21                     title=_(u"Target form"), 
    22                     description=_(u"Find the form which you want to be", 
    23                                    "displayed in portlet."), 
    24                     required=True, 
    25                     source=SearchableTextSourceBinder( 
    26                         {'object_provides':IPloneFormGenForm.__identifier__}, 
    27                         default_query='path:')) 
     21        title=_(u"Target form"), 
     22        description=_(u"Find the form which you want to be", 
     23                      "displayed in portlet."), 
     24        required=True, 
     25        source=SearchableTextSourceBinder( 
     26            {'object_provides': IPloneFormGenForm.__identifier__}, 
     27            default_query='path:')) 
     28 
    2829 
    2930class Assignment(base.Assignment): 
     
    3738        return _(u"PFG Portlet") 
    3839 
     40 
    3941class Renderer(base.Renderer): 
    4042 
     
    4446        base.Renderer.__init__(self, *args) 
    4547        self.portal_state = getMultiAdapter((self.context, self.request), 
    46                                        name=u'plone_portal_state') 
     48                                            name=u'plone_portal_state') 
    4749        self.portal = self.portal_state.portal() 
    48  
    4950 
    5051    def render(self): 
     
    7071        if form is not None: 
    7172            form_path = '/'.join(form.getPhysicalPath()[2:]) 
    72             form_view = self.portal.restrictedTraverse('%s/@@embedded' % form_path) 
     73            form_view = self.portal.restrictedTraverse( 
     74                '%s/@@embedded' % form_path) 
    7375            form_view.prefix = 'pfgportlet' 
    7476            return form_view() 
     77 
    7578 
    7679class AddForm(base.AddForm): 
     
    8588        return Assignment(target_form=data.get('target_form', '')) 
    8689 
     90 
    8791class EditForm(base.EditForm): 
    8892 
  • quintagroup.portlet.pfg/trunk/quintagroup/portlet/pfg/tests/base.py

    r2816 r3635  
    88 
    99ztc.installProduct('PloneFormGen') 
     10 
    1011 
    1112@onsetup 
     
    3738                             'quintagroup.portlet.pfg']) 
    3839 
     40 
    3941class TestCase(ptc.PloneTestCase): 
    4042    """Base class used for test cases 
    4143    """ 
    4244 
     45 
    4346class FunctionalTestCase(ptc.FunctionalTestCase): 
    4447    """Test case class used for functional (doc-)tests 
  • quintagroup.portlet.pfg/trunk/quintagroup/portlet/pfg/tests/test_portlet.py

    r2816 r3635  
    1414 
    1515 
    16 from Products.CMFCore.utils import getToolByName 
    17  
    1816class TestPFGPortlet(TestCase): 
    1917 
     
    2321 
    2422    def testPortletTypeRegistered(self): 
    25         portlet = getUtility(IPortletType, name='quintagroup.portlet.pfg.PFGPortlet') 
    26         self.assertEquals(portlet.addview, 'quintagroup.portlet.pfg.PFGPortlet') 
     23        portlet = getUtility( 
     24            IPortletType, name='quintagroup.portlet.pfg.PFGPortlet') 
     25        self.assertEquals( 
     26            portlet.addview, 'quintagroup.portlet.pfg.PFGPortlet') 
    2727 
    2828    def testInterfaces(self): 
     
    3232 
    3333    def testInvokeAddview(self): 
    34         portlet = getUtility(IPortletType, name='quintagroup.portlet.pfg.PFGPortlet') 
    35         mapping = self.portal.restrictedTraverse('++contextportlets++plone.leftcolumn') 
     34        portlet = getUtility( 
     35            IPortletType, name='quintagroup.portlet.pfg.PFGPortlet') 
     36        mapping = self.portal.restrictedTraverse( 
     37            '++contextportlets++plone.leftcolumn') 
    3638        for m in mapping.keys(): 
    3739            del mapping[m] 
    3840        addview = mapping.restrictedTraverse('+/' + portlet.addview) 
    3941 
    40         addview.createAndAdd(data={'target_form' : u"/test_form"}) 
     42        addview.createAndAdd(data={'target_form': u"/test_form"}) 
    4143 
    4244        self.assertEquals(len(mapping), 1) 
     
    5557        request = self.folder.REQUEST 
    5658        view = self.folder.restrictedTraverse('@@plone') 
    57         manager = getUtility(IPortletManager, name='plone.rightcolumn', context=self.portal) 
     59        manager = getUtility( 
     60            IPortletManager, name='plone.rightcolumn', context=self.portal) 
    5861        assignment = pfg.Assignment(target_form=u"/test_form") 
    5962 
    60         renderer = getMultiAdapter((context, request, view, manager, assignment), IPortletRenderer) 
     63        renderer = getMultiAdapter( 
     64            (context, request, view, manager, assignment), IPortletRenderer) 
    6165        self.failUnless(isinstance(renderer, pfg.Renderer)) 
     66 
    6267 
    6368class TestPFGPortletRenderer(TestCase): 
     
    6873        self.portal.invokeFactory('FormFolder', 'test_form') 
    6974 
    70     def renderer(self, context=None, request=None, view=None, manager=None, assignment=None): 
     75    def renderer(self, context=None, request=None, view=None, manager=None, 
     76                 assignment=None): 
    7177        context = context or self.folder 
    7278        request = request or self.folder.REQUEST 
    7379        view = view or self.folder.restrictedTraverse('@@plone') 
    74         manager = manager or getUtility(IPortletManager, name='plone.rightcolumn', context=self.portal) 
     80        manager = manager or getUtility( 
     81            IPortletManager, name='plone.rightcolumn', context=self.portal) 
    7582        assignment = assignment or pfg.Assignment(target_form="/test_form") 
    7683 
    77         return getMultiAdapter((context, request, view, manager, assignment), IPortletRenderer) 
    78  
     84        return getMultiAdapter((context, request, view, manager, assignment), 
     85                               IPortletRenderer) 
    7986 
    8087    def test_portletStyle(self): 
     88        assignment = pfg.Assignment(target_form="/test_form") 
    8189        renderer = self.renderer(context=self.portal, 
    8290                                 request=self.portal.REQUEST, 
    83                                  assignment=pfg.Assignment(target_form="/test_form")) 
     91                                 assignment=assignment) 
    8492        renderer = renderer.__of__(self.portal) 
    8593        renderer.update() 
     
    8997        self.failUnless('Comments' in renderer.render()) 
    9098 
     99 
    91100def test_suite(): 
    92101    from unittest import TestSuite, makeSuite 
  • quintagroup.portlet.pfg/trunk/setup.py

    r3632 r3635  
    88      description="Render form created by PloneFormGen package.", 
    99      long_description=open("README.txt").read() + "\n" + 
    10                        open(os.path.join("docs", "HISTORY.txt")).read(), 
    11       # Get more strings from http://www.python.org/pypi?%3Aaction=list_classifiers 
     10      open(os.path.join("docs", "HISTORY.txt")).read(), 
    1211      classifiers=[ 
    13         "Programming Language :: Python", 
    14         "Topic :: Software Development :: Libraries :: Python Modules", 
    15         ], 
     12          "Programming Language :: Python", 
     13          "Topic :: Software Development :: Libraries :: Python Modules", 
     14      ], 
    1615      keywords='portlet pfg', 
    1716      author='Quintagroup', 
Note: See TracChangeset for help on using the changeset viewer.