[Zope-dev] ZPatterns question
Christian Scholz
cs@comlounge.net
Wed, 3 Jan 2001 23:06:11 +0100
Hi!
Actually should answer to these posts... ;-)
On Thu, Dec 28, 2000 at 03:11:37PM -0500, Steve Spicklemire wrote:
>
> Hi Christian,
>
> Well, nobody else answered that I saw... so I'll take a crack
> at your questions....
>
> >>>>> "CS" == Christian Scholz <cs@comlounge.net> writes:
>
> CS> Hi there!
>
> CS> Finally I managed to get a basic understanding of how to do
> CS> things with ZPatterns ;-) So seems quite cool :) (and
> CS> hopefully I find some time to write some basic howto about it)
>
> CS> But I have some little questions:
>
> CS> 1. Is it possible to retrieve the set of known IDs from a
> CS> specialist? Or would I need to add my own method to it which
> CS> does this (and change it accordingly if I switch to another
> CS> storage method)?
>
> If you store persistently you can use the Rack's method:
>
> "defaultRack.getPersistentItemIDs()"
Thanks, also found this out in the meanwhile.
> but a couple of notes: 1) this returns a BTree object, not a simple
> list, so you can't iterate through it in DTML. You'll need to copy
> it to a simple list for that.. and 2) If you change to a different
> storage you'll need to create your own method (ZSQL Method?). What I've
> found is that if you have a large number of objects you'll either want
> to query a Catalog, or an SQL database to get Ids that match some criteria
> that limit the number of hits to something that makes sense to display
> in a browser.
I am now using some method I create inside the specialist for it.
> CS> 2. Is it planned to provide something like a virtual folder
> CS> which acts like a normal object manager but is controlled via
> CS> ZPatterns (so actually something like Folder with Customizer
> CS> Support just without the "anchor" in ZODB. (would also
> CS> require some mechanism asked for in 1.)
>
> Hmmm... I'm not sure what you're after here. Why not just use
> a Specialist? In what sense do you want it to be virtual?
Well, virtual in the sense as a specialist is no real folder but can
provide content from different sources. Thus what I mean is some mechanism
which emulates objectIds() etc. so it looks to the user (and the ones
using it via dtml) like a normal folder object.
Somehow like the Customizer but without the need for actually creating
Zope objects. Something inbetween Specialist and Customizer this would be
I guess.
> (Are you looking for a dynamic traversal interface that
> would allow you to map URLs to objects that are managed by
> ZPatterns? Can you give an example?)
yes, something like this comes close I guess.
e.g. I have some sql database consisting of people's addresses and
I want to create some specialist which queries this database (or how
ever this specialist is configured right now in order to get the
object ids) and shows it as if it's a normal folder.
(seems to me more transparent at some point).
But I assume it's not suited for all applications e.g. if the number
of objects gets a little bigger.
And I guess I can create this myself if I subclass from Specialist and
add the rest of the ObjectManager's interface to it.
> CS> 3. Is it possible to use ZPatterns also without some exta
> CS> ZClass defined in a Product? At least if I don't need methods
> CS> for my objects but simple want to define the attribute they
> CS> know. Would be nice as I could then hold everything together
> CS> in one place (the specialist that is) without requiring to
> CS> install something also in the Products folder of the Control
> CS> Panel.
>
> I believe you need to either create a Python subclass, or a ZClass
> subclass of DataSkin. "Raw" DataSkins don't have the right permissions
> to allow for TTW access. If you're creating a 'product' anyway... just
> make a 'dummy' class that you can use for storage.
ok, but I still need to define the attributes I want to handle inside a
propertysheet of this ZClass, right?
Actually what I would like is something which directly resides inside the
Specialist and not somewhere outside in some Product folder.
So everything is close together in one place.
> CS> That's it for now, I will keep experimenting then.. :)
>
> Good Luck!
Oh, it's working better than I thought :)
but thanks,
christian