Changeset 3002 in products


Ignore:
Timestamp:
Nov 11, 2010 5:26:00 PM (9 years ago)
Author:
mylan
Message:

Merged revisions 3948,3950-3951,3954-3964,3978-3981,3984-3992,4016-4018,4028-4037,4039 via svnmerge from
http://svn.quintagroup.com/products/quintagroup.plonegooglesitemaps/branches/blacklist

........

r3948 | mylan | 2010-10-21 16:34:22 +0300 (Thu, 21 Oct 2010) | 1 line


#228: Added IBlackoutFilterUtility interface with skeleton of id and path utilities with appropriate tests.

........

r3950 | mylan | 2010-10-22 11:58:53 +0300 (Fri, 22 Oct 2010) | 1 line


#228: Added tests for default id and path filters

........

r3951 | mylan | 2010-10-22 11:59:25 +0300 (Fri, 22 Oct 2010) | 1 line


#228: Added default id and path blackout filters

........

r3954 | mylan | 2010-10-22 14:38:20 +0300 (Fri, 22 Oct 2010) | 1 line


#228: Added TestFormDataProcessing? tests

........

r3955 | mylan | 2010-10-22 14:38:57 +0300 (Fri, 22 Oct 2010) | 1 line


#228: Added getBOFiltered method to sitemap common view

........

r3956 | mylan | 2010-10-22 15:17:40 +0300 (Fri, 22 Oct 2010) | 1 line


#228: Simplify blacklists filter utility tests

........

r3957 | mylan | 2010-10-22 15:23:24 +0300 (Fri, 22 Oct 2010) | 1 line


#228: Minor name updates in blackout list tests

........

r3958 | mylan | 2010-10-22 15:54:10 +0300 (Fri, 22 Oct 2010) | 1 line


#228: Added tests for relative path in path-filter

........

r3959 | mylan | 2010-10-22 15:54:50 +0300 (Fri, 22 Oct 2010) | 1 line


#228: Added relative path processing in default path-filter

........

r3960 | mylan | 2010-10-22 15:57:18 +0300 (Fri, 22 Oct 2010) | 1 line


#228: Fixed name of the relative path filtering test

........

r3961 | mylan | 2010-10-25 13:51:32 +0300 (Mon, 25 Oct 2010) | 1 line


#228: Fix relative path filter tests and utility

........

r3962 | mylan | 2010-10-25 17:38:55 +0300 (Mon, 25 Oct 2010) | 1 line


#228: Fixed default Path filter

........

r3963 | mylan | 2010-10-25 17:49:27 +0300 (Mon, 25 Oct 2010) | 1 line


#228: Added request to extended list of args for a filter utility.

........

r3964 | mylan | 2010-10-25 17:50:57 +0300 (Mon, 25 Oct 2010) | 1 line


#228: Fixed rewrited blackout filter utility and functionality.

........

r3978 | mylan | 2010-10-28 19:26:11 +0300 (Thu, 28 Oct 2010) | 1 line


#228: Remake filter utility to multiadapter, fix tests

........

r3979 | mylan | 2010-10-28 19:57:24 +0300 (Thu, 28 Oct 2010) | 1 line


#228: Fix filter naming overhead, fix tests

........

r3980 | mylan | 2010-10-28 21:10:51 +0300 (Thu, 28 Oct 2010) | 1 line


#228: Fix overhead in parsing of filter arguments. Added test (breakage yet)

........

r3981 | mylan | 2010-10-29 12:57:34 +0300 (Fri, 29 Oct 2010) | 1 line


#228: Add blackout_list value clean-up on editing sitemap

........

r3984 | mylan | 2010-10-29 13:53:54 +0300 (Fri, 29 Oct 2010) | 1 line


#228: Update description of blackout list, remove preparations to filtering

........

r3985 | mylan | 2010-10-29 16:14:29 +0300 (Fri, 29 Oct 2010) | 1 line


#228: Added doc tests bases

........

r3986 | mylan | 2010-10-29 16:53:41 +0300 (Fri, 29 Oct 2010) | 1 line


#228: Added basic doctests of filtering

........

r3987 | mylan | 2010-10-29 16:57:40 +0300 (Fri, 29 Oct 2010) | 1 line


#228: Minor fixes of filtering doctests.

........

r3988 | mylan | 2010-11-01 13:31:04 +0200 (Mon, 01 Nov 2010) | 1 line


#228: Added doctests of id, path, default filters

........

r3989 | mylan | 2010-11-01 15:20:03 +0200 (Mon, 01 Nov 2010) | 1 line


