[Zope-dev] Help! - I want to understand Acquisition...

2001-04-19 Thread Bernie Rossi

Hi,

First of all I'm converting an existing (and working) Zope
product from version 2.1.4 to 2.3.1 and I'm having the following
problem when trying to run the (new) converted version.

In a dtml document which is run many times for different types of
objects ie. something like

  dtml-in " ... " 
  . . .
  IMG ... src="dtml-var expr="getIcon(REQUEST)"" ... 
  . . .
  /dtml-in

where it iterates through a list of objects,
I get mixed results which I don't understand.

When it works the getIcon function returns the path
(using the REQUEST namespace) and icon for
the particular object type and then this gets rendered as expected.

But when it fails the icon for the type does not get rendered
at all (understandably). After some debugging (ie. print statements)
I found that when it failed the REQUEST namespace was not passing
what I expected (it was empty), and when I tried to print the namespace
it printed the following;

  Special Object Used to Force Acquisition

So the python function (getIcon()) was expecting the REQUEST object
but actually getting (it seems) is a derived (and unexpected) object,
and failing when looking for particular attributes.

I don't understand this behaviour (why it works for some and not others
and why it worked in a previous version of Zope) and therefore how to fix
it.

Any help or pointers on the above or other relevant issues to upgrading
older products would be appreciated.

Thanks in advance
Bernie Rossi.


___
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] Catalog in 2.3.1

2001-04-19 Thread Adrian Hungate
Title: Catalog in 2.3.1





Are there some problems with the new catalog?


I have spotted two possible problems:
1) In CatalogAware, there is a function reindex_all, which appears to have a few problems, like calling index_object instead of reindex_object. Also, why sub = self.objectValues() when sub is never used?

2) If I search a text index for a value that it does not contain, I get nothing back (No surprises there), but if I search for a word that is a substring of a word in the index, I get a Type Error (expected integer key). Did I do something wrong, or have I hit a bug?

Here is the traceback of the following search. A Title index that contains the word wibble, search for the single word wib:

Traceback (innermost last):
 File C:\PROGRA~1\WebSite\lib\python\ZPublisher\Publish.py, line 223, in publish_module
 File C:\PROGRA~1\WebSite\lib\python\ZPublisher\Publish.py, line 187, in publish
 File C:\PROGRA~1\WebSite\lib\python\Zope\__init__.py, line 221, in zpublisher_exception_hook
 (Object: catalog_support)
 File C:\PROGRA~1\WebSite\lib\python\ZPublisher\Publish.py, line 171, in publish
 File C:\PROGRA~1\WebSite\lib\python\ZPublisher\mapply.py, line 160, in mapply
 (Object: results)
 File C:\PROGRA~1\WebSite\lib\python\ZPublisher\Publish.py, line 112, in call_object
 (Object: results)
 File C:\PROGRA~1\WebSite\lib\python\App\special_dtml.py, line 127, in __call__
 (Object: results)
 File C:\PROGRA~1\WebSite\lib\python\DocumentTemplate\DT_String.py, line 538, in __call__
 (Object: results)
 File C:\PROGRA~1\WebSite\lib\python\DocumentTemplate\DT_Let.py, line 146, in render
 (Object: rs=quot;Catalog.searchResults(REQUEST)quot;)
 File C:\PROGRA~1\WebSite\lib\python\DocumentTemplate\DT_Util.py, line 334, in eval
 (Object: Catalog.searchResults(REQUEST))
 (Info: REQUEST)
 File lt;stringgt;, line 0, in ?
 File C:\PROGRA~1\WebSite\lib\python\Products\ZCatalog\ZCatalog.py, line 535, in searchResults
 (Object: Traversable)
 File C:\PROGRA~1\WebSite\lib\python\Products\ZCatalog\Catalog.py, line 651, in searchResults
 File C:\PROGRA~1\WebSite\lib\python\Products\ZCatalog\Catalog.py, line 542, in _indexedSearch
 File C:\PROGRA~1\WebSite\lib\python\SearchIndex\UnTextIndex.py, line 513, in _apply_index
 File C:\PROGRA~1\WebSite\lib\python\SearchIndex\UnTextIndex.py, line 576, in query
 File C:\PROGRA~1\WebSite\lib\python\SearchIndex\UnTextIndex.py, line 616, in evaluate
 File C:\PROGRA~1\WebSite\lib\python\SearchIndex\UnTextIndex.py, line 448, in __getitem__
TypeError: (see above)


--
Adrian Hungate
Manager, European I.S.
Acucorp UK Limited





Re: [Zope-dev] Catalog in 2.3.1

2001-04-19 Thread seb bacon

* Adrian Hungate [EMAIL PROTECTED] [010419 10:09]:
 Are there some problems with the new catalog?
 
 I have spotted two possible problems:
 1) In CatalogAware, there is a function reindex_all, which appears to have a
 few problems, like calling index_object instead of reindex_object. Also, why
 "sub = self.objectValues()" when sub is never used?
 2) If I search a text index for a value that it does not contain, I get
 nothing back (No surprises there), but if I search for a word that is a
 substring of a word in the index, I get a Type Error (expected integer key).
 Did I do something wrong, or have I hit a bug?

Don't know much about (1), but (2) is certainly a bug, and seems to
have been fixed in CVS.

seb

___
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] ZCatalog waaaagh!

2001-04-19 Thread Chris Withers

Chris McDonough wrote:
 
 I know why this is, but I'm not going to fix it tonight... sigh.
 
 I need to go cry on Jim's shoulder for a bit before I check a proper fix in.

I'm guessing the fix for this is in 2.3.2b1?

cheers,

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] How to choose: Or, Not and And when using searchResults().

2001-04-19 Thread Chris Withers



Chris McDonough wrote:
 
 dtml-in "Catalog(textindex='foo' AND fieldindex='bar' OR
 keywordindex=['flop'])"
 

Chris, how hard would it be to expose ZCatalog's set lazy union and intersection
operators?
IIRC, ZCatalog does a lot of this internally so it shouldn't be that hard to do?
(right?! ;-)

If you could expose it, then you could construct the above query as:

dtml-in
"Catalog.OR(Catalog.AND(Catalog(textindex='foo'),Catalog(fieldindex='bar')),Catalog(keywordindex=['flop']))"

Could this be done easily?

cheers,

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 )



[Zope-dev] ZCatalog.indexes()

2001-04-19 Thread Chris Withers

Hi,

I read in the interfaces wiki (I think :-S) that the indexes() method of
ZCatalog is being deprecated.
Is this still accurate?

If so, how _should_ I be asking a ZCatalog for a list of it's indexes? I'd also
like to know their types if possible :-)

cheers,

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] Catalog in 2.3.1

2001-04-19 Thread Adrian Hungate
Title: RE: [Zope-dev] Catalog in 2.3.1





Does anyone know if/when this will make it into a release? I am about to deploy a Helpdesk/Knowledge Base product which is very heavily Catalog based.

--
Adrian Hungate
Manager, European I.S.
Acucorp UK Limited



