Re: [Zope-dev] what to return for a manage_edit method

2001-06-23 Thread Dieter Maurer

Sin Hang Kin writes:
 > What should I return to for a method that create a new object or modify the
 > object?
 > 
 > If I return a redirection, will it too restricted for web only? If I return
 > a simple ok, it seems very stupid.
The Zope management interface often uses constructions like:

def (..., REQUEST=None):
  
  if REQUEST is not None:
# through the WEB

  else:
called directly

You may use similar code.


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] PostgreSQL & Zope 2.4.0b1

2001-06-23 Thread Federico Di Gregorio

On 23 Jun 2001 22:59:02 +0200, Andreas Heckel wrote:
> Hi,
> is somebody out there who got ZPyGreSQLDA or any other DA for Postgres
> working with Zope2.4.01b ?

psycopg works with 2.4.0b1 with a little modification to db.py. the
modification is documented in the mailing list archives:

http://lists.initd.org/pipermail/psycopg/2001-June/000185.html

somebody said such a modification is not needed with cvs zope, so we are
holding it back until the final 2.4.0 is out.

-- 
Federico Di Gregorio
MIXAD LIVE Chief of Research & Technology  [EMAIL PROTECTED]
Debian GNU/Linux Developer & Italian Press Contact[EMAIL PROTECTED]
   Don't dream it. Be it. -- Dr. Frank'n'further


___
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] PostgreSQL & Zope 2.4.0b1

2001-06-23 Thread Andreas Heckel

Hi,
is somebody out there who got ZPyGreSQLDA or any other DA for Postgres
working with Zope2.4.01b ?

-- 
___
Andreas Heckel  [EMAIL PROTECTED]
LINUX is like a wigwam...no gates...no windows and an apache inside ;-)

___
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] Wildcards in TextIndex query. Do they work?

2001-06-23 Thread abel deuring

Erik Enge wrote:
> 
> On Wed, 30 May 2001, Erik Enge wrote:
> 
> > I'm going bug hunting...
> 
> I'm back :)
> 
> I think I found the bug.  In lib/python/SearchIndex/GlobbingLexicon.py in
> the query_hook() method.  It seems to say that: "if I can't find a '*' or
> a '?' in the word, then go to else-clause", where the else-clause says
> sodd off.
> 
> Since it iterates over the query, 'word' is actually a list if you use
> parens in your query, and you won't find any wildcards there.  I think.
> 
> Add a dash of recursiveness, and it seems to be solved (for me):
> 
> def erik_hook(self, q):
> "doc string"
> words = []
> for w in q:
> if ( (self.multi_wc in w) or
>  (self.single_wc in w) ):
> wids = self.get(w)
> for wid in wids:
> if words:
> words.append(Or)
> words.append(wid)
> else:
> words.append(self.erik_hook(w))
> return words or ['']
> 
> def query_hook(self, q):
> """expand wildcards"""
> words = []
> for w in q:
> if ( (self.multi_wc in w) or
>  (self.single_wc in w) ):
> wids = self.get(w)
> for wid in wids:
> if words:
> words.append(Or)
> words.append(wid)
> else:
> words.append(self.erik_hook(w))
> 
> Not really tested, but it seems to work.  This might have been resolved in
> CVS, I don't know, should I post it as a bug?

Erik,

I'm afraid that your patch does not solve all the problems you mentioned
in an earlier mail.

You are right that the implementation of query_hook in Zope 2.3.2 and
2.4.0b1 cannot handle words with wildcards in nested lists, but your
patch will lead to endless recursion, if you enter the most simple
query: just one word without wildcards. In this case, "if (
(self.multi_wc in w)..." evaluates to false, hence self.erik_hook is
call for this word, where "if ( (self.multi_wc in w)..." is again false,
and erik_hook is called again...

The statement "q = parse(s)" in UnTextIndex.query (and
PositionIndex.query) before the call to query_hook can return nested
lists, so query_hook must be aware of this.

This can be done with:

def query_hook(self, q):
"""expand wildcards"""
words = []
for w in q:
if type(w) is type([]):
words.append(self.query_hook(w))
else:
if ( (self.multi_wc in w) or
 (self.single_wc in w) ):
wids = self.get(w)
for wid in wids:
if words:
words.append(Or)
words.append(wid)
else:
words.append(w)
# if words is empty, return something that will make
textindex's
# __getitem__ return an empty result list
return words or ['']

You also mentioned the strange results of queries like "eri* and enge".
These are caused by another bug in query_hook:

The results from the wildcard expansion are simply inserted into the
result list. Example: "ab* and xyz" may be expended by query_hook into 

['aba', 'or', 'abb', 'or', 'abc', 'and', 'xyz']

Since UnTextIndex.evaluate looks first for 'and' operators, this is
eqivalent to 

