loops/organize/comment
2016-12-26 10:37:00 +01:00
..
__init__.py work in progress: comments; use new generic track view 2008-12-08 12:25:03 +00:00
base.py provide state icon with link to state transition form for comments 2014-04-09 13:07:39 +02:00
browser.py add 'delete' action to comments 2014-04-27 22:38:51 +02:00
comment_macros.pt show comment state for admin user 2014-04-09 10:37:23 +02:00
configure.zcml provide a comments overview listing, e.g. for moderation of comments 2014-04-19 10:48:45 +02:00
interfaces.py comment system extensions: make comments stateful as basis for moderated comments 2014-02-28 17:11:22 +01:00
loops_comment_de.dmp provide a comments overview listing, e.g. for moderation of comments 2014-04-19 10:48:45 +02:00
README.txt provide a comments overview listing, e.g. for moderation of comments 2014-04-19 10:48:45 +02:00
report.py descending sort order on time stamp 2014-04-19 11:46:19 +02:00
tests.py remove deprecated import from zope.testing 2016-12-26 10:37:00 +01: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']

  >>> from loops.organize.comment.base import commentStates
  >>> component.provideUtility(commentStates(), name='organize.commentStates')

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')


Reporting
=========

  >>> from loops.organize.comment.report import CommentsOverview


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

  >>> placefulTearDown()