Re: [Zope3-Users] sqlos - getting factory of NoneType

2006-01-08 Thread Christian Lück
Christian Lück wrote:


 
 *FACIT*:
 sqlos really *!
 

Sorry for this. My english is not good enough to express - maybe somehow
tongue-in-cheek - the certain 'affectio' fighting with sqlos during
some days and nights had caused.
I did not want to affront anyone.
(The intention of my email is better represented by the constructive
analysis I had given before. Oh, and I keep on using - and maybe even
improving - sqlos.)

Kind regards,
Christian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Re: Get classes implementing Interface

2006-01-08 Thread Florian Lindner
Am Freitag, 30. Dezember 2005 13:30 schrieb Philipp von Weitershausen:
 Florian Lindner wrote:
  my first use case is that I want to enhance the HomefolderManager to make
  it possible to select something else than a Folder to be created
  automatically. Right now I have forked a version of the HomefolderManager
  and just changed in the code. But I would like to have a more generic
  solution and I'll also commit it back to the trunk.
  For that I want all classes implementing IContainer (and IContentType ?)
  and let the user select on in the configuration dialog of the
  HomefolderManager. More use caess probably show up in my project later,
  but nothing fixed at this time.

 So what you want is to create objects. Classes are just an
 implementation detail to creating objects :). Factories create objects,
 whether they're from a class is immaterial.

 So, what you want is not a list of classes but a list of factories that
 can create IContainers. This is possible by using
 zapi.getUtilitiesFor(IFactory) and then checking each factory's
 getInterfaces() method whether IContainer is a part of the returned
 result. I would probably base an implementation of all on the
 UtilityVocabulary.

Hi,
I do it this way now:

utils =  getUtilitiesFor(IFactory)
self.objects = {}
for i in utils:
if IContainer in i[1].getInterfaces():

the UtilityVocabulary gives the same result as getUtilitiesFor.
But that does not list all classes, for example there is no class of the 
normal Folder.

Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Re: Tagging content

2006-01-08 Thread Philipp von Weitershausen
Igor Stroh wrote:
 Hi there,
 
 I'm trying to figure out the best way to implements a general
 solution for tags (like tags on flickr or del.icio.us). So far
 I've two different approaches, maybe someone could comment on
 them:
 
 1) Store the tags as attributes of the particular content types.
Searching for tagged content is handled by a catalog index.
New tags are created by simply adding them to the object,
a collection of tags is the set of all tags from the catalog.
Drawbacks: centralized tag management is inefficient, e.g.
deleting a tag implies searching for the particular tag and
removing it from all objects it was tagged with.
 
 2) Store tags in a local utility. The utility manages a
tag - intids mapping (similar to a catalog index).
Searching for tags is easy - just query the mapping
for appropriate keys. New tags are created by adding
a new key to the mapping, a (weighted) collection of
tags is the list if mapping keys.
Drawbacks: I can't think of any right now

I would use annotations to store the tags. That way you can tag any
object you'd like. Using IDublinCore's keywords would even be possible.
Then, to find objects with a certain tag, use the catalog. The field
index knows how to adapt objects to a certain interface before indexing,
for example. Yes, this would make deleting a tag more expensive, but how
often does that happen anyways?

Philipp

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Importing Lots of Objects

2006-01-08 Thread David Johnson








I am setting up a variety of websites for merchants. Like
any merchant, they have lots of different products. The question is, what is
the best way to import these product lists and maintain these objects. Would
this be better stored in a relational database? How do I import them (if I use
a relational database the answer is easy)? I have answers to these
questions, but I would be curious to hear how others have dealt with issue.











--

David Johnson

[EMAIL PROTECTED]

201 Main Street
  Suite 1320

Fort Worth, TX 76102

(877) 572-8324 x2200








___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Importing Lots of Objects

2006-01-08 Thread Andreas Jung



--On 8. Januar 2006 11:44:06 -0600 David Johnson [EMAIL PROTECTED] 
wrote:



How do I import them (if I use
a relational database the answer is easy)?I have answers to these
questions, but I would be curious to hear how others have dealt with
issue.


This depends likely on _your_ usecases. Data can be stored in a RBDMS, in 
the filesystem, in the ZODB...every storage has its pros and cons..without

knowing your usecases there is only guessing what might be best for you.

-aj



pgpcdGOa9bQfJ.pgp
Description: PGP signature
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Tagging content