#228: Fixed default behavior filter doctests

........

r3990 | mylan | 2010-11-01 15:20:51 +0200 (Mon, 01 Nov 2010) | 1 line


#228: Added example of new filter creation in doctests

........

r3991 | mylan | 2010-11-01 15:35:10 +0200 (Mon, 01 Nov 2010) | 1 line


#228: Clean-up, simplify filters doctests

........

r3992 | mylan | 2010-11-01 15:39:55 +0200 (Mon, 01 Nov 2010) | 1 line


#228: Force to show all doctests failures.

........

r4016 | mylan | 2010-11-05 14:19:46 +0200 (Fri, 05 Nov 2010) | 1 line


#228: Fix incorrect black_list field editing in tests

........

r4017 | mylan | 2010-11-05 14:21:35 +0200 (Fri, 05 Nov 2010) | 1 line


#228: minor docstring update for getBOFiltered method

........

r4018 | mylan | 2010-11-05 14:23:56 +0200 (Fri, 05 Nov 2010) | 1 line


#228: Remake filterOut method of into generator for default filters

........

r4028 | mylan | 2010-11-08 13:58:10 +0200 (Mon, 08 Nov 2010) | 1 line


#228: Added Plone v3.0 support

........

r4029 | mylan | 2010-11-08 16:35:22 +0200 (Mon, 08 Nov 2010) | 1 line


#228: Fixed tests issues

........

r4030 | mylan | 2010-11-08 16:49:28 +0200 (Mon, 08 Nov 2010) | 1 line


#228: Fixed ran of tearing down testing layers

........

r4031 | mylan | 2010-11-08 17:04:01 +0200 (Mon, 08 Nov 2010) | 1 line


#228: Fixed differencies in forms for plone<=3.1 and plone>3.1

........

r4032 | mylan | 2010-11-10 13:48:47 +0200 (Wed, 10 Nov 2010) | 1 line


#228: Switch to use collective.testcaselayer

........

r4033 | mylan | 2010-11-10 13:49:09 +0200 (Wed, 10 Nov 2010) | 1 line


#228: Fix doctest testcase

........

r4034 | mylan | 2010-11-10 14:34:17 +0200 (Wed, 10 Nov 2010) | 1 line


#228: Fixed list of required packages for testing

........

r4035 | mylan | 2010-11-11 12:29:06 +0200 (Thu, 11 Nov 2010) | 1 line


#228: remake filters to generators

........

r4036 | mylan | 2010-11-11 15:16:53 +0200 (Thu, 11 Nov 2010) | 1 line


#228: reviewed explanation, correct grammar for filters doctest

........

r4037 | mylan | 2010-11-11 15:19:24 +0200 (Thu, 11 Nov 2010) | 1 line


#228: updated histroy, bumped version to 1.6.0

........

r4039 | mylan | 2010-11-11 19:03:01 +0200 (Thu, 11 Nov 2010) | 1 line


#228:Fixed typo in doctests

........

Location:
quintagroup.plonegooglesitemaps/trunk
Files:
9 edited
4 copied

Legend:

