Changeset 2942 in products


Ignore:
Timestamp:
Oct 29, 2010 9:57:34 AM (13 years ago)
Author:
mylan
Message:

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

Location:
quintagroup.plonegooglesitemaps/branches/blacklist/quintagroup/plonegooglesitemaps
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • quintagroup.plonegooglesitemaps/branches/blacklist/quintagroup/plonegooglesitemaps/content/sitemap.py

    r2538 r2942  
    22""" 
    33 
     4import string 
    45from zope.interface import implements, directlyProvides 
    56 
     
    159160        self.getField('pingTransitions').set(self, value) 
    160161 
     162    def setBlackout_list(self, value, **kw): 
     163        """Clean-up whitespaces and empty lines.""" 
     164        import pdb;pdb.set_trace() 
     165        val = filter(None, map(string.strip, value)) 
     166        self.getField('blackout_list').set(self, val) 
     167         
     168 
    161169atapi.registerType(Sitemap, PROJECTNAME) 
  • quintagroup.plonegooglesitemaps/branches/blacklist/quintagroup/plonegooglesitemaps/tests/testSitemaps.py

    r2741 r2942  
    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 
Note: See TracChangeset for help on using the changeset viewer.