2006-01-08 Thread Jeff Shell
Ha! I just implemented this, and I _generally_ like what I came up
with. I'm thinking of writing it up as a document or releasing it if
work and time will allow me to. I can share my basic implementation
here.

The overview: First, I created an ITaggable interface:

class ITaggable(Interface):
 Tags are a field of keywords 
tags = zope.schema.Tuple(
title=uTags,
description=_(uKeyword Tags),
value_type=zope.schema.TextLine(title=uTag, required=True)
)

(I don't know if the 'required=True' needs to be there in the value_type).

Then for my particular implementation I made a property for my object
that mapped to the dublin core 'subjects' property. I wrote a custom
'DublinCoreProperty' for this. You can do your own thing if you like.
My reasoning - I want tags to be thought of as 'tags', but since I'm
working with a Zope 3 content object that has dublin core, I may as
well take advantage of what's there, so I basically adapt 'subjects'
to 'tags'. This could also be done with an adapter, and you could make
everything taggable, using something like this:

from zope.app import zapi
from zope.interface import implements
from zope.app.dublincore.interfaces import IZopeDublinCore
from zope.app.annotation.interfaces import IAnnotatable

class TaggableSubjects(object):
 Adapts annotatable objects to expose the 'subjects' field as 'tags' 
implements(ITaggable)
zapi.adapts(IAnnotatable)

def __init__(self, context):
self.dc = IZopeDublinCore(context)

def _getTags(self):
return self.dc.subjects

def _setTags(self, value):
self.dc.subjects = value
tags = property(_getTags, _setTags)

That's a pretty simplistic adapter - you'd probably want more error
checking. In any case, I just want to point out that in my
implementation, tags are just a tuple of strings on any ITaggable
object.

Now - how about querying them? This was hard until recently. I used
zc.catalog out of the Zope subversion repository, because it has
what's known as a SetIndex. A SetIndex allows for querying against,
um, sets of data. So with a catalog or extent catalog (the 'extent
catalog' is part of the 'zc.catalog' package), I create an index,
'tags', as a SetIndex, which uses the 'tags' attribute of the
ITaggable interface. The catalog will try to adapt an indexed object
to ITaggable, so you can use something like the above adapter to give
'tags' to existing objects. Or implement it directly. In any case,
this is a really cool feature, adaptation. There are already event
listeners in place for the catalog / indexes to respond to object
modification and deletion events, so you don't have to remove it from
all objects it was tagged with. In my scenario, tags are not smart
objects (I did have an earlier implementation that had them as such,
before catalogs and the SetIndex were available).

To query them, you just need to search the catalog. I use hurry.query,
and with that it looks like this:

from zope.app import zapi
from hurry.query.interfaces import IQuery
from hurry.query import set as setquery

(inside whatever class / function / method you have for querying):

tags = self.tags   # a tuple of strings: ('zope','tags','tagging','catalog')
tagindex = ('catalog', 'tags')   # (ICatalog name, index name) - its
how hurry.query works
query = setquery.AllOf(tagindex, tags)
queryUtility = zapi.getUtility(IQuery)
results = self._results = queryUtility.searchResults(query)

With hurry.query you can easily add other queries on to this, such as
full text indexing, date sets, and more, depending on your indexes.

Anyways, there's the heart of what I use in this knowledge base
application I've been working on for the past couple of weeks. It's an
application that stores all of its articles in one big container,
generates names automatically (yay INameChooser!). You just add an
article and tag it, and use tags for navigation.

Although... that's where things get a little more tricky. I do have a
system in place that lets me have URLs like:

http://kbase.example.com/@@tags/zope/catalog/setindex

and that will turn into a query for all documents that have the tags
('zope', 'catalog', 'setindex'). I have a solution in place that I
like that actually generates objects on the fly for each point in the
URL. These aren't Tag objects (since tags are just keyword strings),
but TagMatchers. A TagMatcher is a simple interface and object that
holds a list of tags and runs a catalog query for the matching tags.
This query has to be called explicitly. I then have some
IBrowserPublisher adapters and views that are used to manage the
traversal. Basically every time a name is traversed, a new tagmatcher
is made, with the understanding that its parent is a TagMatcher. The
parents tags plus the new name are passed into the new matcher. At the
end of the path, a default view for ITagMatcher calls 'process' which
causes the query to be run and then it gets and sorts the results for
display.


RE: [Zope3-Users] Importing Lots of Objects

2006-01-08 Thread Andreas Jung



--On 8. Januar 2006 11:57:36 -0600 David Johnson [EMAIL PROTECTED] 
wrote:



Thanks.

The basic use cases are as follows:

Shoppers can browse products by category
Shoppers can search for products
Shoppers can add products to cart
Merchants can import product lists from Excel/Text file
Merchants can manually edit products

We expect to service 1M purchase transactions a year, and expect to
service 1000 merchants.



I would go for a RDBMS.

-aj


pgpZJw75tpCUJ.pgp
Description: PGP signature
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Re: Tagging content

2006-01-08 Thread Tim Hicks
Philipp von Weitershausen wrote:

 I would use annotations to store the tags. That way you can tag any
 object you'd like. Using IDublinCore's keywords would even be possible.
 Then, to find objects with a certain tag, use the catalog. The field
 index knows how to adapt objects to a certain interface before indexing,
 for example. Yes, this would make deleting a tag more expensive, but how
 often does that happen anyways?

If you use IDublinCore keywords, then presumably you are just giving that
existing functionality a different 'buzzname'.  To do tagging properly,
don't you need to have it work on a per-user basis, so that different site
members can tag with different words?

Or am I still not really understanding the tag buzz yet?

Tim
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


RE: [Zope3-Users] Importing Lots of Objects

2006-01-08 Thread David Johnson
What is the best for merchants to manage the product list and content of
their site?  I can certainly put in into an RDBMS, but what would be the
easiest way for them to manage their offering? Should I create a portal site
for them or should I allow them into the ZMI in some way?  Based upon the
varied needs of the merchants, I would like to let them into the ZMI, and
see their products as instances under their site.




-Original Message-
From: Andreas Jung [mailto:[EMAIL PROTECTED] 
Sent: Sunday, January 08, 2006 12:02 PM
To: David Johnson; 'Andreas Jung'; zope3-users@zope.org
Subject: RE: [Zope3-Users] Importing Lots of Objects



--On 8. Januar 2006 11:57:36 -0600 David Johnson [EMAIL PROTECTED] 
wrote:

 Thanks.

 The basic use cases are as follows:

 Shoppers can browse products by category
 Shoppers can search for products
 Shoppers can add products to cart
 Merchants can import product lists from Excel/Text file
 Merchants can manually edit products

 We expect to service 1M purchase transactions a year, and expect to
 service 1000 merchants.


I would go for a RDBMS.

-aj

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Importing Lots of Objects

2006-01-08 Thread Jeff Shell
On 1/8/06, David Johnson [EMAIL PROTECTED] wrote:
 What is the best for merchants to manage the product list and content of
 their site?  I can certainly put in into an RDBMS, but what would be the
 easiest way for them to manage their offering? Should I create a portal site
 for them or should I allow them into the ZMI in some way?  Based upon the
 varied needs of the merchants, I would like to let them into the ZMI, and
 see their products as instances under their site.

It's very easy to design multiple user interfaces in Zope 3 thanks to
the skins system. You don't need to give them access to the ZMI. The
ZMI in Zope 3 is just a default skin. It exposes a lot of things that
are best used by those who understand Zope 3. You could fit custom
product management screens into it, but in my experience it's better
to build a custom interface. It's not that difficult to do.

As far as managing the data in the RDBMS from Zope 3, you can always
use SQL Methods / Scripts or just interact with the database adapters
directly and do the SQL interaction that way.

For a more object-oriented solution you can try using 'sqlos'
(SQLObject Support) which integrates the Python SQLObject system with
Zope 3.

You can still use Zope 3's schema, widgets, and form system - even if
you generate the SQL yourself. If you have a product schema like this:

class IProductInfo(Interface):
name = zope.schema.TextLine(
title=uProduct Name, maxlength=255, required=True)
price = zope.schema.Float(title=uProduct Cost, required=True)

you can still use the form system to get those fields, validate the
input against the schema, and if validation succeeds, you can generate
SQL from the validated data instead of assigning it to a Python
object.

You can make a site for the merchants that is specific to their needs.
It doesn't need to be the ZMI (it would be a lot of work to integrate
into that), but it can be that kind system. All of the tools are
there. For the amount of data that you're talking about, an RDBMS is
probably better tuned to your requirements. But you can still take
full advantage of Zope 3's features even if you're not using the ZODB
as your primary storage.
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users