Unmodified
Added
Removed
  • quintagroup.plonegooglesitemaps/trunk

    • Property svn:mergeinfo
      •  

        old new  
         1/quintagroup.plonegooglesitemaps/branches/blacklist:2909-3000 
        12/quintagroup.plonegooglesitemaps/branches/migratioin_product:2826-2839 
        23/quintagroup.plonegooglesitemaps/branches/plone4:2549-2553 
    • Property svnmerge-integrated changed from /quintagroup.plonegooglesitemaps/branches/blacklist:1-3923 /quintagroup.plonegooglesitemaps/branches/migratioin_product:1-3879 /quintagroup.plonegooglesitemaps/branches/plone4:1-3593 /quintagroup.plonegooglesitemaps/branches/test_refactoring:1-3576 to /quintagroup.plonegooglesitemaps/branches/blacklist:1-4040 /quintagroup.plonegooglesitemaps/branches/migratioin_product:1-3879 /quintagroup.plonegooglesitemaps/branches/test_refactoring:1-3576 /quintagroup.plonegooglesitemaps/branches/plone4:1-3593
  • quintagroup.plonegooglesitemaps/trunk/docs/HISTORY.txt

    r2848 r3002  
    11Changelog 
    22========= 
     3 
     41.6.0 (2010-10-11) 
     5------------------ 
     6 
     7* Replaced hardcoded filtering to pluggable architecture, 
     8  with default "id" and "path" filters. 
     9  [mylan] 
     10* Updated tests, added filtering doctests, 
     11  [mylan] 
     12 
    313 
    4141.5.6 (2010-09-22) 
  • quintagroup.plonegooglesitemaps/trunk/quintagroup/plonegooglesitemaps/browser/commonview.py

    r2742 r3002  
    11from string import find 
    22from zope.interface import implements, Interface, Attribute 
     3from zope.component import queryMultiAdapter 
    34 
    45from Acquisition import aq_inner, aq_parent 
     
    78 
    89from quintagroup.plonegooglesitemaps import qPloneGoogleSitemapsMessageFactory as _ 
     10from quintagroup.plonegooglesitemaps.interfaces import IBlackoutFilter 
    911from quintagroup.plonegooglesitemaps.browser.utils import additionalURLs, applyOperations 
    1012 
     
    6870        result = [] 
    6971        objects = self.getFilteredObjects() 
    70         blackout_list = self.context.getBlackout_list() 
    7172        reg_exps = self.context.getReg_exp() 
    7273 
    73         brain_url_map = applyOperations([ob for ob in objects  
    74             if (ob.getId not in blackout_list)], 
    75             reg_exps) 
    76  
     74        brain_url_map = applyOperations(self.getBOFiltered(objects), reg_exps) 
    7775        # Prepare dictionary for view 
    7876        for url, b in brain_url_map.items(): 
     
    8280        self.num_entries = len(result) 
    8381        return result 
     82 
     83    def getBOFiltered(self, objects): 
     84        """Return black-out filtered objects 
     85          Every record in blackout_list filter should follow the spec: 
     86            [<filter name>:]<filter arguments> 
     87          For example: 
     88          1|  index.html 
     89          2|  id:index.html 
     90          3|  path:/folder_1_level/obj_in_folder 
     91          4|  path:./folder_near_sitemap/obj_in_folder 
     92          5|  foo_filter:arg-1, arg-2 
     93          
     94          1->used default "id" filter - remove "index.html" objects; 
     95          2->explicit "id" filter - remove "index.html" objects; 
     96          3->"path" filter - remove /folder_1_level/obj_in_folder object, 
     97              path from the root of the plone site; 
     98          4->same to 3), but path get from the folder, where sitemap is located; 
     99          5->filter name is "foo_filter" (must be registered IBlackoutFilter, 
     100             named "foo_filter"), which get filter arguments: arg-1, arg-2 
     101          
     102          Detailed explanation look in filters.txt doctest. 
     103        """  
     104        blackout_list = self.context.getBlackout_list() 
     105        for frec in blackout_list: 
     106            fspec = frec.split(":", 1) 
     107            fargs = fspec.pop() 
     108            fname = fspec and fspec.pop() or "id" 
     109            fengine = queryMultiAdapter((self.context, self.request), 
     110                          interface=IBlackoutFilter, name=fname) 
     111            if fengine: 
     112                objects = list(fengine.filterOut(objects, fargs)) 
     113        return objects 
    84114 
    85115    def updateRequest(self): 
  • quintagroup.plonegooglesitemaps/trunk/quintagroup/plonegooglesitemaps/configure.zcml

    r2746 r3002  
    99    <include package="quintagroup.catalogupdater" /> 
    1010    <include package="archetypes.schemaextender" /> 
     11    <include package="plone.browserlayer" /> 
    1112 
    1213    <five:registerPackage package="." initialize=".initialize" /> 
     
    2930        /> 
    3031 
     32    <!-- Register default filters --> 
     33    <adapter 
     34        for="* 
     35             zope.publisher.interfaces.browser.IBrowserRequest" 
     36        factory=".filters.IdBlackoutFilter" 
     37        name="id" 
     38        permission="zope.Public" /> 
     39 
     40    <adapter 
     41        for="* 
     42             zope.publisher.interfaces.browser.IBrowserRequest" 
     43        factory=".filters.PathBlackoutFilter" 
     44        name="path" 
     45        permission="zope.Public" /> 
     46 
     47 
    3148</configure> 
  • quintagroup.plonegooglesitemaps/trunk/quintagroup/plonegooglesitemaps/content/sitemap.py

    r2538 r3002  
    22""" 
    33 
     4import string 
    45from zope.interface import implements, directlyProvides 
    56 
     
    6162        widget=atapi.LinesWidget( 
    6263            label=_(u"Blackout entries"), 
    63             description=_(u"The objects with the given ids will not be " \ 
    64                           u"included in sitemap."), 
     64            description=_( 
     65              u"Objects which match filter condition will be excluded from the sitemap." \ 
     66              u"Every record should follow the spec: [<filter name>:]<filter arguments>."\ 
     67              u" By default there are \"id\" and \"path\" filters (\"id\" used if filter"\ 
     68              u" name not specified). There is possibility to add new filters. "\ 
     69              u"Look into README.txt of the quintagroup.plonegooglesitemaps package."), 
    6570        ), 
    6671    ), 
     
    159164        self.getField('pingTransitions').set(self, value) 
    160165 
     166    def setBlackout_list(self, value, **kw): 
     167        """Clean-up whitespaces and empty lines.""" 
     168        val = filter(None, map(string.strip, value)) 
     169        self.getField('blackout_list').set(self, val) 
     170         
     171 
    161172atapi.registerType(Sitemap, PROJECTNAME) 
  • quintagroup.plonegooglesitemaps/trunk/quintagroup/plonegooglesitemaps/interfaces.py

    r2841 r3002  
    2121class IGoogleSitemapsLayer(ILocalBrowserLayerType): 
    2222    """Marker interface that defines browser layer for the package.""" 
     23 
     24class IBlackoutFilter(Interface): 
     25    """Base interface for filter adapter.""" 
     26 
     27    def filterOut(fdata, fargs): 
     28        """Filter out fdata by passed arguments in kwargs. 
     29            * fdata (list/tuple) - data for filtering 
     30              (list of catalog brains). 
     31            * fargs (string) - is key for filtering. 
     32           Return list/tuple like object without filtered out items. 
     33        """ 
     34 
  • quintagroup.plonegooglesitemaps/trunk/quintagroup/plonegooglesitemaps/tests/base.py

    r2841 r3002  
    3232from quintagroup.plonegooglesitemaps.interfaces import IGoogleSitemapsLayer 
    3333 
     34from collective.testcaselayer.ptc import BasePTCLayer, ptc_layer 
     35 
    3436quintagroup.plonegooglesitemaps.config.testing = 1 
    3537quintagroup.plonegooglesitemaps.config.UPDATE_CATALOG = True 
     
    3739PRODUCT = 'quintagroup.plonegooglesitemaps' 
    3840 
    39 @onsetup 
    40 def setup_product(): 
    41     """Set up the package and its dependencies. 
    4241 
    43     The @onsetup decorator causes the execution of this body to be 
    44     deferred until the setup of the Plone site testing layer. We could 
    45     have created our own layer, but this is the easiest way for Plone 
    46     integration tests. 
     42class NotInstalled(BasePTCLayer): 
     43    """Initialize the package, without installation into portal 
    4744    """ 
    48     fiveconfigure.debug_mode = True 
    49     import quintagroup.plonegooglesitemaps 
    50     zcml.load_config('configure.zcml', quintagroup.plonegooglesitemaps) 
    51     zcml.load_config('overrides.zcml', quintagroup.plonegooglesitemaps) 
    52     fiveconfigure.debug_mode = False 
     45    def afterSetUp(self): 
     46        fiveconfigure.debug_mode = True 
     47        import quintagroup.plonegooglesitemaps 
     48        zcml.load_config('configure.zcml', quintagroup.plonegooglesitemaps) 
     49        zcml.load_config('overrides.zcml', quintagroup.plonegooglesitemaps) 
     50        fiveconfigure.debug_mode = False 
    5351 
    54     ztc.installPackage(PRODUCT) 
     52        if not ptc.PLONE31: 
     53            ztc.installProduct("plone.browserlayer") 
    5554 
    56 setup_product() 
    57 ptc.setupPloneSite( products=(PRODUCT,)) 
     55        ztc.installPackage(PRODUCT) 
     56 
     57 
     58class Installed(BasePTCLayer): 
     59    """ Install product into the portal 
     60    """ 
     61    def afterSetUp(self): 
     62        if not ptc.PLONE31: 
     63            self.addProduct("plone.browserlayer") 
     64        self.addProduct(PRODUCT) 
     65 
     66class UnInstalled(BasePTCLayer): 
     67    """ UnInstall product from the portal 
     68    """ 
     69    def afterSetUp(self): 
     70        qi = getattr(self.portal, 'portal_quickinstaller', None) 
     71        qi.uninstallProducts(products=[PRODUCT,]) 
     72 
     73 
     74NotInstalledLayer = NotInstalled([ptc_layer,]) 
     75InstalledLayer = Installed([NotInstalledLayer,]) 
     76UnInstalledLayer = UnInstalled([InstalledLayer,]) 
    5877 
    5978 
     
    6786        five's registerPackage directive not recognized on module initializing. 
    6887    """ 
    69     layer = PloneSite 
    70  
    7188    def afterSetUp(self): 
    7289        self.loginAsPortalOwner() 
     
    8198 
    8299    def beforeTearDown(self): 
    83         if self.orig_mobile_ifaces is not None: 
     100        if getattr(self, 'orig_mobile_ifaces', None) is not None: 
    84101            mobilesitemapview.MOBILE_INTERFACES = self.orig_mobile_ifaces 
    85102 
    86103 
    87 class TestCase(MixinTestCase, ptc.PloneTestCase): 
    88     """ For unit tests """ 
     104class TestCaseNotInstalled(ptc.PloneTestCase): 
     105    layer = NotInstalledLayer 
     106 
     107class TestCase(ptc.PloneTestCase, MixinTestCase): 
     108    layer = InstalledLayer 
     109 
     110    def afterSetUp(self): 
     111        ptc.PloneTestCase.afterSetUp(self) 
     112        MixinTestCase.afterSetUp(self) 
     113 
     114    def beforeTearDown(self): 
     115        ptc.PloneTestCase.beforeTearDown(self) 
     116        MixinTestCase.beforeTearDown(self) 
    89117 
    90118 
    91 class FunctionalTestCase(MixinTestCase, ptc.FunctionalTestCase): 
    92     """ For functional tests """ 
     119class TestCaseUnInstalled(ptc.PloneTestCase): 
     120    layer = UnInstalledLayer 
     121 
     122 
     123class FunctionalTestCaseNotInstalled(ptc.FunctionalTestCase): 
     124    layer = NotInstalledLayer 
     125 
     126class FunctionalTestCase(ptc.FunctionalTestCase, MixinTestCase): 
     127    layer = InstalledLayer 
    93128 
    94129    def afterSetUp(self): 
    95         super(FunctionalTestCase, self).afterSetUp() 
     130        ptc.FunctionalTestCase.afterSetUp(self) 
     131        MixinTestCase.afterSetUp(self) 
    96132        self.auth = "%s:%s" % (portal_owner, default_password) 
    97133 
     134    def beforeTearDown(self): 
     135        ptc.FunctionalTestCase.beforeTearDown(self) 
     136        MixinTestCase.beforeTearDown(self) 
     137 
     138class FunctionalTestCaseUnInstalled(ptc.FunctionalTestCase): 
     139    layer = UnInstalledLayer 
  • quintagroup.plonegooglesitemaps/trunk/quintagroup/plonegooglesitemaps/tests/testSitemaps.py

    r2741 r3002  
    7676        self.assertEqual(isinstance(wftrans, atapi.DisplayList), True) 
    7777        self.assertEqual("simple_publication_workflow#publish" in wftrans.keys(), True) 
     78 
     79    def testSettingBlackout(self): 
     80        bolist = ["path:./el1  ","   ",""," id:index.html  ","index_html"] 
     81        expect = ("path:./el1","id:index.html","index_html") 
     82        self.contentSM.edit(blackout_list=bolist) 
     83        value = self.contentSM.getBlackout_list() 
     84        self.assertTrue(value == expect, "Blackout list was not cleaned "\ 
     85             "up from whitespaces: %s" % str(value)) 
    7886 
    7987 
  • quintagroup.plonegooglesitemaps/trunk/setup.py

    r2842 r3002  
    33import os 
    44 
    5 version = '1.5.6' 
     5version = '1.6.0' 
     6 
     7tests_require=['zope.testing', 
     8               'collective.testcaselayer'] 
    69 
    710setup(name='quintagroup.plonegooglesitemaps', 
     
    2629      install_requires=[ 
    2730          'setuptools', 
     31          'plone.browserlayer', 
    2832          'quintagroup.canonicalpath>=0.7', 
    2933          'quintagroup.catalogupdater', 
     
    3135          # -*- Extra requirements: -*- 
    3236      ], 
     37      tests_require=tests_require, 
     38      extras_require=dict(tests=tests_require), 
    3339      entry_points=""" 
    3440      # -*- Entry points: -*- 
     
    3743      target = plone 
    3844      """, 
    39       setup_requires=["PasteScript"], 
    4045      paster_plugins = ["ZopeSkel"], 
    4146      ) 
Note: See TracChangeset for help on using the changeset viewer.