-Original Message-
From: seb bacon [mailto:[EMAIL PROTECTED]]
Sent: Thursday, 19 April 2001 10:13
To: Adrian Hungate
Cc: Zope Developers List (E-mail)
Subject: Re: [Zope-dev] Catalog in 2.3.1



* Adrian Hungate [EMAIL PROTECTED] [010419 10:09]:
 Are there some problems with the new catalog?
 
 I have spotted two possible problems:
 1) In CatalogAware, there is a function reindex_all, which appears to have a
 few problems, like calling index_object instead of reindex_object. Also, why
 sub = self.objectValues() when sub is never used?
 2) If I search a text index for a value that it does not contain, I get
 nothing back (No surprises there), but if I search for a word that is a
 substring of a word in the index, I get a Type Error (expected integer key).
 Did I do something wrong, or have I hit a bug?


Don't know much about (1), but (2) is certainly a bug, and seems to
have been fixed in CVS.


seb





Re: [Zope-dev] WebDAV locking module?

2001-04-19 Thread Martijn Pieters

On Thu, Apr 19, 2001 at 09:43:02AM +1000, [EMAIL PROTECTED] wrote:
 Colour me confused...
 
 I just downloaded the 2.3.2 beta tarball and tried to run our application
 against it. It appears that the locking module (webdav.Lockable) is missing
 from webdav. We develop against the CVS, and the file is there. It has been
 since 2.3.1 CVS - though the 2.3.1 tarball doesn't seem to have the module
 either...

No it hasn't. It is in the trunk CVS, the 2.3 branch does not have the
WebDAV locks feature. Are you sure your CVS checkout is a branch checkout?

-- 
Martijn Pieters
| Software Engineer  mailto:[EMAIL PROTECTED]
| Digital Creations  http://www.digicool.com/
| Creators of Zope   http://www.zope.org/
-

___
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] html version of zope site

2001-04-19 Thread Mike Blake

Hi! 

First of all:
We have a client that (because of lame internal policy) 
will not be able to install zope on the final server.
However, they _do_ want zope as a publishing solution
for a web that will be practically nothing but dtml docs,
images, and folders. They're only intested in accessing
the web interface to modify text in custom zclass product
interfaces we will make for them.

Provided that there are no complicated methods integrated
into the zope structure, is it possible to generate a
navegable static html version of a zope hierarchy?

Our idea is to let them access our server to manage
and edit content and to give them a publish option
(written in python or perl) that generates the html 
and ftps the site to a remote, non-zope webserver.

The day that the client wants a more dynamic site
with searching and such, we would discuss installing
zope again on the remote server.

Please give me your thoughts on this workaround 
solution.

thanks,
--
[[EMAIL PROTECTED] chikoon]$ whoami
Mike Blake

___
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] html version of zope site

2001-04-19 Thread Toby Dickenson

On Thu, 19 Apr 2001 13:19:45 +0200, Mike Blake
[EMAIL PROTECTED] wrote:

Please give me your thoughts on this workaround 
solution.

Zope likes to include absolute urls in its generated html. During
development you will want these to refer to your development server,
but before taking a copy of your content you will need to use
VirtualHostMonster (or something similar) so that they refer to the
final server.

Toby Dickenson
[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 )



[Zope-dev] Building a Zope Site from a Source Distribution

2001-04-19 Thread Eric Roby

Could anyone point me to documentation or instructions on how to build Zope
to a particular version of Python.  My goal is to understand the process so
that I can do this on the Win32, Linux RPM and Solaris distributions (make
directives, etc...).  My first attempt will be focused on the Win32
distribution.  I have Borland's C++ compiler (the one that has been released
to the public). I have looked at the Win32 source distribution and the
build_extensions.py file makes reference to setup20 and setup15 files in the
lib/python folder.  They aren't there so I am a bit puzzled as to the
purpose of this build script.

Eric

___
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] External transaction integration bug?

2001-04-19 Thread John D. Heintz

I can't directly address the concerns you've raised, but for my project 
I have rewritten TM.py to work better within the begin/vote/finish/abort 
protocol framework.  I've also added more documentation.

John

Randall F. Kern wrote:

 I may just be missing something obvious here, but it seems like there is
 a hole in ZODB.Transaction.Transaction.commit and Shared.DC.ZRDB.TM.TM,
 that can cause external transactions (those that use the TM mixin class,
 like psycopg) to be abandoned (never get committed or rolled back).
 
 Let's say somewhere around line 300 in Transaction.py (the call to
 j.commit(o, self)) we get an exception.  Furthermore, let's say the TM
 derived database object has already been committed (the only effect of
 which is to move the DB into the jars mapping, since TM.tpc_begin() and
 TM.commit() both do nothing).
 
 The exception dumps us down to about line 353, where we call
 _p_jar.abort() on all the uncommitted objects (note: it's important that
 the database connection isn't in this list, because TM.abort() will
 rollback the transaction.  the way we keep the db out of this list is by
 having it appear in objects _before_ the object that failed the commit).
 
 Next we reach line ~366, where we should "unwind TPC for the jars that
 began it".  What this means is calling tpc_abort() on each jar from the
 objects that were already committed (which includes the database).
 However, TM.tpc_abort() does nothing, leaving the external database
 transaction open.
 
 Does this make sense?
 
 If this makes sense (i.e. seems bad :), does catching tpc_abort() in TM
 and calling TM.abort() seem like a valid fix?
 
 Thanks,
 -Randy
 
 ___
 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 Public License (ZPL) Version 1.0
# -
# 
# Copyright (c) Digital Creations.  All rights reserved.
# 
# This license has been certified as Open Source(tm).
# 
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# 
# 1. Redistributions in source code must retain the above copyright
#notice, this list of conditions, and the following disclaimer.
# 
# 2. Redistributions in binary form must reproduce the above copyright
#notice, this list of conditions, and the following disclaimer in
#the documentation and/or other materials provided with the
#distribution.
# 
# 3. Digital Creations requests that attribution be given to Zope
#in any manner possible. Zope includes a "Powered by Zope"
#button that is installed by default. While it is not a license
#violation to remove this button, it is requested that the
#attribution remain. A significant investment has been put
#into Zope, and this effort will continue if the Zope community
#continues to grow. This is one way to assure that growth.
# 
# 4. All advertising materials and documentation mentioning
#features derived from or use of this software must display
#the following acknowledgement:
# 
#  "This product includes software developed by Digital Creations
#  for use in the Z Object Publishing Environment
#  (http://www.zope.org/)."
# 
#In the event that the product being advertised includes an
#intact Zope distribution (with copyright and license included)
#then this clause is waived.
# 
# 5. Names associated with Zope or Digital Creations must not be used to
#endorse or promote products derived from this software without
#prior written permission from Digital Creations.
# 
# 6. Modified redistributions of any form whatsoever must retain
#the following acknowledgment:
# 
#  "This product includes software developed by Digital Creations
#  for use in the Z Object Publishing Environment
#  (http://www.zope.org/)."
# 
#Intact (re-)distributions of any official Zope release do not
#require an external acknowledgement.
# 
# 7. Modifications are encouraged but must be packaged separately as
#patches to official Zope releases.  Distributions that do not
#clearly separate the patches from the original work must be clearly
#labeled as unofficial distributions.  Modifications which do not
#carry the name Zope may be packaged in any form, as long as they
#conform to all of the clauses above.
# 
# 
# Disclaimer
# 
#   THIS SOFTWARE IS PROVIDED BY DIGITAL CREATIONS ``AS IS'' AND ANY
#   EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
#   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
#   PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL DIGITAL CREATIONS OR ITS

