[Zope-PTK] content states

Dan L. Pierson dan@sol.control.com
Tue, 18 Jul 2000 09:05:30 -0400 (EDT)


Steve Alexander writes:
 >   def getStateFor(self, name):
 >   # Returns the state for a particular name
 >   # Example: obj.getStateFor('review') returns 'published'
 >   # Returns None if there is no state for that name.
 >   
 >   def changeState(self, name, newstate, reason=''):
 >   # Changes the state associated with name to newstate.
 >   # A reason may be recorded or auditing purposes.
 >   # sometimes the auditing subsystems will insist on
 >   # having a reason.
 >   # A new name:state gets created if none existed before.
 >   
 >   def delState(self, name, reason=''):
 >   # Like changeState, but removes the name
 >   # from the mapping.

IMHO, there's an unnecessary inconsistency between the first name and
the later two.  I'd make all of them end in your choice of 'State' or
'StateFor' because they all require a state name argument.

 > Would namespaces be useful? I think so, if other subsystems get to
 > contribute to an object's state. Therefore, instead of the two-part
 > name:state as suggested above, we could have a three-part
 > namespace:name-state. For example, "reviewing:review-published".

Hmmm, I don't know.  It's superficially attractive, but it may well be 
unnecessary complexity...