loops/loops/organize/comment
2024-11-24 10:13:04 +01:00
..
__init__.py start working on Python3-compatible version 2024-09-23 17:30:48 +02:00
base.py organize: Python3 fixes for: comment, job, stateful 2024-09-25 23:37:00 +02:00
browser.py minor fix in organize.comment set up 2024-11-24 10:13:04 +01:00
comment_macros.pt start working on Python3-compatible version 2024-09-23 17:30:48 +02:00
configure.zcml start working on Python3-compatible version 2024-09-23 17:30:48 +02:00
interfaces.py organize: Python3 fixes for: comment, job, stateful 2024-09-25 23:37:00 +02:00
loops_comment_de.dmp start working on Python3-compatible version 2024-09-23 17:30:48 +02:00
README.txt organize: Python3 fixes for: comment, job, stateful 2024-09-25 23:37:00 +02:00
report.py start working on Python3-compatible version 2024-09-23 17:30:48 +02:00
tests.py avoid testing deprecation errors with Python3.12 2024-10-02 12:54:34 +02:00

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

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', '... ...']:
    {'subject': 'My comment', 'text': 'Comment text'}>]
  >>> item = items[0]
  >>> item.subject, item.timeStamp, item.user['title']
  ('My comment', '... ...', 'john')


Reporting
=========

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


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

  >>> placefulTearDown()