['aba', 'or', 'abb', 'or', ['abc', 'and', 'xyz']]

(The funny (or confusing) side effect is that "ab* and xyz" may return
different results compared with "xyz and ab*", because "aba and xyz"
probably gives results different from those for "abc and xyz".)

but we need a result like

[['aba', 'or', 'abb', 'or', 'abc'], 'and', 'xyz']

This version of query_hook below fixes the problem:

def query_hook(self, q):
"""expand wildcards"""
words = []
for w in q:
if type(w) is type(''):
if ( (self.multi_wc in w) or
 (self.single_wc in w) ):
wids = self.get(w)
alternatives = []
for wid in wids:
if alternatives:
alternatives.append(Or)
alternatives.append(wid)
words.append(alternatives or [''])
else:
words.append(w)
else:
words.append(self.query_hook(w))
# if words is empty, return something that will make textindex's
# __getitem__ return an empty result list
return words or ['']

You also mentioned the parse result

['abc', '...', '...', '...', 'def']

which you could not reproduce. Playing with Catalogs, I accidentally
produced the corresponding query: '"abc ... def"', i.e., the double
quotation marks are 

Re: [Zope-dev] ZClass not in a Product

2001-06-23 Thread Dieter Maurer

Joachim Werner writes:
 > > I do not agree with you:
 > > 
 > >   a ZClass is both an instance (you can manage, modify, delete)
 > >   and a class (you can use as blueprint for object creation).
 > 
 > O.k., I CAN manage/modify/delete a ZClass, but it still is (conceptually) a 
 > class, and only a class. You can manage/modify/delete Zope Python classes, too: 
 > Add new icons, DTML or "real" methods etc. It just is done from the file 
 > system. Still nobody would call those "instances" ...
 > 
 > Or did I miss something here?
Maybe you search "python.org" for Guido's metaclasses article.
It tells that a Python class can be both a class and an instance
and that this view has interesting applications.

You focus on the class aspects of a ZClass (a pattern for creating
instances providing them with basic common infrastructure),
while I stress the instance aspects.

The fact, that you can manage ZClasses in the same way as other
Zope objects, calls for similar structuring possibilities:
taking them out of the centralized control panel and putting them
anywhere in the site. That was the starting point of our discussion...


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] Re: making zwikiwebs.zexp import unnecessary

2001-06-23 Thread Chris McDonough

It occurs to me that you may be confused as to why there are only two
Wiki Pages stuck into a CMFWiki by the CMFWiki product.  Especially if
you haven't worked with the CMF.

CMFWiki just creates a skin directory view with the Wiki DTML in it (a
feature of the CMF that isn't available in regular Zope)... the only two
pages that are non-help that are placed into an actual CMFWiki instance
and FrontPage and SandBox.

For vanilla ZWiki, I think what you'll need to do is register a
"WikiWeb" constructor in the ZWiki __init__.py (much like you register
one now for "WikiPage")  That constructor method could construct a
Folder object, and iterate over all the dtml and Wiki files in a
subdirectory of the ZWiki package, adding them to the folder.  I think
you can rip most of this code right out of CMFWiki, though you may need
to extend it a bit for DTML files if there are any.

HTH,

- C


Simon Michael wrote:
> 
> Chris McDonough <[EMAIL PROTECTED]> writes:
> > Yes, the CMFWiki product does this... it's fairly simple code that I
> > think could be lifted directly from the product.  I think CMFWiki
> > comes with the CVS checkout of the CMF now...
> 
> Thanks Chris, I will look. I posted a tentative plan on
> http://zwiki.org/ToDo also.
> 
> ___
> 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 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] Re: [Zope-dev]ZPL and GPL licensing issues

2001-06-23 Thread Erik Enge

[Simon Michael]

| Now you're talking. Seconded.

Me too!

And if the management team really needs alot of serious breakdowns as
to why this is a problem (GPL-incompatability, that is) let me know
and I'll drum up a nice little mail of my own.  :)

___
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: making zwikiwebs.zexp import unnecessary

2001-06-23 Thread Simon Michael

Chris McDonough <[EMAIL PROTECTED]> writes:
> Yes, the CMFWiki product does this... it's fairly simple code that I
> think could be lifted directly from the product.  I think CMFWiki
> comes with the CVS checkout of the CMF now...

Thanks Chris, I will look. I posted a tentative plan on
http://zwiki.org/ToDo also.

___
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] MountedFileStorage : absolute_path return / instead of mounted poing

2001-06-23 Thread Sin Hang Kin

I was playing with MountedFileStorage, and found that the absolute_path used
in breadcrumb is returning the / instead of the mounted point. Can somebody
give it a patch?

Moreover, Can I mounted a Bsddbstorage with it?


Rgs,

Kent Sin
-
kentsin.weblogs.com
kentsin.imeme.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 )