On 4/15/02 7:58 PM, "Ian Bicking" <[EMAIL PROTECTED]> wrote:
> On Mon, 2002-04-15 at 16:03, Jeffrey P Shell wrote:
>> A pattern I've been using for text handling has migrated through a few
>> refactorings to become a bag of Handlers. The main interfaces are::
>>
>> from Interface import Base, Attribute
>> class IHandlerResult(Base):
>> """
>> IHandler objects return IHandlerResult objects, which are
>> simple records that any text managing utility can use.
>> """
>> source = Attribute("The web-editable source code.")
>> cooked = Attribute("Rendered (cooked) code, used for display")
>> fullsource = Attribute(("The full source of the text, to be presented "
>> "to non-web clients"))
>> headers = Attribute("A mapping object of headers/values")
>>
>> class IHandler(Base):
>> """\
>> IHandler objects process text and return an IHandlerResult object.
>> """
>> def handle(text):
>> """\
>> Processes the incoming text and returns an IHandlerResult
>> object.
>> """
>
> I'm not entirely clear on the interface -- what are Base and Attribute?
> Oh... the new interface definition stuff?
Yes. I'm developing this in Zope right now, but I'm keeping my framework
rather framework-agnostic, so I should have a base to make a Webware
version. I initially started investigating Webware for very small dynamic
web applications that didn't need Zope's overhead, and that might still be a
worthy target for what I'm making this code for -- basically a very simple
document management system for small shops to use. The Interface package is
available separately at:
http://www.zope.org/Members/michel/Products/Interfaces/
> I assume all the meta-data like title and such is just kept as headers?
Yes. The basic HTML handlers I have do some special translation (ie -
turning keywords into a list of values, separated on the comma), and know
about the 'title' tag and places its content in the headers pile as well.
[SNIP]
> How do you deal with the conflict when person A edits a document via
> Word, then person B edits the same document via textarea, and then
> person A goes back? I assume the original Word style HTML document gets
> junked (or archived) and person A edits HTML generated from person B's
> edits? I guess that's fine as long as the Word style HTML document is a
> convenience for the Word user, not a necessity.
I haven't dealt with this issue for a long time. Most of the places we're
targeting with this app right now have one person responsible for
entering/uploading content. It's when you start dealing with multiple
people having potential responsibilities for content that you start running
into interesting technological choices - the easiest being "let them all
have their way and may God sort them out in the end" ;).
If you're just talking about conflicts (person A starts editing a document,
and while they're doing that, person B makes changes, then person A saves
their changes and overwrites person B's changes without either party
knowing), then that's a different issue. A solution I've used before, but
am not using now, is what's sometimes referred to as a "seatbelt" -
basically a revision marker for a document. The details of this are kindof
long, but it's basically putting a hidden value in a form, header, or meta
tag that marks the current revision at the time the user started editing the
document. When the user saves, that revision marker is modified on the
document itself, and the next time someone saves, the incoming marker and
the current marker are compared. There are issues with this, like allowing
the user to use the browsers 'back' button to go back and make changes
without throwing an error (the form on the 'back' page would have the older
revision marker).
HTTP 1.1 tries to solve this problem with Etags, which are similar. But
with HTTP 1.1, every time you save a document via PUT with a client and
server that support Etags and the "If-match" headers, the server sends back
the new Etag with every save. WebDAV tries to solve the issue with Write
Locks.
> You mentioned DAV, in what way are you using that? I've used mod_dav
> successfully enough, but I haven't seen how you'd take control of it in
> the same way I like to keep control over the other documents.
I'm not sure how to do this with WebWare at all, since I'm unsure how
extended HTTP commands get interpreted by WebKit/Webware.
> If you're willing to make your code public, I'd like to help flesh this
> out into something more reusable/library like, and start adding in
> different input/output types.
I'd like to release some of this stuff publicly, but the code is still
entangled. Now that Ski season is over <waaa!>, I'll see if I can make some
time this weekend to separate some parts out into a more Webware friendly
basic implementation. I still have a fair amount to do until I might be
able to get there. I'd really like to take a lot of my common patterns and
turn them into an collection like the various mx___ packages, but.. Time
time time. :/
--
Jeffrey P Shell
www.cuemedia.com
_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss