• Vice Squad

  • Fwd: Fwd: plone.marquis now quills.syndication

    from "Derek Richardson" on Dec 29, 2007 03:33 PM
    I've been mulling this over. The difficulty is that Vice is more
    flexible than the current Quills links portlet can display. With Vice,
    you can have an arbitrary number of named feeds of arbitrary formats.
    For instance, you might have no rss 1 feed and two atom feeds, say one
    of which requires authentication and the other doesn't. I wouldn't
    mind having a portlet that displays all the available feeds on a
    specified object - in fact, that's a very good idea that we hadn't
    thought of. However, I like the snazzy graphics in the Quills links
    portlet but I'm having trouble figuring out how to reconcile the
    static nature of images with the dynamic, flexible Vice feeds config.
    Ideas?
    
    Derek
    
    
    On Dec 22, 2007 3:17 PM, Tim Hicks <tim@...> wrote:
    >
    > Tim Hicks wrote:
    >
    > >> More importantly, Tim, I need your input on what to do with the
    > >> portlet.
    > >
    > > Presumably you mean the 'quillslinks' portlet at
    > > <http://dev.plone.org/collective/browser/quills.app/trunk/quills/app/portlets/quillslinks.py>
    > > (and associated template).
    > >
    > >> Remove it?
    > >
    > > Only if Vice is already providing something equivalent, which I don't
    > > think it is... yet.
    > >
    > >> Move it to quills.syndication and hook it up to
    > >> Vice?
    > >
    > > I think the first step should probably be moving to quills.syndication.
    > >  However, this seems like a useful portlet for general users of outbound
    > > syndication in Plone.  As such, it may well make sense for it to move
    > > all the way into plone.app.syndication.outbound.
    > >
    > > I think to do so would require some modifications to the portlet
    > > implementation, and possibly to Vice code.  Specifically, presumably it
    > > is easy enough to use a Vice api to get hold of a list of feed urls and
    > > names/titles/whatever for a content object, and then have the portlet
    > > display them.  However, is there a way to recurse/acquire up the object
    > > hierarchy to find the appropriate content object for which to fetch
    > > feeds?  That is, for Quills, we require that when viewing an
    > > IWeblogEntry, feeds are displayed for the containing IWeblog object.  I
    > > guess the question is: is there a generalizable way of getting hold of
    > > appropriate feed listings from an arbitrary context?  Hopefully that
    > > makes sense.
    >
    > Thinking out loud...
    >
    > How about a portlet (in Vice) has a configuration option for a list
    > (LinesField, in AT parlance) of TAL statements that return objects for
    > which all available feeds should be displayed.  By default, this would
    > simply be 'context'.  For Quills' WeblogEntry objects, this would be
    > something along the lines of 'context/getWeblog'.
    >
    > Thoughts?
    >
    >
    > Tim
    >
    >
    > --
    > Archive: http://www.openplans.org/projects/vice/lists/vice-squad/archive/2007/12/1198354673204
    >
    > To unsubscribe send an email with subject unsubscribe to vice-dev@....  Please contact vice-dev-manager@... for questions.
    >
    
    Thread Outline:
  • Re: Fwd: Fwd: plone.marquis now quills.syndication

    from Tim Hicks on Dec 29, 2007 07:09 PM
    Derek Richardson wrote:
    > I've been mulling this over. The difficulty is that Vice is more
    > flexible than the current Quills links portlet can display. With Vice,
    > you can have an arbitrary number of named feeds of arbitrary formats.
    > For instance, you might have no rss 1 feed and two atom feeds, say one
    > of which requires authentication and the other doesn't.
    
    Ooh!  I didn't realise that you could have some authenticated and some
    not :).  That sounds gooood.
    
    > I wouldn't
    > mind having a portlet that displays all the available feeds on a
    > specified object - in fact, that's a very good idea that we hadn't
    > thought of.
    
    Good.
    
    > However, I like the snazzy graphics in the Quills links
    > portlet but I'm having trouble figuring out how to reconcile the
    > static nature of images with the dynamic, flexible Vice feeds config.
    > Ideas?
    
    Hmm.  I still don't know the Vice code very well.  Presumably there is a
    way to get a list of all outbound feeds, and from each feed to get
    identify what format it is in.  Presumably we can setup the portlet to
    loop over all feeds, generate an href for each, and optionally embed the
    appropriate image for the feed format.  The alt attribute should
    probably then have the feed title.
    
    If you have lots of slightly different (say) atom feeds setup for an
    object, a portlet of this sort might not be very good for visually
    distinguishing between them, but as a default implementation, it doesn't
    sound too bad to me.
    
    If that sounds ok, I'm willing to implement this based on the current
    Quills implementation.
    
    
    Tim
    
    • Re: Fwd: Fwd: plone.marquis now quills.syndication

      from "Derek Richardson" on Dec 29, 2007 10:37 PM
      On Dec 29, 2007 7:09 PM, Tim Hicks <tim@...> wrote:
      > Derek Richardson wrote:
      > > I've been mulling this over. The difficulty is that Vice is more
      > > flexible than the current Quills links portlet can display. With Vice,
      > > you can have an arbitrary number of named feeds of arbitrary formats.
      > > For instance, you might have no rss 1 feed and two atom feeds, say one
      > > of which requires authentication and the other doesn't.
      >
      > Ooh!  I didn't realise that you could have some authenticated and some
      > not :).  That sounds gooood.
      
      Well, RSS readers use basic auth, so you have it to have it set up
      correctly. But we're doing this at gatech using CAS authentication and
      the 'published url' field.
      
      > > I wouldn't
      > > mind having a portlet that displays all the available feeds on a
      > > specified object - in fact, that's a very good idea that we hadn't
      > > thought of.
      >
      > Good.
      >
      > > However, I like the snazzy graphics in the Quills links
      > > portlet but I'm having trouble figuring out how to reconcile the
      > > static nature of images with the dynamic, flexible Vice feeds config.
      > > Ideas?
      >
      > Hmm.  I still don't know the Vice code very well.  Presumably there is a
      > way to get a list of all outbound feeds, and from each feed to get
      > identify what format it is in.  Presumably we can setup the portlet to
      > loop over all feeds, generate an href for each, and optionally embed the
      > appropriate image for the feed format.  The alt attribute should
      > probably then have the feed title.
      
      Yep. Look at the code in p.a.s.o in the browser directory that
      displays feeds. I think it is viewfeed.py and view_feed.pt.
      
      > If you have lots of slightly different (say) atom feeds setup for an
      > object, a portlet of this sort might not be very good for visually
      > distinguishing between them, but as a default implementation, it doesn't
      > sound too bad to me.
      
      As a default impl, it sounds fine to me, too.
      
      > If that sounds ok, I'm willing to implement this based on the current
      > Quills implementation.
      
      w00t! Have at it! We'll roll it into Vice 1.0a4. ;)
      
      Derek
      
      • Re: Fwd: Fwd: plone.marquis now quills.syndication

        from Tim Hicks on Jan 01, 2008 04:05 PM
        Derek Richardson wrote:
        > On Dec 29, 2007 7:09 PM, Tim Hicks <tim@...> wrote:
        >> Derek Richardson wrote:
        >>> I've been mulling this over. The difficulty is that Vice is more
        >>> flexible than the current Quills links portlet can display. With Vice,
        >>> you can have an arbitrary number of named feeds of arbitrary formats.
        >>> For instance, you might have no rss 1 feed and two atom feeds, say one
        >>> of which requires authentication and the other doesn't.
        >> Ooh!  I didn't realise that you could have some authenticated and some
        >> not :).  That sounds gooood.
        > 
        > Well, RSS readers use basic auth, so you have it to have it set up
        > correctly. But we're doing this at gatech using CAS authentication and
        > the 'published url' field.
        
        What does the published_url field do?
        
        [...]
        
        >> If that sounds ok, I'm willing to implement this based on the current
        >> Quills implementation.
        > 
        > w00t! Have at it! We'll roll it into Vice 1.0a4. ;)
        
        See my checkin at <http://dev.plone.org/collective/changeset/56326>.
        Advice on appropriate tests would be welcome.
        
        
        Tim
        
        • Re: Fwd: Fwd: plone.marquis now quills.syndication

          from "Derek Richardson" on Jan 01, 2008 09:52 PM
          On Jan 1, 2008 4:05 PM, Tim Hicks <tim@...> wrote:
          > Derek Richardson wrote:
          > > On Dec 29, 2007 7:09 PM, Tim Hicks <tim@...> wrote:
          > >> Derek Richardson wrote:
          > >>> I've been mulling this over. The difficulty is that Vice is more
          > >>> flexible than the current Quills links portlet can display. With Vice,
          > >>> you can have an arbitrary number of named feeds of arbitrary formats.
          > >>> For instance, you might have no rss 1 feed and two atom feeds, say one
          > >>> of which requires authentication and the other doesn't.
          > >> Ooh!  I didn't realise that you could have some authenticated and some
          > >> not :).  That sounds gooood.
          > >
          > > Well, RSS readers use basic auth, so you have it to have it set up
          > > correctly. But we're doing this at gatech using CAS authentication and
          > > the 'published url' field.
          >
          > What does the published_url field do?
          
          It's the url that used for the links to the feed. If it's not filled
          in, the actual local url is used. If it is filled in, it is used,
          instead of the local url. Allows a level of indirection, which solves
          most problems. ;) Specifically, allows you to route through feedburner
          or a external auth system or anything else that might be useful.
          
          > >> If that sounds ok, I'm willing to implement this based on the current
          > >> Quills implementation.
          > >
          > > w00t! Have at it! We'll roll it into Vice 1.0a4. ;)
          >
          > See my checkin at <http://dev.plone.org/collective/changeset/56326>.
          > Advice on appropriate tests would be welcome.
          
          Looked at it briefly. Will try it as soon as I can get to it.
          
          Currently, the tests simply look on the page for the links in the
          viewlet. Your new tests (functional only, right now) should simply put
          a portlet on a page and try to access the links and see if the feed is
          correct. I hate to inflict our tests on you, as they are messy, but,
          if you're willing to wade through them, I'd love to have tests written
          for the portlet.
          
          Derek
          
          • Re: Fwd: Fwd: plone.marquis now quills.syndication

            from Tim Hicks on Jan 04, 2008 10:38 AM
            Derek Richardson wrote:
            
            >> See my checkin at <http://dev.plone.org/collective/changeset/56326>.
            >> Advice on appropriate tests would be welcome.
            > 
            > Looked at it briefly. Will try it as soon as I can get to it.
            > 
            > Currently, the tests simply look on the page for the links in the
            > viewlet. Your new tests (functional only, right now) should simply put
            > a portlet on a page and try to access the links and see if the feed is
            > correct. I hate to inflict our tests on you, as they are messy, but,
            > if you're willing to wade through them, I'd love to have tests written
            > for the portlet.
            
            Wow, I'm struggling to understand the test framework in place for
            p.[a.]s.o.  I started off subclassing testFunctional.TestPloneFeeds, but
            that turned out to be over-kill as it comes with test methods for all
            the different feed types.
            
            I'm pasting the test module I've written so far.  It doesn't work yet
            because I don't know how to write the 'setupFeedConfigFor' method and
            have run out of time to work on this at the moment.  For some reason,
            tests are taking about 12-15 minutes to run on my laptop, which makes
            progress here *very* slow :(.
            
            Can someone advise on what I should have for the setupFeedConfigFor
            method (which would be analogous to the TestPloneFeeds.feed method, only
            without doing it through the adminBrowser but rather normal code)?
            
            
            Tim
            
            p.s.  I forgot to mention, before I started doing any of this work for
            the feedlinks portlet, I was seeing failing tests for plone.syndication.
            
            
            # Zope imports
            from zope.component import getUtility
            from zope.app.container.interfaces import INameChooser
            from Products.Five import zcml
            try:
              from Products.Five.testbrowser import Browser
            except ImportError:
              from zope.testbrowser.testing import Browser
            
            # Plone imports
            from plone.portlets.interfaces import IPortletAssignmentMapping
            from plone.app.portlets.utils import assignment_mapping_from_key
            from Products.CMFCore.utils import getToolByName
            from Products.PloneTestCase.PloneTestCase import FunctionalTestCase
            
            # Local test imports
            from testFunctional import TestPloneFeeds
            from testFunctional import createTestEmptyDir
            
            # Local implementation imports
            from plone.app.syndication.outbound.portlets import feedlinks
            
            
            class TestFeedLinkPortlet(FunctionalTestCase):
                """Test case for the FeedLinks portlet.
                """
            
                def afterSetUp(self):
                    zcml.load_site()
                    self.loginAsPortalOwner()
                    self.folder = folder = createTestEmptyDir(self.portal, 'atom')
                    self.browser = self._getBrowser()
                    self.setupFeedConfigFor(folder, name='fooname', format='atom')
                    self.addPortletTo(folder)
            
                def _getBrowser(self):
                    return Browser()
            
                def setupFeedConfigFor(self, folder, format):
                    # XXX Help!
                    pass
            
                def addPortletTo(self, folder):
                    left = getUtility(IPortletManager, name='plone.leftcolumn')
                    folder_left_portlets = getMultiAdapter((folder, left),
                                                           IPortletAssignmentMapping)
                    assignment = feedlinks.Assignment()
                    chooser = INameChooser(folder_left_portlets)
                    folder_left_portlets[chooser.chooseName(None, assignment)] =
            assignment
            
                def test_PortletPresent(self):
                    self.browser.open(self.folder.absolute_url())
                    self.failUnless('portletFeedLinks' in self.browser.contents)
            
            
            def test_suite():
                from unittest import TestSuite, makeSuite
                suite = TestSuite()
                suite.addTest(makeSuite(TestFeedLinkPortlet))
                return suite
            
            • Re: Fwd: Fwd: plone.marquis now quills.syndication

              from "Derek Richardson" on Jan 07, 2008 12:44 PM
              On Jan 4, 2008 10:37 AM, Tim Hicks <tim@...> wrote:
              > Derek Richardson wrote:
              >
              > >> See my checkin at <http://dev.plone.org/collective/changeset/56326>.
              > >> Advice on appropriate tests would be welcome.
              > >
              > > Looked at it briefly. Will try it as soon as I can get to it.
              > >
              > > Currently, the tests simply look on the page for the links in the
              > > viewlet. Your new tests (functional only, right now) should simply put
              > > a portlet on a page and try to access the links and see if the feed is
              > > correct. I hate to inflict our tests on you, as they are messy, but,
              > > if you're willing to wade through them, I'd love to have tests written
              > > for the portlet.
              >
              > Wow, I'm struggling to understand the test framework in place for
              > p.[a.]s.o.  I started off subclassing testFunctional.TestPloneFeeds, but
              > that turned out to be over-kill as it comes with test methods for all
              > the different feed types.
              
              Yah, sorry, it *is* ugly.
              
              > I'm pasting the test module I've written so far.  It doesn't work yet
              > because I don't know how to write the 'setupFeedConfigFor' method and
              > have run out of time to work on this at the moment.  For some reason,
              
              You should copy p.a.s.o.tests.testFunctional.TestPloneFeeds.feed()
              
              > tests are taking about 12-15 minutes to run on my laptop, which makes
              > progress here *very* slow :(.
              
              Combinatorial explosion of the testing procedure. Yes, they take a
              long time even on my quadcore. Needs to be fixed.0
              
              > Can someone advise on what I should have for the setupFeedConfigFor
              > method (which would be analogous to the TestPloneFeeds.feed method, only
              > without doing it through the adminBrowser but rather normal code)?
              
              Ah, now I see the problem. Why no admin browser? You can use it. If ya
              wanna really configure a feed by hand, look at the feed() method in:
              
              http://dev.plone.org/collective/browser/Vice/trunk/plone.syndication.outbound/plone/syndication/outbound/tests/basefunctional.py?rev=51711
              
              We moved away from under-the-covers to the admin browser to achieve
              greater test coverage.
              
              >
              > Tim
              >
              > p.s.  I forgot to mention, before I started doing any of this work for
              > the feedlinks portlet, I was seeing failing tests for plone.syndication.
              
              
              Yep. p.s.o tests fail. As long as p.a.s.o tests pass, we're golden.
              p.s.o gets thoroughly exercised in the p.a.s.o tests, but we just
              aren't supporting z3 atm - writing p.s.o tests that work in z2 without
              plone and z3 was just too hard and no on was itching.
              
              >
              > # Zope imports
              > from zope.component import getUtility
              > from zope.app.container.interfaces import INameChooser
              > from Products.Five import zcml
              > try:
              >   from Products.Five.testbrowser import Browser
              > except ImportError:
              >   from zope.testbrowser.testing import Browser
              >
              > # Plone imports
              > from plone.portlets.interfaces import IPortletAssignmentMapping
              > from plone.app.portlets.utils import assignment_mapping_from_key
              > from Products.CMFCore.utils import getToolByName
              > from Products.PloneTestCase.PloneTestCase import FunctionalTestCase
              >
              > # Local test imports
              > from testFunctional import TestPloneFeeds
              > from testFunctional import createTestEmptyDir
              >
              > # Local implementation imports
              > from plone.app.syndication.outbound.portlets import feedlinks
              >
              >
              > class TestFeedLinkPortlet(FunctionalTestCase):
              >     """Test case for the FeedLinks portlet.
              >     """
              >
              >     def afterSetUp(self):
              >         zcml.load_site()
              >         self.loginAsPortalOwner()
              >         self.folder = folder = createTestEmptyDir(self.portal, 'atom')
              >         self.browser = self._getBrowser()
              >         self.setupFeedConfigFor(folder, name='fooname', format='atom')
              >         self.addPortletTo(folder)
              >
              >     def _getBrowser(self):
              >         return Browser()
              >
              >     def setupFeedConfigFor(self, folder, format):
              >         # XXX Help!
              >         pass
              >
              >     def addPortletTo(self, folder):
              >         left = getUtility(IPortletManager, name='plone.leftcolumn')
              >         folder_left_portlets = getMultiAdapter((folder, left),
              >                                                IPortletAssignmentMapping)
              >         assignment = feedlinks.Assignment()
              >         chooser = INameChooser(folder_left_portlets)
              >         folder_left_portlets[chooser.chooseName(None, assignment)] =
              > assignment
              >
              >     def test_PortletPresent(self):
              >         self.browser.open(self.folder.absolute_url())
              >         self.failUnless('portletFeedLinks' in self.browser.contents)
              >
              >
              > def test_suite():
              >     from unittest import TestSuite, makeSuite
              >     suite = TestSuite()
              >     suite.addTest(makeSuite(TestFeedLinkPortlet))
              >     return suite
              >
              >
              > --
              > Archive: http://www.openplans.org/projects/vice/lists/vice-squad/archive/2008/01/1199461104158
              >
              > To unsubscribe send an email with subject unsubscribe to vice-dev@....  Please contact vice-dev-manager@... for questions.
              >
              
              • tests take too long (was Re: Fwd: Fwd: plone.marquis now quills.syndication)

                from Tim Hicks on Jan 08, 2008 05:53 PM
                Derek Richardson wrote:
                
                >> tests are taking about 12-15 minutes to run on my laptop, which makes
                >> progress here *very* slow :(.
                > 
                > Combinatorial explosion of the testing procedure. Yes, they take a
                > long time even on my quadcore. Needs to be fixed.0
                
                Ok, I've managed to figure out how to setup the feed config - i.e. my 
                problem in my last email - but now I'm really bumping up against this 
                issue of *long* test runs.
                
                I need to run my tests repeatedly to keep trying things out, adding more 
                test coverage, etc.  However, each test run is currently taking circa 
                20-25 minutes to run.  As someone with limited time to spend on this, 
                and time that only comes up in chunks of a few hours, this is pretty 
                debilitating from the point of view of making it possible to contribute :(.
                
                In order to skirt around the problem, I figured it would be simple 
                enough to just comment out the tests in p.a.s.o.tests.testFunctional as 
                these seem to be the ones that take up all the time.  However, when I 
                commented out the 'test_suite' function in that module and then tried 
                running the tests, I ended up getting HTTPError exceptions raised from 
                my feedlinks tests as well as the migration tests.  For example:
                
                Error in test testMigration 
                (plone.app.syndication.outbound.tests.test_migration
                .TestMigration)
                Traceback (most recent call last):
                   File 
                "C:\vice\parts\zope2\lib\python\Testing\ZopeTestCase\profiler.py", line 9
                8, in __call__
                   File 
                "c:\vice\src\plone.app.syndication.outbound\plone\app\syndication\outboun
                d\tests\test_migration.py", line 124, in testMigration
                   File 
                "c:\vice\src\plone.app.syndication.outbound\plone\app\syndication\outboun
                d\tests\test_migration.py", line 158, in createData
                   File "C:\vice\parts\zope2\lib\python\zope\testbrowser\browser.py", 
                line 586, i
                n click
                   File "C:\vice\parts\zope2\lib\python\zope\testbrowser\browser.py", 
                line 375, i
                n _clickSubmit
                   File "C:\vice\parts\zope2\lib\python\mechanize\_mechanize.py", line 
                177, in op
                en
                   File "C:\vice\parts\zope2\lib\python\mechanize\_mechanize.py", line 
                219, in _m
                ech_open
                HTTPError: HTTP Error 500: Internal Server Error
                
                
                Now, this is all beyond my area of knowledge, I'm afraid.  Still, I find 
                it very strange that tests in one TestCase class are apparently 
                dependent on those in another being run.
                
                At root, can anyone help me figure out how to either (a) disable the 
                long running tests, (b) make them not long running?
                
                
                Cheers,
                
                
                Tim
                
                • Re: tests take too long (was Re: Fwd: Fwd: plone.marquis now quills.syndication)

                  from "Derek Richardson" on Apr 29, 2008 10:58 AM
                  On Tue, Jan 8, 2008 at 6:53 PM, Tim Hicks <tim@...> wrote:
                  > Derek Richardson wrote:
                  > > > tests are taking about 12-15 minutes to run on my laptop, which makes
                  > > > progress here *very* slow :(.
                  > > >
                  > >
                  > > Combinatorial explosion of the testing procedure. Yes, they take a
                  > > long time even on my quadcore. Needs to be fixed.0
                  > >
                  >
                  >  Ok, I've managed to figure out how to setup the feed config - i.e. my
                  > problem in my last email - but now I'm really bumping up against this issue
                  > of *long* test runs.
                  >
                  >  I need to run my tests repeatedly to keep trying things out, adding more
                  > test coverage, etc.  However, each test run is currently taking circa 20-25
                  > minutes to run.  As someone with limited time to spend on this, and time
                  > that only comes up in chunks of a few hours, this is pretty debilitating
                  > from the point of view of making it possible to contribute :(.
                  > ...
                  >  At root, can anyone help me figure out how to either (a) disable the long
                  > running tests, (b) make them not long running?
                  
                  Sorry it took so long to address this. I've cut test time by > half,
                  they run in 2 minutes on my macbook pro. Even coverage reports now run
                  in < 20 mins. Still too long, but better.
                  
                  The tests are like plone - they're not slow, they do a lot! The
                  problem is that these are all ftests, not unit tests. I mean, it's
                  good to have lots of good ftests, they just take a while to run.
                  
                  Short-term solution: put your tests in a different test file and run
                  it with "bin/instance test -s vice.plone.outbound -t <name of test
                  file>". This will only run *your* test, instead of all the tests.
                  It'll be nice and zippy and you can simply run all the tests once,
                  before you ci, to make sure nothing is broken anywhere else.
                  
                  Derek