[Zope-dev] SmartObjects - Developers needed

2001-04-19 Thread Stephan Richter

Hello everyone,

SmartObjects (at http://demo.iuveno-net.de/iuveno/Products/SmartObjects) is 
not longer only an idea but we are going into some serious design 
discussions and plan to have our first release at the beginning of June 
(see release schedule). Since we want to make the framework as flexible and 
user-friendly as possible, we would love to get input on the design and 
hear about new ideas. Furthermore, we need developers, who would like to 
help!!! The project is totally Open Source.

So, if you are interested, go to 
http://demo.iuveno-net.de/iuveno/Products/SmartObjects and look around. If 
you like what you see, just sign up for the mailing list and join our 
discussion.

Regards,
Stephan

--
Stephan Richter
CBU - Physics and Chemistry Student
Web2k - Web Design/Development  Technical Project Management


___
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] ZSQL and Normalized databases (or why ZSQL sucks)

2001-04-19 Thread The Doctor What

Does any one have an example of ZSQL being used witha normalized
database?  Or is ZSQL just useless?

Near as I can tell, between:
* Broken type marshalling
* Loosing the variable between the form and dtml-if
* Inability to handle table.field names for variables
* And enough flexibility to work around the above problems

This makes ZSQL extreamely nasty, and impossible to use with a
normalized database.

What's the point?  ZSQL sucks, how do I talk to the DB directly?

Yeah, I keep almost getting this to be useful.  But damn it if I
don't keep hitting a brick wall.  And there are no complete examples
or demos that I can find to load up.

Irritatedly yours,
DocWhat

-- 
I don't want to achieve immortality through my work... I want to achieve it through 
not dying.
 -- Woody Allen

The Doctor What: A really hip dude   http://docwhat.gerf.org/
[EMAIL PROTECTED]   KF6VNC

 PGP signature


[Zope-dev] Introducing a New Concept on Advanced Garbage Treatment Process

2001-04-19 Thread zwj

Introducing a new concept on advanced garbage treatment process, and licensing patents
For details, please reference the web site:
http://zwj5382.3322.net
http://zwj5382.163.net
The inventor would like to assign exclusive patent license to anyone who is interested 
in patented advanced garbage treatment process technology.  For patent license, please 
contact the inventor via E-mail:
[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 )



[Zope-dev] how to add to the pythonscript allowed import list?

2001-04-19 Thread R. David Murray

I've got a little Product that does some init hacks.  One of the
things I want to do is expose a couple of python fuctions such that
they can be imported into pythonscripts.  After much spelunking in
the mailing list and the PythonMethods wiki on zope.org, I *think*
that what I need to do is something like this:

--
from AccessControl import ModuleSecurityInfo

security = ModuleSecurityInfo()

security.declarePublic('SignedEditions')
security.declarePublic('stripCardNum','verifyCardNumber')
from cccheck import stripCardNum, verifyCardNumber

security.apply(globals())
--

Now, that SignedEditions one is my attempt to solve the following
error message when I attempt to do 'from SignedEditions import stripCardNum':

Error Type: ImportError
Error Value: import of "SignedEditions" is unauthorized

However, it does not solve the problem.

Hmm.  I just noticed that I forgot to prefix that with "Products.".
Which would seem to make that error message a bug, since SignedEditions
shouldn't exist in the import path.  If I do

from Products.SignedEditions import stripCardNum

then ZDebug tells me:

Unauthorized: Access denied for lt;module 'Products.SignedEditions' from 
'/usr/local/zope/sites/signededitions/Products/SignedEditions/__init__.py'gt; because 
its container, lt;module 'Products' from 
'/usr/local/zope/Zope231b1/lib/python/Products/__init__.pyc'gt;, has no security 
assertions.

What do I need to do to assert that it is OK to import from the
SignedEditions product? The wiki does not seem to address this
question at all, though it implies that it is possible, since it
*does* talk about the above assertions to declare things *inside*
the product as importable.

(Oh, BTW, I tried changing 'security' to "ZopeSecurity", but that didn't
seem to change the behavior).

--RDM


___
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] ZSQL and Normalized databases (or why ZSQL sucks)

2001-04-19 Thread The Doctor What

* The Doctor What ([EMAIL PROTECTED]) [010419 11:57]:
 Does any one have an example of ZSQL being used witha normalized
 database?  Or is ZSQL just useless?
 
 Near as I can tell, between:
 * Broken type marshalling
 * Loosing the variable between the form and dtml-if
 * Inability to handle table.field names for variables
 * And enough flexibility to work around the above problems
 
 This makes ZSQL extreamely nasty, and impossible to use with a
 normalized database.
 
 What's the point?  ZSQL sucks, how do I talk to the DB directly?
 
 Yeah, I keep almost getting this to be useful.  But damn it if I
 don't keep hitting a brick wall.  And there are no complete examples
 or demos that I can find to load up.
 
 Irritatedly yours,
 DocWhat

I would like to apologize for being particularly pissy.  Things are
quite as bad as I say up there...

My third point is only half true.  I can have SQLTEST specify a
column name (aka a field):
dtml-sqltest somevarname column="SQLTABLE.sqlfield" type...

This makes things work MUCH better.  So there are work arounds.  But
this doesn't excuse this not working:
SELECT  table.field1, table.field2 FROM 

and then:
dtml-var name="table.field1"  --doesn't work
dtml-var name="field1" -- does work

I know that the '.' has a special meaning, but there should be ways
around this if the use wants.

I still would love some examples.  Do people end up with 4 ZSQL
objects per thing they manipulate in their database?:
UPDATE, SELECT, INSERT and DELETE?  Or do they mix them somehow?

Ciao!


-- 
Who are you going to believe, me or your own eyes?
-- Groucho Marx

The Doctor What: Need I say more?http://docwhat.gerf.org/
[EMAIL PROTECTED]   KF6VNC

 PGP signature


Re: [Zope-dev] how to add to the pythonscript allowed import list?

2001-04-19 Thread Chris McDonough

This may help:

http://www.zope.org/Documentation/ZDG/Security.dtml (see Using
ModuleSecurityInfo Objects)

I think it will be something along the lines of:

