Re: [Zope-dev] ZPatterns, ZClasses, Specialists: Assigning responsibilities

2000-12-15 Thread Steve Alexander

Itai Tavor wrote:

 I have the following ZClasses, with matching Specialists: 
 Product, Graphic, Order, OrderLineItem. When a customer adds a product 
 to their order, they have to provide a graphic file which will be 
 printed on the product (imagine buying a lunch box with your cat's photo 
 on it). The Graphics Specialist can provide a addGraphicSnippet form. 
 But who's responsible for asking for this graphic when adding the 
 product to the order? Is it still the Product object? But a Product 
 turns into a Product-with-Graphic only when it's a part of an order, so 
 is it correct for the Product to even know about Graphics? the 
 alternative is to move the addToOrder methods to either Order or 
 OrderLineItems, but this doesn't make any more sense because these would 
 then have to know a lot more about a Product than is good for them. Any 
 ideas?

Sounds to me like you have a new type of Product.

You have your basic products (of which there are many kinds), and you 
have ProductWithGraphic products. A ProductWithGraphic is a "calculated 
product": it is composed of a basic product and a graphic. Its cost, 
delivery time, packing charge, and so forth, are calculated based on the 
combination of the basic product and the graphic.

To the rest of the application, a ProductWithGraphic is just another 
kind of product.

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


___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )




Re: [Zope-dev] more on keyword indexes

2000-12-15 Thread Steve Alexander

Hi Josh,

I use KeywordIndexes a lot.

Just for kicks, I implemented what you describe below in Zope2.3 grabbed 
fresh from CVS just now.

I used DTML Documents for the objects to catalog, and I added a lines 
property called KW to each one.

I queried the catalog using syntax like
   dtml-in "Catalog(KW=['one', 'two'])"
or
   dtml-in "Catalog(KW='purple')"


Josh Zeidner wrote:

 Hello,
 
   I did a little more investigiation into the problem, and couldnt really
 find any documentation anywhere on what the actual semantics are of keywords
 and how they are queried.  For instance:
 
   I have three classes and each has an keyword index named KW:
 
   ObjectOne:KW = ['one','blue','furry']
   ObjectTwo:KW = ['two','flying','purple']
   ObjectThree:  KW = ['three','one-eyed','purple']
 
   If I were to query the ZCatalog with the following set of words:
 ['purple'] I would expect to get:
 
 ObjectTwo
 ObjectThree

Yes, that's what you get.

   Right?  If I query the database with ['one','two'] ( if this type of thing
 is at all possible ), I get :
 
 ObjectOne
 ObjectTwo

Yes, that's what you get.

   This seems like the obvious result: BUT: it depends if you want a AND/OR
 type search.  

It is an OR search.

 I could also expect to get nothing( if its an AND type search
 because no records match 'one' and 'two' ).  Here is better example, what if
 I queried: ['purple','one-eyed'].  Would I be expecting only ObjectThree or
 [ ObjectThree, ObjectTwo ] ( because they both match the keyword purple( a
 logical set-intersection ) ).

You get ObjectTwo and ObjectThree.


   Also I found the keyword indexes to have some more obvious bugs.  If I
 only used one keyword for the matching critiria,  for instance if I used
 'purple' , I would only get ObjectTwo.

I get ObjectTwo and ObjectThree, as I'd expect.


 Is anyone else using keyword
 indexes?  In what way are you using them?

All sorts of things. One useful use is to limit a query on a SiteIndex 
type of catalog to just a sub-tree of your site.

See my message to zope-dev on October:

   http://lists.zope.org/pipermail/zope-dev/2000-October/007535.html


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


___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )




Re: [Zope-dev] keyword indexes

2000-12-15 Thread Steve Alexander

Josh Zeidner wrote:

 Hi,
 
   Currently I am wrestling with "keyword" indexes in ZCatalogs.  How do I
 query the ZCatalog for all records of objects indexed on a particular
 keyword.  For instance if my index is named MediaKeyword ive tried:
 
  dtml-in "Catalog.searchResults( MediaKeywords = ['ouch'] )"

That should work.

