loops/organize/comment
2019-04-26 17:13:59 +02:00
..
__init__.py work in progress: comments; use new generic track view 2008-12-08 12:25:03 +00:00
base.py implement comments/discussion facility 2008-12-08 18:13:20 +00:00
browser.py comments: restrict to logged-in users; improve validateion 2012-09-17 09:28:42 +02:00
comment_macros.pt comments: restrict to logged-in users; improve validateion 2012-09-17 09:28:42 +02:00
configure.zcml control comments via loops root options; use TrackDetails as base class for displaying comments instead of TrackView 2008-12-09 12:05:16 +00:00
README.txt control comments via loops root options; use TrackDetails as base class for displaying comments instead of TrackView 2008-12-09 12:05:16 +00:00
tests.py fix tests/doctests according to current ZTK and BlueBream versions 2019-04-26 17:13:59 +02:00

===============================================================
loops - Linked Objects for Organization and Processing Services
===============================================================

  ($Id$)

Let's do some basic setup

  >>> from zope.app.testing.setup import placefulSetUp, placefulTearDown
  >>> site = placefulSetUp(True)
  >>> from zope import component, interface

and set up a simple loops site with a concept manager and some concepts
(with all the type machinery, what in real life is done via standard
ZCML setup):

  >>> from loops.organize.setup import SetupManager
  >>> component.provideAdapter(SetupManager, name='organize')

  >>> from loops.tests.setup import TestSite
  >>> t = TestSite(site)
  >>> concepts, resources, views = t.setup()


Comments - Managed by a Tracking Storage
========================================

  >>> loopsRoot = concepts.getLoopsRoot()
  >>> records = loopsRoot.getRecordManager()

More setup
----------

In order to be able to login and store favorites and other personal data
we have to prepare our environment. We need some basic adapter registrations,
and a pluggable authentication utility with a principal folder.

  >>> from loops.organize.tests import setupObjectsForTesting
  >>> setupData = setupObjectsForTesting(site, concepts)
  >>> johnC = setupData.johnC

We also assign a document as a target to the home node so that we are able
to assign comments to this document.

  >>> home = views['home']
  >>> home.target = resources['d001.txt']

Creating comments
-----------------

  >>> from loops.browser.node import NodeView
  >>> from loops.tests.auth import TestRequest
  >>> view = NodeView(home, TestRequest())

  >>> from loops.organize.comment.browser import CreateComment

  >>> input = dict(subject='My comment', text='Comment text')
  >>> fc = CreateComment(view, TestRequest(form=input))
  >>> fc.update()
  False


Viewing comments
----------------

  >>> from loops.organize.comment.browser import CommentsView
  >>> comments = CommentsView(home, TestRequest())

  >>> items = list(comments.allItems())
  >>> items
  [<Comment ['27', 1, '33', '... ...']:
    {'text': 'Comment text', 'subject': 'My comment'}>]
  >>> item = items[0]
  >>> item.subject, item.timeStamp, item.user['title']
  ('My comment', u'... ...', u'john')


Fin de partie
=============

  >>> placefulTearDown()