from AccessControl import ModuleSecurityInfo
ModuleSecurityInfo('Products').declarePublic('SignedEditions')
ModuleSecurityInfo('Products.SignedEditions').declarePublic('stripCardNumber
', 'verifyCardNumber')


- Original Message -
From: "R. David Murray " [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, April 19, 2001 1:56 PM
Subject: [Zope-dev] how to add to the pythonscript allowed import list?


 I've got a little Product that does some init hacks.  One of the
 things I want to do is expose a couple of python fuctions such that
 they can be imported into pythonscripts.  After much spelunking in
 the mailing list and the PythonMethods wiki on zope.org, I *think*
 that what I need to do is something like this:

 --
 from AccessControl import ModuleSecurityInfo

 security = ModuleSecurityInfo()

 security.declarePublic('SignedEditions')
 security.declarePublic('stripCardNum','verifyCardNumber')
 from cccheck import stripCardNum, verifyCardNumber

 security.apply(globals())
 --

 Now, that SignedEditions one is my attempt to solve the following
 error message when I attempt to do 'from SignedEditions import
stripCardNum':

 Error Type: ImportError
 Error Value: import of "SignedEditions" is unauthorized

 However, it does not solve the problem.

 Hmm.  I just noticed that I forgot to prefix that with "Products.".
 Which would seem to make that error message a bug, since SignedEditions
 shouldn't exist in the import path.  If I do

 from Products.SignedEditions import stripCardNum

 then ZDebug tells me:

 Unauthorized: Access denied for lt;module 'Products.SignedEditions' from
'/usr/local/zope/sites/signededitions/Products/SignedEditions/__init__.py'g
t; because its container, lt;module 'Products' from
'/usr/local/zope/Zope231b1/lib/python/Products/__init__.pyc'gt;, has no
security assertions.

 What do I need to do to assert that it is OK to import from the
 SignedEditions product? The wiki does not seem to address this
 question at all, though it implies that it is possible, since it
 *does* talk about the above assertions to declare things *inside*
 the product as importable.

 (Oh, BTW, I tried changing 'security' to "ZopeSecurity", but that didn't
 seem to change the behavior).

 --RDM


 ___
 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] ZSQL and Normalized databases (or why ZSQL sucks)

2001-04-19 Thread Paul Browning



--On 19 April 2001 13:00 -0500 The Doctor What [EMAIL PROTECTED] wrote:

 * The Doctor What ([EMAIL PROTECTED]) [010419 11:57]:
 Does any one have an example of ZSQL being used witha normalized
 database?  Or is ZSQL just useless?

[intemperate stuff snipped]

I wouldn't dream of posting to zope-dev myself until
I'd read around a bit. And I've been reading around
for more than a year and I still haven't posted ...


 I still would love some examples.  Do people end up with 4 ZSQL
 objects per thing they manipulate in their database?:
 UPDATE, SELECT, INSERT and DELETE?  Or do they mix them somehow?

 check out the following:

http://www.zope.org/Members/michel/ZB/RelationalDatabases.dtml
and
http://www.zope.org/Documentation/Guides/ZSQL

(the latter is now deprecated but you will find
http://www.zope.org/Documentation/Guides/ZSQL-HTML/ZSQL.1.4.4.html
useful in the present context - look for sql_delimiter)

Paul

--
 The Library, Tyndall Avenue, Univ. of Bristol, Bristol, BS8 1TJ, UK
 E-mail: [EMAIL PROTECTED]  URL: http://www.bris.ac.uk/


___
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] ZSQL and Normalized databases (or why ZSQL sucks)

2001-04-19 Thread Andy McKay

Whats the problem with ZSQL? It calls a sql db with the sql statement, what
more could you want. If you want more, use python.

Cheers.
--
  Andy McKay.


- Original Message -
From: "Paul Browning" [EMAIL PROTECTED]
To: "The Doctor What" [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Thursday, April 19, 2001 11:48 AM
Subject: Re: [Zope-dev] ZSQL and Normalized databases (or why ZSQL sucks)




 --On 19 April 2001 13:00 -0500 The Doctor What [EMAIL PROTECTED] wrote:

  * The Doctor What ([EMAIL PROTECTED]) [010419 11:57]:
  Does any one have an example of ZSQL being used witha normalized
  database?  Or is ZSQL just useless?

 [intemperate stuff snipped]

 I wouldn't dream of posting to zope-dev myself until
 I'd read around a bit. And I've been reading around
 for more than a year and I still haven't posted ...

 
  I still would love some examples.  Do people end up with 4 ZSQL
  objects per thing they manipulate in their database?:
  UPDATE, SELECT, INSERT and DELETE?  Or do they mix them somehow?

  check out the following:

 http://www.zope.org/Members/michel/ZB/RelationalDatabases.dtml
 and
 http://www.zope.org/Documentation/Guides/ZSQL

 (the latter is now deprecated but you will find
 http://www.zope.org/Documentation/Guides/ZSQL-HTML/ZSQL.1.4.4.html
 useful in the present context - look for sql_delimiter)

 Paul

 --
  The Library, Tyndall Avenue, Univ. of Bristol, Bristol, BS8 1TJ, UK
  E-mail: [EMAIL PROTECTED]  URL: http://www.bris.ac.uk/


 ___
 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 )



[Zope-dev] Zope options order sensitive

2001-04-19 Thread Chris Gray


I'm just beginning my study of the zope source.  Going through z2.py I
noticed that order matters in specifying command line options.

For instance:   ./start -a 127.0.0.1 -P 8000
sets HTTP_PORT to:  [('127.0.0.1', '8080')]
but:./start -P 8000 -a 127.0.0.1
sets HTTP_PORT to:  [('', '8080')]

I'm not far enough along yet to know if this makes a difference in the
end.  Does it?

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 )



[Zope-dev] Opening the Zope repository...

2001-04-19 Thread Brian Lloyd

Hi folks. Feedback would be much appreciated on this, especially 
any potential issues we may have missed:


http://dev.zope.org/Wikis/DevSite/Proposals/OpenTheZopeRepository



Brian Lloyd[EMAIL PROTECTED]
Software Engineer  540.371.6909  
Digital Creations  http://www.digicool.com 




___
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] Opening the Zope repository...

2001-04-19 Thread Andy McKay

That's a great idea. Obligatory code reviews are great but might be too much
work at this point.
--
  Andy McKay.


- Original Message -
From: "Brian Lloyd" [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, April 19, 2001 12:50 PM
Subject: [Zope-dev] Opening the Zope repository...


 Hi folks. Feedback would be much appreciated on this, especially
 any potential issues we may have missed:


 http://dev.zope.org/Wikis/DevSite/Proposals/OpenTheZopeRepository



 Brian Lloyd[EMAIL PROTECTED]
 Software Engineer  540.371.6909
 Digital Creations  http://www.digicool.com




 ___
 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] Zope options order sensitive

2001-04-19 Thread Chris McDonough

Not really... do you want to only listen on 127.0.0.1?

- Original Message - 
From: "Chris Gray" [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, April 19, 2001 3:43 PM
Subject: [Zope-dev] Zope options order sensitive


 
 I'm just beginning my study of the zope source.  Going through z2.py I
 noticed that order matters in specifying command line options.
 
 For instance:   ./start -a 127.0.0.1 -P 8000
 sets HTTP_PORT to:  [('127.0.0.1', '8080')]
 but:./start -P 8000 -a 127.0.0.1
 sets HTTP_PORT to:  [('', '8080')]
 
 I'm not far enough along yet to know if this makes a difference in the
 end.  Does it?
 
 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 )
 