this has completely unpredictable results.
 
  dtml-in "Catalog.searchResults( MediaKeywords in ['ouch'] )"
 
this returns all indexed objects!

That won't work. The python

   MediaKeywords in ['ouch']

will be evaluated first, and will give a calue of 0 or 1. If 
MediaKeywords is a list, then it will always give 0, because there is 
only one item in ['ouch'], and that is the string 'ouch'.

   What am I doing wrong?  Is there a special ZCatalog function for querying
 keyword indexes?  I need some insight into this problem.

Are you sure that the keywords are being indexed in your catalog? A good 
trick is to index the keyword attribute, and also store it as metadata. 
That way, you can look through your search results at the keywords the 
Catalog thinks you have.

Also, check that you declared MediaKeywords as a keyword index, and that 
the MediaKeywords attribute in your objects is (or returns) a sequence 
type such as a tuple or a list.

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


___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )




[Zope-dev] CoreSessionTracking Release 0.2

2000-12-15 Thread Chris McDonough

I had some reports yesterday of the Core Session Tracking development code
not working against recent Zope 2.2 releases, so I removed dependencies in
the code on the Interface module which were causing the incompatibilities.
CoreSessionTracking 0.1 will work against Zope 2.3a1, but not against Zope
2.2.3, 2.2.4, etc.

A new release of the code which has these dependencies removed, 0.2, is
available from
http://www.zope.org/Members/mcdonc/Products/CoreSessionTracking .  This
release works against all Zope 2.2.X based systems, AFAIK.

Thanks!

- Chris



___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )




Re: [Zope-dev] urllib not available in Python Scripts?

2000-12-15 Thread Evan Simpson

From: Itai Tavor [EMAIL PROTECTED]
 In Python Methods I could do urllib.quote(...). This doesn't work in
 Python Scripts. Is quote considered a security risk?

No, but only the modules available to DTML are importable by default.   You
would need to provide security declarations in order to import anything from
urllib.

Cheers,

Evan @ digicool  4-am


___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )




Re: [Zope-dev] Search Interface [was 'case insensitive sorts']

2000-12-15 Thread Casey Duncan

Chris Withers wrote:
 
 Rik Hoekstra wrote:
 
  Hm, reading this... just a loose comment.
  In light of the awkward search interface of ZCatalogs, would it be a good
  idea to make a search interface for ZCatalog ZPatterns based? T
 
 I'm starting to feel like a stuck record on this, but lots of people
 seem to be asking for it in their own way... ;-)
 
 If the ZSearch Interface was properly documented and fully featured (ie
 defined how you search an object that supports the interface, and how
 you would index objects using that interface) then we wouldn't be stuck
 with the ZCatalog. It would enable people to write SQLIndexers,
 ZPatterns-based Catalogs and anything else they want, all of which would
 be freely interchangeable with the ZCatalog.
 
 Comments?
 
 Chris
 

I would love to see this happen. Sounds like a fishbowl project to me!

-- 
| Casey Duncan
| Kaivo, Inc.
| [EMAIL PROTECTED]
`--

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )




Re: [Zope-dev] Catalog class--does it support boolean queries?

2000-12-15 Thread Casey Duncan

Chris Withers wrote:
 
 Marc Conley wrote:
 
  boolean queries seem not to work. Should boolean queries work using Catalog
  or is it
  necessary to use ZCatalog instead to get that functionality?
 
 I'm not sure boolean queries work in either. If they do, anyone know
 where their syntax is documented?
 
 cheers,
 
 Chris

From digging around in the code, here is the general text index query
syntax (if you can call it that):

"one two three" and "one or two or three" are equivilant, multiple words
are "orified" by default. Hits are scored according to the number of
words matched, so by default, objects matching all words will be first
in the results. 

"one and two and three" and ['one','two','three'] will return only
objects containing all three words.

"one and not two" ('andnot' also works) works as advertised.

Wildcard characters "*" and "?" can be used to match multiple word
forms. e.g. a query for "great*" would match "great", "greats",
"greatest", "greatly", etc.

There is also a mentioned support for "near" searching in the code using
a '...' operator, although in practice this does not work 8^(. It seems
as though all non-aphanumerics are stripped from the query somewhere.
IMHO this should probably just use the word "near" as an operator
anyway.

For those interested, the indexing/searching code lives in {Zope
Dir}/lib/python/SearchIndex.

In doing some more digging in UnTextIndex.py there I do see support for
parens and quoted phases, although in practice they do not work. If I
find time I will delve into this further.
-- 
| Casey Duncan
| Kaivo, Inc.
| [EMAIL PROTECTED]
`--

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )




