Changeset 3162 in products


Ignore:
Timestamp:
Apr 20, 2011 2:11:46 PM (14 years ago)
Author:
vmaksymiv
Message:

pep8 fixes

Location:
quintagroup.plonecaptchas/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • quintagroup.plonecaptchas/trunk/quintagroup/plonecaptchas/Extensions/Install.py

    r2041 r3162  
    22from Products.CMFCore.utils import getToolByName 
    33REQUIRED = 'quintagroup.captcha.core' 
     4 
    45 
    56def install(self): 
     
    1314    # install plonecaptchas 
    1415    gs = getToolByName(self, 'portal_setup') 
    15     gs.runAllImportStepsFromProfile('profile-quintagroup.plonecaptchas:default') 
     16    profile = 'profile-quintagroup.plonecaptchas:default' 
     17    gs.runAllImportStepsFromProfile(profile) 
    1618    transaction.savepoint() 
     19 
    1720 
    1821def uninstall(self): 
    1922    portal_setup = getToolByName(self, 'portal_setup') 
    20     portal_setup.runAllImportStepsFromProfile('profile-quintagroup.plonecaptchas:uninstall', purge_old=False) 
     23    profile = 'profile-quintagroup.plonecaptchas:uninstall' 
     24    portal_setup.runAllImportStepsFromProfile(profile, purge_old=False) 
    2125    transaction.savepoint() 
  • quintagroup.plonecaptchas/trunk/quintagroup/plonecaptchas/tests/base.py

    r3161 r3162  
    2626 
    2727ptc.setupPloneSite() 
     28 
    2829 
    2930class NotInstalled(PloneSite): 
     
    6061        js_layer = None 
    6162        if getattr(ptc_setup, 'PLONE33', 0): 
    62             js_layer = JF_PROFILE_PREFIX+'33' 
     63            js_layer = JF_PROFILE_PREFIX + '33' 
    6364        elif getattr(ptc_setup, 'PLONE32', 0): 
    64             js_layer = JF_PROFILE_PREFIX+'31_32' 
     65            js_layer = JF_PROFILE_PREFIX + '31_32' 
    6566        elif getattr(ptc_setup, 'PLONE31', 0): 
    66             js_layer = JF_PROFILE_PREFIX+'31_32' 
     67            js_layer = JF_PROFILE_PREFIX + '31_32' 
    6768        elif getattr(ptc_setup, 'PLONE30', 0): 
    68             js_layer = JF_PROFILE_PREFIX+'30' 
     69            js_layer = JF_PROFILE_PREFIX + '30' 
    6970        if js_layer is not None: 
    7071            gs = getattr(portal, 'portal_setup', None) 
     
    7677    def tearDown(cls): 
    7778        ptc_setup._placefulTearDown() 
    78          
     79 
    7980 
    8081class TestCase(ptc.PloneTestCase): 
    8182    layer = Installed 
     83 
    8284 
    8385class TestCaseNotInstalled(ptc.PloneTestCase): 
     
    8890    layer = Installed 
    8991 
     92 
    9093class FunctionalTestCaseNotInstalled(ptc.FunctionalTestCase): 
    9194    layer = NotInstalled 
  • quintagroup.plonecaptchas/trunk/quintagroup/plonecaptchas/tests/testForms.py

    r3161 r3162  
    3434testPatch() 
    3535 
     36 
    3637class TestFormMixin(FunctionalTestCase): 
    3738 
     
    4243        addTestLayer(self) 
    4344        # Prepare form data 
    44         self.basic_auth = ':'.join((portal_owner,default_password)) 
     45        self.basic_auth = ':'.join((portal_owner, default_password)) 
    4546        self.form_url = '' 
    4647        self.form_method = "POST" 
     
    8485        self.form_method = "GET" 
    8586        response = self.publishForm().getBody() 
    86         patt = re.compile(IMAGE_PATT  % self.portal.absolute_url()) 
     87        patt = re.compile(IMAGE_PATT % self.portal.absolute_url()) 
    8788        match_obj = patt.search(response) 
    8889        img_url = match_obj.group(1) 
    8990 
    90         content_type = self.publish('/plone' + img_url).getHeader('content-type') 
     91        content_type = self.publish('/plone' + img_url).getHeader( 
     92                                                            'content-type') 
    9193        self.assertTrue(content_type.startswith('image'), 
    9294            "Wrong captcha image content type") 
    9395 
    9496    def testSubmitRightCaptcha(self): 
    95         key = getWord(int(parseKey(decrypt(self.captcha_key, self.hashkey))['key'])-1) 
     97        key = getWord(int(parseKey(decrypt( 
     98                self.captcha_key, self.hashkey))['key']) - 1) 
    9699        self.form_data['key'] = key 
    97          
     100 
    98101        response = self.publishForm().getBody() 
    99102        self.assertFalse(NOT_VALID.search(response)) 
     
    105108 
    106109    def testSubmitRightCaptchaTwice(self): 
    107         key = getWord(int(parseKey(decrypt(self.captcha_key, self.hashkey))['key'])-1) 
     110        key = getWord(int(parseKey(decrypt( 
     111                self.captcha_key, self.hashkey))['key']) - 1) 
    108112        self.form_data['key'] = key 
    109113 
     
    120124        self.portal['index_html'].allowDiscussion(True) 
    121125        self.form_url = '/index_html/discussion_reply_form' 
    122          
     126 
    123127    def getFormData(self): 
    124         return {'form.submitted' : '1', 
     128        return {'form.submitted': '1', 
    125129                'subject': 'testing', 
    126130                'Creator': portal_owner, 
    127131                'body_text': 'Text in Comment', 
    128132                'discussion_reply:method': 'Save', 
    129                 'form.button.form_submit' : 'Save'} 
     133                'form.button.form_submit': 'Save'} 
    130134 
    131135 
     
    141145 
    142146    def getFormData(self): 
    143         return {"last_visit:date" : str(DateTime()), 
    144                 "prev_visit:date" : str(DateTime()-1), 
    145                 "came_from_prefs" : "", 
    146                 "fullname" : "Tester", 
    147                 "username" : "tester", 
    148                 "email" : "tester@test.com", 
    149                 'form.button.Register':'Register', 
    150                 'form.submitted':'1'} 
     147        return {"last_visit:date": str(DateTime()), 
     148                "prev_visit:date": str(DateTime() - 1), 
     149                "came_from_prefs": "", 
     150                "fullname": "Tester", 
     151                "username": "tester", 
     152                "email": "tester@test.com", 
     153                'form.button.Register': 'Register', 
     154                'form.submitted': '1'} 
    151155 
    152156 
     
    158162        self.portal['index_html'].allowDiscussion(True) 
    159163        self.form_url = '/index_html/sendto_form' 
    160          
     164 
    161165    def getFormData(self): 
    162         return {'form.submitted' : '1', 
    163                 "send_to_address" : "recipient@test.com", 
    164                 "send_from_address" : "sender@test.com", 
     166        return {'form.submitted': '1', 
     167                "send_to_address": "recipient@test.com", 
     168                "send_from_address": "sender@test.com", 
    165169                'comment': 'Text in Comment', 
    166                 'form.button.Send' : 'Save'} 
     170                'form.button.Send': 'Save'} 
     171 
    167172 
    168173class TestContactInfo(TestFormMixin): 
     
    171176        TestFormMixin.afterSetUp(self) 
    172177        # preparation to form correct working 
    173         self.portal._updateProperty('email_from_address','manager@test.com') 
     178        self.portal._updateProperty('email_from_address', 'manager@test.com') 
    174179        self.logout() 
    175180        self.form_url = '/contact-info' 
    176          
     181 
    177182    def getFormData(self): 
    178         return {'form.submitted' : '1', 
    179                 "sender_fullname" : "tester", 
    180                 "sender_from_address" : "sender@test.com", 
     183        return {'form.submitted': '1', 
     184                "sender_fullname": "tester", 
     185                "sender_from_address": "sender@test.com", 
    181186                'subject': 'Subject', 
    182187                'message': 'Message', 
    183                 'form.button.Send' : 'Save'} 
     188                'form.button.Send': 'Save'} 
    184189 
    185190 
  • quintagroup.plonecaptchas/trunk/quintagroup/plonecaptchas/tests/testInstallation.py

    r3161 r3162  
    55 
    66from quintagroup.plonecaptchas.config import PRODUCT_NAME 
     7 
    78 
    89class TestInstallation(TestCase): 
     
    1819            for layer in LAYERS: 
    1920                self.assert_(layer.split('/')[0] in self.skins.objectIds(), 
    20                     '%s directory view not found in portal_skins after installation' % layer) 
     21                             '%s directory view not found in portal_skins '\ 
     22                             'after installation' % layer) 
    2123                self.assert_(layer in path, 
    2224                    '%s layer not found in %s' % (PRODUCT_NAME, skin)) 
     
    3133            path = map(str.strip, path.split(',')) 
    3234            for layer in LAYERS: 
    33                 self.assertTrue(not layer.split('/')[0] in self.skins.objectIds(), 
    34                     '%s directory view found in portal_skins after uninstallation' % layer) 
     35                self.assertTrue( 
     36                        not layer.split('/')[0] in self.skins.objectIds(), 
     37                                '%s directory view found in portal_skins '\ 
     38                                'after uninstallation' % layer) 
    3539                self.assert_(not layer in path, 
    36                     '%s layer found in %s skin after uninstallation' % (layer, skin)) 
     40                             '%s layer found in %s skin '\ 
     41                             'after uninstallation' % (layer, skin)) 
     42 
    3743 
    3844def test_suite(): 
  • quintagroup.plonecaptchas/trunk/setup.py

    r2064 r3162  
    66setup(name='quintagroup.plonecaptchas', 
    77      version=version, 
    8       description="quintagroup.plonecaptchas is simple captchas implementation for Plone, designed for validating human input in insecure forms.", 
     8      description="quintagroup.plonecaptchas is simple captchas " 
     9                  "implementation for Plone, designed for validating " 
     10                  "human input in insecure forms.", 
    911      long_description=open("README.txt").read() + "\n" + 
    1012                       open(os.path.join("docs", "HISTORY.txt")).read(), 
    11       # Get more strings from http://www.python.org/pypi?%3Aaction=list_classifiers 
    1213      classifiers=[ 
    1314        "Framework :: Plone", 
     
    4142      target = plone 
    4243      """, 
    43       paster_plugins = ["ZopeSkel"], 
     44      paster_plugins=["ZopeSkel"], 
    4445      ) 
Note: See TracChangeset for help on using the changeset viewer.