___
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] how to add to the pythonscript allowed import list?

2001-04-19 Thread R. David Murray

On Thu, 19 Apr 2001, Chris McDonough wrote:
 http://www.zope.org/Documentation/ZDG/Security.dtml (see Using
 ModuleSecurityInfo Objects)
 
 I think it will be something along the lines of:
 
 from AccessControl import ModuleSecurityInfo
 ModuleSecurityInfo('Products').declarePublic('SignedEditions')
 ModuleSecurityInfo('Products.SignedEditions').declarePublic('stripCardNumber
 ', 'verifyCardNumber')

Thanks, that worked!

I'm going to file a collector report on that misleading error message.

Also, I did read stuff very similar to the text you pointed me to above,
in the PythonMethods wiki.  Clearly, it did *not* tell me as a developer
how to do what the text is saying it is telling me how to do: make it
so I can import a function in a pythonscript.  So I think you should
add a note about the need for the ModuleSecurityInfo('Products').declarePublic
call, and incorporate it into the example (or another example).

Also, the text makes a distinction between marking "external" modules
and marking "embedded" modules.  The former uses the spelling above,
the latter the "security = ModuleSecurityInfo()" spelling.  As far as
I can see, what I am doing is the *latter* case, and what I tried
naively following the directions did not work, but this external
spelling did.  So something needs to be clarified there, as well.

I've filed this as a tracker comment on the ZDG, as well.

--RDM


___
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] Zope options order sensitive

2001-04-19 Thread Chris Gray

The example was fictional; the ips and ports have been changed to protect
the guilty.  I'm more interested in just understanding how the code works.

It just struck me that given the way the server_info function works in
z2.py that you could get a situation where you meant to have zope
listening on only one address (specified with an -a option), but if
options for particular ports are specified for a server, it will listen to
that port for all addresses.  An -a will have no effect on what is set by 
-m, -w, -W, -f, or -P if -a appears on the command line after them.

./start -f 21 -a special.zope.ip

will set Zope listening only on the ip address special.zope.ip except it
will be listening at _all_ addresses on the machine for ftp requests on
port 21, which might not be the result the user intended.  It is not the
same as:

./start -f special.zope.ip:21 -a special.zope.ip

Chris


On Thu, 19 Apr 2001, Chris McDonough wrote:

 Not really... do you want to only listen on 127.0.0.1?
 
 - Original Message - 
 From: "Chris Gray" [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Thursday, April 19, 2001 3:43 PM
 Subject: [Zope-dev] Zope options order sensitive
 
 
  
  I'm just beginning my study of the zope source.  Going through z2.py I
  noticed that order matters in specifying command line options.
  
  For instance:   ./start -a 127.0.0.1 -P 8000
  sets HTTP_PORT to:  [('127.0.0.1', '8080')]
  but:./start -P 8000 -a 127.0.0.1
  sets HTTP_PORT to:  [('', '8080')]
  
  I'm not far enough along yet to know if this makes a difference in the
  end.  Does it?
  
  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 )
  
 


___
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] Zope options order sensitive

2001-04-19 Thread Chris McDonough

I understand.  Congratulations!  You've found your first bug!  ;-)

Can you file this with the Collector at
http://classic.zope.org:8080/Collector ?


- Original Message -
From: "Chris Gray" [EMAIL PROTECTED]
To: "Chris McDonough" [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Thursday, April 19, 2001 4:21 PM
Subject: Re: [Zope-dev] Zope options order sensitive


 The example was fictional; the ips and ports have been changed to protect
 the guilty.  I'm more interested in just understanding how the code works.

 It just struck me that given the way the server_info function works in
 z2.py that you could get a situation where you meant to have zope
 listening on only one address (specified with an -a option), but if
 options for particular ports are specified for a server, it will listen to
 that port for all addresses.  An -a will have no effect on what is set by
 -m, -w, -W, -f, or -P if -a appears on the command line after them.

 ./start -f 21 -a special.zope.ip

 will set Zope listening only on the ip address special.zope.ip except it
 will be listening at _all_ addresses on the machine for ftp requests on
 port 21, which might not be the result the user intended.  It is not the
 same as:

 ./start -f special.zope.ip:21 -a special.zope.ip

 Chris


 On Thu, 19 Apr 2001, Chris McDonough wrote:

  Not really... do you want to only listen on 127.0.0.1?
 
  - Original Message -
  From: "Chris Gray" [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Thursday, April 19, 2001 3:43 PM
  Subject: [Zope-dev] Zope options order sensitive
 
 
  
   I'm just beginning my study of the zope source.  Going through z2.py I
   noticed that order matters in specifying command line options.
  
   For instance:   ./start -a 127.0.0.1 -P 8000
   sets HTTP_PORT to:  [('127.0.0.1', '8080')]
   but:./start -P 8000 -a 127.0.0.1
   sets HTTP_PORT to:  [('', '8080')]
  
   I'm not far enough along yet to know if this makes a difference in the
   end.  Does it?
  
   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 )
  
 




___
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] how to add to the pythonscript allowed import list?

2001-04-19 Thread Chris McDonough

  I think it will be something along the lines of:
 
  from AccessControl import ModuleSecurityInfo
  ModuleSecurityInfo('Products').declarePublic('SignedEditions')
 
ModuleSecurityInfo('Products.SignedEditions').declarePublic('stripCardNumber
  ', 'verifyCardNumber')

 Thanks, that worked!

 I'm going to file a collector report on that misleading error message.

I'm not sure much will be done about it. ;-)


 Also, I did read stuff very similar to the text you pointed me to above,
 in the PythonMethods wiki.  Clearly, it did *not* tell me as a developer
 how to do what the text is saying it is telling me how to do: make it
 so I can import a function in a pythonscript.  So I think you should
 add a note about the need for the
ModuleSecurityInfo('Products').declarePublic
 call, and incorporate it into the example (or another example).

Yes, the wiki is broken.  So is the help system for that matter.  Sigh.

 Also, the text makes a distinction between marking "external" modules
 and marking "embedded" modules.  The former uses the spelling above,
 the latter the "security = ModuleSecurityInfo()" spelling.  As far as
 I can see, what I am doing is the *latter* case, and what I tried
 naively following the directions did not work, but this external
 spelling did.  So something needs to be clarified there, as well.

The fundamental problem is that you need to make explicit declarations for
all packages along the import path.  So making a declaration for a module
that is inside a package won't allow you to import that module unless you've
made security declarations for the containing package.  Since the "Products"
package had no declarations, it was disallowing access.

This is rather confusing and I need to not only fix the ZDG but understand a
bunch of use cases that aren't covered in it.

 I've filed this as a tracker comment on the ZDG, as well.

Thanks!

 --RDM




___
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] Zope development firm in Canada

2001-04-19 Thread John Stevenson, idrc.ca

Hello Zope-Dev -

We are looking for a firm that can take on a large Zope developement
project. We need to hire a Canadian firm to do most or all of the work.
Please contact me at the email addres below.