Re: [Zope-dev] Catalog class--does it support boolean queries?

2000-12-15 Thread Casey Duncan

Chris Withers wrote:
 
 Casey Duncan wrote:
 
  In doing some more digging in UnTextIndex.py there I do see support for
  parens and quoted phases, although in practice they do not work. If I
  find time I will delve into this further.
 
 Cool, if you document it anywhere, please let us know...
 
 Chris

2.3.0a1 seems to be a bit more friendly toward near, and parens and
quoted phrase searches. I will be looking into this further. Perhaps a
howto is in order?
-- 
| Casey Duncan
| Kaivo, Inc.
| [EMAIL PROTECTED]
`--

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )




Re: [Zope-dev] keyword indexes

2000-12-15 Thread Dieter Maurer

Josh Zeidner writes:
   dtml-in "Catalog.searchResults( MediaKeywords = ['ouch'] )"
This should work.
Alternatively: "MediaKeywords = 'ouch'".

   dtml-in "Catalog.searchResults( MediaKeywords in ['ouch'] )"
This calls the catalog without any keyword arguments
and with a single positional parameter 0.
The catalog interprets this as "no search criteria" and returns
all objects.


Dieter

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )




Re: [Zope-dev] more on keyword indexes

2000-12-15 Thread Dieter Maurer

Josh Zeidner writes:
  
This seems like the obvious result: BUT: it depends if you want a AND/OR
  type search.
ZCatalog combines several search terms for a single index with
"OR" and search expressions for different indexes with
an "AND".


Dieter

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )




Re: [Zope-dev] urllib not available in Python Scripts?

2000-12-15 Thread Dieter Maurer

Itai Tavor writes:
  In Python Methods I could do urllib.quote(...). This doesn't work in 
  Python Scripts. Is quote considered a security risk?
"quote" not, but maybe "urllib".


Dieter

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )




[Zope-dev] Re: [Zope] IE5 / Medusa bug?

2000-12-15 Thread Dieter Maurer

seb bacon writes:
  
  the Content-length is consistently reported as 14 bytes too
  short.  This is regardless of the actual length of the document.
  
  Why this should have a knockon effect on a small subset of MS
  browsers, I don't know.  Especially confusingly random is the
  requirement for a certain amount of data to break these browsers.
You can configure IE for use of HTTP 1.0 or HTTP 1.1.

I would expect it to close connections after each request
for HTTP 1.0 mode. Then, a correct Content-Length is of
much less importance. In HTTP 1.1 mode, IE is very
strict with Content-Length.


Dieter

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )




Re: [Zope-dev] A couple of possible Python Scripts bugs

2000-12-15 Thread Itai Tavor

Evan Simpson wrote:

From: Itai Tavor [EMAIL PROTECTED]
  First, when trying to add a Python Script, I sometimes get:

  Error Type: AttributeError
  Error Value: tx

Thanks! Fixed in CVS.

  return container.domains

  returns AttributeError.

  This does not occur if I try to read a property on the first
  propertysheet in the ZClass. Also, getProperty('domains') works in
  the Python Script. And this Python Script:

Sorry, I can't replicate this on Zope 2.3 alpha 1.

I'm the one who should be sorry. I forgot to mention I was using 
2.2.4. And I know Python Scripts are not certified to work with 
2.2.4, so this is pretty much irrelevant. I'm glad the first item 
turned out to be a real bug!
-- 
Itai Tavor"Je sautille, donc je suis."
C3Works[EMAIL PROTECTED]  - Kermit the Frog

"If you haven't got your health, you haven't got anything"


___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )