[Zope-PTK] content states

Steve Alexander steve@cat-box.net
Mon, 17 Jul 2000 16:02:56 +0100


Portal Content with Multiple States at once
-------------------------------------------

At present, content in the PTK stores its review_state as a single
string, accessible as the attribute review_state.

The attribute review_state is indexed in a portal's SiteIndex as a
FieldIndex.

I propose that the PTK's state handling be generalised so as to be able
to hold many different kinds of state concurrently, and retain the
current functionality of being able to search on content's state,
without an explosion in the number of fields indexed in the SiteIndex
catalog.

My proposal is this:

The review_state attribute is replaced with a content_state attribute.

The content_state attribute is a PersistentMapping. It stores the
"namespace" of each state as its keys, and the name of the state as its
values.

In the absence of any other states but the current review_state, the
content_state attribute would look like this: {'review':'public'} or
{'review':'pending'} or {'review':'private'}.

You can add other states to content by adding a key-value pair to the
mapping. (Two separate examples follow.)

  {'review':'public', 'feedback':'replied'}
  {'review':'pending', 'nuditycheck':'passed',
'violencecheck':'unchecked'}

An item of content's states are catalogued in the SiteIndex as a
KeywordIndex:

 "review:public feedback:replied"
 "review:pending nuditycheck:passed violencecheck:unchecked"

(Note: I need to check that the KeywordIndex is happy with a colon as
part of a single keyword).


I'm about to alter my own (slightly forked) version of PTK to try this
out. Assuming this works, any thoughts about making this an official
change?

--
Steve Alexander
Software Engineer
Cat-Box limited
http://www.cat-box.net