Thanks -

John Stevenson
--
Web Strategist
International Development Research Centre, Ottawa
[EMAIL PROTECTED]
http://www.idrc.ca



___
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] ZSQL and Normalized databases (or why ZSQL sucks)

2001-04-19 Thread The Doctor What

* Andy McKay ([EMAIL PROTECTED]) [010419 14:26]:
 Whats the problem with ZSQL? It calls a sql db with the sql statement, what
 more could you want. If you want more, use python.

How?!?!  Documentation? Examples?

Ciao!

-- 
A fail-safe circuit will destroy others.
  -- Klipstein

The Doctor What: Guru to the Godshttp://docwhat.gerf.org/
[EMAIL PROTECTED]   KF6VNC

 PGP signature


Re: [Zope-dev] ZSQL and Normalized databases (or why ZSQL sucks)

2001-04-19 Thread Paul Erickson

The Doctor What wrote:
 
 * The Doctor What ([EMAIL PROTECTED]) [010419 11:57]:
  Does any one have an example of ZSQL being used witha normalized
  database?  Or is ZSQL just useless?
 
  Near as I can tell, between:
  * Broken type marshalling
  * Loosing the variable between the form and dtml-if

I don't understand this.  I'm assuming that you are losing values that
are not in your argument list.  All you have to do is add the arguments.

  * Inability to handle table.field names for variables
  * And enough flexibility to work around the above problems
 
  This makes ZSQL extreamely nasty, and impossible to use with a
  normalized database.

Database normalization isn't really an issue.  It sounds like you're
really just having problems with the syntax of joins.

 
  What's the point?  ZSQL sucks, how do I talk to the DB directly?

Grab the Python database adapter and write some python classes or
external methods to do what you need.

 
  Yeah, I keep almost getting this to be useful.  But damn it if I
  don't keep hitting a brick wall.  And there are no complete examples
  or demos that I can find to load up.
 
  Irritatedly yours,
  DocWhat
 
 I would like to apologize for being particularly pissy.  Things are
 quite as bad as I say up there...
 
 My third point is only half true.  I can have SQLTEST specify a
 column name (aka a field):
 dtml-sqltest somevarname column="SQLTABLE.sqlfield" type...
 
 This makes things work MUCH better.  So there are work arounds.

This isn't a work-around, it is the way that it is intended to be used.

  But
 this doesn't excuse this not working:
 SELECT  table.field1, table.field2 FROM 
 
 and then:
 dtml-var name="table.field1"  --doesn't work
 dtml-var name="field1" -- does work
 
 I know that the '.' has a special meaning, but there should be ways
 around this if the use wants.

Again, I think that it's a matter of understanding how ZSQL works,
rather than a limitation of ZSQL.  If you have column name conflicts,
you can always use something like:

SELECT a.field as a_field, b.field as b_field FROM ...

Then refer to them in dtml like dtml-a_field; or dtml-var
name="a_field"

 
 I still would love some examples.  Do people end up with 4 ZSQL
 objects per thing they manipulate in their database?:
 UPDATE, SELECT, INSERT and DELETE?  Or do they mix them somehow?

I typically wind up with a ZSQL method for each of the CRUD operations. 
Sometimes I have separate selects methods for more complex joins, if the
DTML code gets too ugly when I try to combine them into a single method.


Example of a fairly typical join statement (for MySQL database):

Arguments-
begin_date:date end_date:date="2037-01-01"

SELECT search_string, search_result,  search_date, result_category,
legal_category.name
FROM search_log LEFT JOIN legal_category ON
search_log.result_category=legal_category.code

dtml-sqlgroup required where
  dtml-sqltest name="begin_date" op="gt" type="nb"
  column="search_date"
dtml-and
  dtml-sqltest name="end_date" type="nb" op="lt"
  column="search_date" optional
/dtml-sqlgroup

Good Luck

-Paul

___
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] ZSQL and Normalized databases (or why ZSQL sucks)

2001-04-19 Thread The Doctor What

* Paul Erickson ([EMAIL PROTECTED]) [010419 17:02]:
 The Doctor What wrote:
   * Loosing the variable between the form and dtml-if
 
 I don't understand this.  I'm assuming that you are losing values that
 are not in your argument list.  All you have to do is add the arguments.

That isn't what I mean.  Try this (typed in, so it may need to be
adjusted):
paramfoo=0/param
dtml-if expr="foo != 0"Life is good/dtml-if

You'll NEVER get Life is good to print out.  EVER.  This is because
ZSQL is setting foo to 0.  But dtml-var and dtml-sqlvar both work.

   * Inability to handle table.field names for variables
   * And enough flexibility to work around the above problems
  
   This makes ZSQL extreamely nasty, and impossible to use with a
   normalized database.
 
 Database normalization isn't really an issue.  It sounds like you're
 really just having problems with the syntax of joins.

Nope, can do joins.  Been doing joins (mainly inner).  Not the
problem.  The problem is that if I have tables like:
Table1
--
id
name
desc

Table2
--
id
Table1ID   -- Foreign Key thrown in for fun.
name
desc

And I join them, then I MUST rename all the selects using AS:
select
  Table1.id as id1
  Table1.name as name1
...etc

Because I can't have zsql put the variables in the caller's
namespace as "Table1.id".  It puts them in as "id" (without the AS).

Fortunately, I found the column for sqltest (which is the other end
of ZSQL):
dtml-sqltest id1 column="Table1.id" 

  
   What's the point?  ZSQL sucks, how do I talk to the DB directly?
 
 Grab the Python database adapter and write some python classes or
 external methods to do what you need.

Can I use them from a python script?  If not, what's the point?  I
mean: External methods are nice to have when you have *no other
choice*, but they aren't something I'd want to debug and deal with
for object.

  This makes things work MUCH better.  So there are work arounds.
 
 This isn't a work-around, it is the way that it is intended to be used.

I didn't see a single example of it.  The Zope Book didn't mention
this at all (except as a single line reference).  I would *never*
have gone looking for the word column.  Why? It's a field!

 Again, I think that it's a matter of understanding how ZSQL works,
 rather than a limitation of ZSQL.  If you have column name conflicts,
 you can always use something like:
 
 SELECT a.field as a_field, b.field as b_field FROM ...
 
 Then refer to them in dtml like dtml-a_field; or dtml-var
 name="a_field"

Right, but you still have to do extra work to get them back into a
ZSQL object.  column lets you do that.  It's got no examples to help
out with.  It's documented once.  I didn't see it.  Life is better
now.

  I still would love some examples.  Do people end up with 4 ZSQL
  objects per thing they manipulate in their database?:
  UPDATE, SELECT, INSERT and DELETE?  Or do they mix them somehow?
 
 I typically wind up with a ZSQL method for each of the CRUD operations. 
 Sometimes I have separate selects methods for more complex joins, if the
 DTML code gets too ugly when I try to combine them into a single method.

 
 Example of a fairly typical join statement (for MySQL database):
 
 Arguments-
 begin_date:date end_date:date="2037-01-01"
 
 SELECT search_string, search_result,  search_date, result_category,
 legal_category.name
 FROM search_log LEFT JOIN legal_category ON
 search_log.result_category=legal_category.code
 
 dtml-sqlgroup required where
   dtml-sqltest name="begin_date" op="gt" type="nb"
   column="search_date"
 dtml-and
   dtml-sqltest name="end_date" type="nb" op="lt"
   column="search_date" optional
 /dtml-sqlgroup

Hey!  An example!

 Good Luck

Thanks.  So I'm still having trouble.  I can't get any of the list
examples to work.

I build a select multiple list, and then try to dtml-in on it.  It
doesn't seem to work.  REQUEST shows in it th other and form
namespaces, as a list, but I can't actually dtml-var it or anything.

Example:
qdtml-var dalistp
br
dtml-in VirtualRootPhysicalPath
ddtml-var sequence-itemb
/dtml-in
hr
dtml-var REQUEST

If you call this with this URL (substitute as needed):
http://docwhat.gerf.org:9673/links/test?dalist%0D%0A%3Alist=1dalist%0D%0A%3Alist=3dalist%0D%0A%3Alist=8

Which is the URL pattern formed by a SELECT name="dalist:list"
multiple

Then you get errors on dalist.  The examples at
http://www.zope.org/Members/AlexR/SelectionLists

Don't work as exactl above.

Help?

Ciao!

-- 
Outside of a dog, a book is a man's best friend.  Inside a dog it's too dark to read.
-- Groucho Marx

The Doctor What: Need I say more?http://docwhat.gerf.org/
[EMAIL PROTECTED]   KF6VNC

 PGP signature


Re: [Zope-dev] ZSQL and Normalized databases (or why ZSQL sucks)

2001-04-19 Thread The Doctor What

 Thanks.  So I'm still having trouble.  I can't get any of the list
 examples to work.
 
 I build a select multiple list, and then try to dtml-in on it.  It
 doesn't seem to work.  REQUEST shows in it th other and form
 namespaces, as a list, but I can't actually dtml-var it or anything.
 
 Example:
 qdtml-var dalistp
 br
 dtml-in VirtualRootPhysicalPath
 ddtml-var sequence-itemb
 /dtml-in
 hr
 dtml-var REQUEST
 
 If you call this with this URL (substitute as needed):
 
http://docwhat.gerf.org:9673/links/test?dalist%0D%0A%3Alist=1dalist%0D%0A%3Alist=3dalist%0D%0A%3Alist=8
 
 Which is the URL pattern formed by a SELECT name="dalist:list"
 multiple
 
 Then you get errors on dalist.  The examples at
 http://www.zope.org/Members/AlexR/SelectionLists
 
 Don't work as exactl above.
 
 Help?

My problem. I decoded the %0D and %0A (newline and space) and
figured out that I foo-barred a bit of code.  I'm happy again.  It
works great with only the %3A.  It *is* weird that it looked correct
on the REQUEST output. :-S

Thanks anyway.

Ciao!

-- 
If you want to make God laugh, tell him about your plans.
 -- Woody Allen

The Doctor What: Not that 'who' guy  http://docwhat.gerf.org/
[EMAIL PROTECTED]   KF6VNC

 PGP signature


Re: [Zope-dev] WebDAV locking module?

2001-04-19 Thread richard

Martijn Pieters wrote:
 
 On Thu, Apr 19, 2001 at 09:43:02AM +1000, [EMAIL PROTECTED] wrote:
  Colour me confused...
 
  I just downloaded the 2.3.2 beta tarball and tried to run our application
  against it. It appears that the locking module (webdav.Lockable) is missing
  from webdav. We develop against the CVS, and the file is there. It has been
  since 2.3.1 CVS - though the 2.3.1 tarball doesn't seem to have the module
  either...
 
 No it hasn't. It is in the trunk CVS, the 2.3 branch does not have the
 WebDAV locks feature. Are you sure your CVS checkout is a branch checkout?

I checkout the source using the command on the zope web site:

% cvs -d :pserver:[EMAIL PROTECTED]:/cvs-repository login
% cvs -z7 -d :pserver:[EMAIL PROTECTED]:/cvs-repository checkout Zope2

What's this branch you speak of?


Richard

-- 
Richard Jones
[EMAIL PROTECTED]
Senior Software Developer, Bizar Software (www.bizarsoftware.com.au)

___
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] ZSQL and Normalized databases (or why ZSQL sucks)

2001-04-19 Thread Casey Duncan

The Doctor What wrote:
 
 * Paul Erickson ([EMAIL PROTECTED]) [010419 17:02]:
  The Doctor What wrote:
* Loosing the variable between the form and dtml-if
 
  I don't understand this.  I'm assuming that you are losing values that
  are not in your argument list.  All you have to do is add the arguments.
 
 That isn't what I mean.  Try this (typed in, so it may need to be
 adjusted):
 paramfoo=0/param
 dtml-if expr="foo != 0"Life is good/dtml-if
 
 You'll NEVER get Life is good to print out.  EVER.  This is because
 ZSQL is setting foo to 0.  But dtml-var and dtml-sqlvar both work.
 

Reason: foo=0 is actually foo='0'. foo:int=0 should work like you want.

 
  Database normalization isn't really an issue.  It sounds like you're
  really just having problems with the syntax of joins.
 
 Nope, can do joins.  Been doing joins (mainly inner).  Not the
 problem.  The problem is that if I have tables like:
 Table1
 --
 id
 name
 desc
 
 Table2
 --
 id
 Table1ID   -- Foreign Key thrown in for fun.
 name
 desc
 
 And I join them, then I MUST rename all the selects using AS:
 select
   Table1.id as id1
   Table1.name as name1
 ...etc
 
 Because I can't have zsql put the variables in the caller's
 namespace as "Table1.id".  It puts them in as "id" (without the AS).
 
 Fortunately, I found the column for sqltest (which is the other end
 of ZSQL):
 dtml-sqltest id1 column="Table1.id" 
 

This is a function of your field naming convention more than anything.
Granted you don't always have control over that. I am surprised that
name="spam.eggs" doesn't work on sqltests (it works everywhere else).
Are you explicitly saying name="..."? that could be the problem, bare
quoting assumes expr="..." where periods are significant.
 
 Can I use them from a python script?  If not, what's the point?  I
 mean: External methods are nice to have when you have *no other
 choice*, but they aren't something I'd want to debug and deal with
 for object.

Python scripts are quite helpful for calling ZSQL methods. Just remember
to pass REQUEST or the arguments explicitly.

hth,
-- 
| 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] ZSQL and Normalized databases (or why ZSQL sucks)

2001-04-19 Thread The Doctor What

* Casey Duncan ([EMAIL PROTECTED]) [010419 17:45]:
 Reason: foo=0 is actually foo='0'. foo:int=0 should work like you want.

Same behaviour.  I opened a bug in the collector a while ago about
this:
http://classic.zope.org:8080/Collector/2053/view

A related bug:
http://classic.zope.org:8080/Collector/2045/view


 This is a function of your field naming convention more than anything.
 Granted you don't always have control over that. I am surprised that
 name="spam.eggs" doesn't work on sqltests (it works everywhere else).
 Are you explicitly saying name="..."? that could be the problem, bare
 quoting assumes expr="..." where periods are significant.

It works with sqltest, actually.  But since a lot of people have
examples of chaining the namespaces, this breaks that and adds more
work since you can't alias (via AS) to dotted names.

  Can I use them from a python script?  If not, what's the point?  I
  mean: External methods are nice to have when you have *no other
  choice*, but they aren't something I'd want to debug and deal with
  for object.
 
 Python scripts are quite helpful for calling ZSQL methods. Just remember
 to pass REQUEST or the arguments explicitly.

Yeah, I like that, but it's still not perfect, and the docs are
incomplete and scattered.  We need a system to pull together like
documents at zope.org

Ciao!

-- 
Line Printer paper is strongest at the perforations.

The Doctor What: Not that 'who' guy  http://docwhat.gerf.org/
[EMAIL PROTECTED]   KF6VNC

 PGP signature


Re: [Zope-dev] Zope options order sensitive

2001-04-19 Thread Chris Gray

Hmmm... perhaps an undocumented feature rather than a bug?  Rereading the
doc string I find the description of the -X option mentions a case of
argument order making a difference; -X cancels preceding port options but
not following ones.

On Thu, 19 Apr 2001, Chris McDonough wrote:

 I understand.  Congratulations!  You've found your first bug!  ;-)
 
 Can you file this with the Collector at
 http://classic.zope.org:8080/Collector ?
 
 
 - Original Message -
 From: "Chris Gray" [EMAIL PROTECTED]
 To: "Chris McDonough" [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Sent: Thursday, April 19, 2001 4:21 PM
 Subject: Re: [Zope-dev] Zope options order sensitive
 
 
  The example was fictional; the ips and ports have been changed to protect
  the guilty.  I'm more interested in just understanding how the code works.
 
  It just struck me that given the way the server_info function works in
  z2.py that you could get a situation where you meant to have zope
  listening on only one address (specified with an -a option), but if
  options for particular ports are specified for a server, it will listen to
  that port for all addresses.  An -a will have no effect on what is set by
  -m, -w, -W, -f, or -P if -a appears on the command line after them.
 
  ./start -f 21 -a special.zope.ip
 
  will set Zope listening only on the ip address special.zope.ip except it
  will be listening at _all_ addresses on the machine for ftp requests on
  port 21, which might not be the result the user intended.  It is not the
  same as:
 
  ./start -f special.zope.ip:21 -a special.zope.ip
 
  Chris
 
 
  On Thu, 19 Apr 2001, Chris McDonough wrote:
 
   Not really... do you want to only listen on 127.0.0.1?
  
   - Original Message -
   From: "Chris Gray" [EMAIL PROTECTED]
   To: [EMAIL PROTECTED]
   Sent: Thursday, April 19, 2001 3:43 PM
   Subject: [Zope-dev] Zope options order sensitive
  
  
   
I'm just beginning my study of the zope source.  Going through z2.py I
noticed that order matters in specifying command line options.
   
For instance:   ./start -a 127.0.0.1 -P 8000
sets HTTP_PORT to:  [('127.0.0.1', '8080')]
but:./start -P 8000 -a 127.0.0.1
sets HTTP_PORT to:  [('', '8080')]
   
I'm not far enough along yet to know if this makes a difference in the
end.  Does it?
   
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] How do I call an HTMLFile in context provided by apath

2001-04-19 Thread Itai Tavor

Tres Seaver wrote:

Itai Tavor [EMAIL PROTECTED] wrote:

  Dieter Maurer wrote:

  Itai Tavor writes:
 P.S Now that aq_parent is working... why can't I do
 absolute_url() on DTMLFiles :-(
  "absolute_url" is provided by the class "OFS.Traverable".
  Apparently, "DTMLFile" is not derived from it.
  
  
  Dieter

  Well, obviously... the question is why nobody saw the need to add
  Traversable to DTMLFiles...

DTMLFiles are supposed to function as *methods* of their classes;
methods *don't* have their own 'absolute_url', but return the url
of the object on which they are called.  DTMLMethods have exactly
the same semantics:

   dtml-var absolute_url

returns the folder/context object's URL, by design.

Tres.

Thanks for replying, and sorry for getting so long to get back to 
your answer. Had a fun week recovering from a hack attack.

Ok, so DTMLFile.absolute_url() should return its container. Except... 
DTMLFiles simply don't have absolute_url - their own or inherited. 
They return an attribute error.

I was going to post a feature request to the collector, but if 
absolute_url on a DTMLFile will return the container, then it's 
pretty useless.

Itai
-- 
--
Itai Tavor  -- "Je sautille, donc je suis."--
[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 )



[Zope-dev] CVS trunk vs 2.3 branch (Was: WebDAV locking module?)

2001-04-19 Thread Martijn Pieters

On Fri, Apr 20, 2001 at 08:49:12AM +1000, [EMAIL PROTECTED] wrote:
 I checkout the source using the command on the zope web site:
 
 % cvs -d :pserver:[EMAIL PROTECTED]:/cvs-repository login
 % cvs -z7 -d :pserver:[EMAIL PROTECTED]:/cvs-repository checkout Zope2
 
 What's this branch you speak of?

That is the trunk, the main line on the CVS server, that you are checking
out. Once a Zope second-dot version goes gold, however, it gets it's own
release branch, onto which we only check in bug fixes and very small
features (if they are of direct benefit).

So, the Zope 2.3 series has its own branch, called zope-2_3-branch. To
check out from that branch, add '-d zope-2_3-branch' to your checkout
command (I use the short 'co' for it):

  % cvs -z7 -d :pserver:[EMAIL PROTECTED]:/cvs-repository co -d zope-2_3-branch 
Zope2

Or you can switch an existing CVS sandbox to that tree by using the update
command ('up' is the short version) in the root directory of the sandbox:

  % cvs -z7 up -d zope-2_3-branch

Don't forget to recompile the extensions!

Especially if you are using the sandbox for production systems, or
development ment for production systems, you really want to avoid using
the trunk! We will *very* soon be switching the trunk to requiring Python
2.1, and as you discovered, new features in the trunk will not be found in
current releases. That's why we use this system..

-- 
Martijn Pieters
| Software Engineer  mailto:[EMAIL PROTECTED]
| Digital Creations  http://www.digicool.com/
| Creators of Zope   http://www.zope.org/
-

___
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] ZCatalog.indexes()

2001-04-19 Thread Chris McDonough

It's going to stay in there for the time being.  If it needs to go away,
it won't be yanked without a deprecation period that will be more
clearly announced than the this should go away in the wiki.

Chris Withers wrote:
 
 Hi,
 
 I read in the interfaces wiki (I think :-S) that the indexes() method of
 ZCatalog is being deprecated.
 Is this still accurate?
 
 If so, how _should_ I be asking a ZCatalog for a list of it's indexes? I'd also
 like to know their types if possible :-)
 
 cheers,
 
 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 )

___
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 )