[Zope-dev] Recursion

2000-05-26 Thread Andre Schubert

Hi,

I'm writing a python Extension, which searches in any folder
recursively.

This means the code:

def foo(self,counter=None):
some code
if bar == somewhat:
foo(counter=some_int)

When i run this through zope a error occours. Zope says expected 1
argument got 0.
My question is what argument is missing.

mfg as


___
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] Recursion

2000-05-26 Thread Phil Harris

I'd imagine self would be missing.

There would seem to be two ways to 'fix' this, I'll leave it as an exercise
for the reader to discuss which is best.

Option 1:
def foo(self,counter=None):
some code
if bar == somewhat:
self.foo(counter=some_int)

Option 2:
def foo(self,counter=None):
some code
if bar == somewhat:
foo(self,counter=some_int)

hth

Phil
[EMAIL PROTECTED]


- Original Message -
From: "Andre Schubert" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, May 26, 2000 9:02 AM
Subject: [Zope-dev] Recursion


> Hi,
>
> I'm writing a python Extension, which searches in any folder
> recursively.
>
> This means the code:
>
> def foo(self,counter=None):
> some code
> if bar == somewhat:
> foo(counter=some_int)
>
> When i run this through zope a error occours. Zope says expected 1
> argument got 0.
> My question is what argument is missing.
>
> mfg as
>
>
> ___
> 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] russian-specific things

2000-05-26 Thread Bo Berkhaut

Hi!

As you maybe know, there are at least _three_ standard encodings
for russian cyrillic: koi8-r, which is used in most unices,
Windows codepage 1251 and iso8859-5, which is used in some commercial systems
(like HPUX). The common workaround for this problem is server-side
detection of client OS type. For given OS, web-server decides which encoding
is necessary and recodes the document on-fly. Such functionality is implemented
as an Apache module which is widely used across russian net.

My question is (are you already guessed? good!):
(1) is there anybody implemented such thing for Zope?
(2) if not, what is the right place to implement such functionality?
I mean, what component of Zope should cope whith such things?
Zope architecture is not my best, so maybe some of Zope guys can point me?

Thanks,

--bo





-- 
bo berkhaut
http://www.ethereal.ru/~bo
--

___
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] Session Objects?

2000-05-26 Thread Stuart 'Zen' Bishop

On Wed, 24 May 2000, Morten W. Petersen wrote:

> Are there sheets with these (and similar) notes anywhere on zope.org?
> If not, maybe there should be?

There is the tips section - I've just added this.

-- 
Stuart Bishop  Work: [EMAIL PROTECTED]
Senior Systems Alchemist   Play: [EMAIL PROTECTED]
Computer Science, RMIT


___
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] Problems with LoginManager form-based login

2000-05-26 Thread Stuart 'Zen' Bishop

On Wed, 24 May 2000, Phillip J. Eby wrote:

> This is a problem that apparently can only be solved by replicating
> ZPublisher's backward walk, which is the wrong thing to do because the
> traversal will be O(n^2).  Bleah.  I guess we'll have to do something like
> Stuart Bishop's backward walk in the GUF, since any enhancement of the
> ZPublisher architecture to handle login forms properly won't happen until
> at least 2.2.

The backward walk stuff (which I don't think ever worked - every time
I fixed one case it seemed I'd break another) has been torn out and
replaced with code that does what you are after. Grab a copy of the
latest version and search for 'WooHoo' in GenericUserFolder.py

> Meanwhile, I suppose Ty and I should try to come up with a proposal for
> revising ZPublisher to be able to walk back on the user lookups but still
> use the login form closest to the URL being accessed.

-- 
Stuart Bishop  Work: [EMAIL PROTECTED]
Senior Systems Alchemist   Play: [EMAIL PROTECTED]
Computer Science, RMIT


___
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] Recursion

2000-05-26 Thread Duncan Booth

> There would seem to be two ways to 'fix' this, I'll leave it as an exercise
> for the reader to discuss which is best.
> 
> Option 1:
> def foo(self,counter=None):
> some code
> if bar == somewhat:
> self.foo(counter=some_int)
Option 1 has a problem. If you give it a different name in dtml, e.g. 
bar and call it:  then self is a reference 
to the folder and self.foo doesn't exist. If there is a different method 
'foo' in the folder that other method will be called instead.

> 
> Option 2:
> def foo(self,counter=None):
> some code
> if bar == somewhat:
> foo(self,counter=some_int)
> 
This one should work as advertised. (Unless you redefine foo in the 
python module in which case you get what you deserve).

-- 
Duncan Booth [EMAIL PROTECTED]
int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3"
"\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure?
http://dales.rmplc.co.uk/Duncan

___
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] russian-specific things

2000-05-26 Thread Oleg Broytmann

Hi!

   Have you subscribed to Russian Python/Zope Mailing Lits?
echo subscribe python | mail [EMAIL PROTECTED]
   http://www.glasnet.ru/~jno/Python/

On Fri, 26 May 2000, Bo Berkhaut wrote:
> As you maybe know, there are at least _three_ standard encodings
> for russian cyrillic: koi8-r, which is used in most unices,
> Windows codepage 1251 and iso8859-5, which is used in some commercial systems
> (like HPUX). The common workaround for this problem is server-side
> detection of client OS type. For given OS, web-server decides which encoding
> is necessary and recodes the document on-fly. Such functionality is implemented
> as an Apache module which is widely used across russian net.
> 
> My question is (are you already guessed? good!):
> (1) is there anybody implemented such thing for Zope?

   No, though Zope Internationalization Mailing List discussed this.

> (2) if not, what is the right place to implement such functionality?
> I mean, what component of Zope should cope whith such things?
> Zope architecture is not my best, so maybe some of Zope guys can point me?

Oleg.(All opinions are mine and not of my employer)
 
Oleg Broytmann  Foundation for Effective Policies  [EMAIL PROTECTED]
   Programmers don't die, they just GOSUB without RETURN.


___
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] DateTime objects's and ZCatalog

2000-05-26 Thread Jason Spisak

Shane Hathaway:

> Jason,
> 
> I've looked over your DTML and I can't quite get a fix on what's going
> on (then again, I'm not very familiar with dtml-calendar.)  If you'd
> send more details I might be able to help, but only in my spare time
> I'm afraid...

That's actually a very generous offer.  Thanks.  Basically I am wondering
if calling my extenal method is creating the DataTime instances or the call
to: _.int(date)/10 is?

Here's the external method:

> > external method:
> > 
> > def calendar_day(self)
> > return int(self.calendar_date)/10
> > 

The code that really matters I guess is :

> >   > meta_types=['Interview', 'Call', 'Appointment', 'Deal'],
> > calendar_day=_.int(date)/10))">

BTW, the memory issue is causing me to restart my *server* everyday.  Even
when I shut down the Zope process, the memory doesn't fall out of cache.
I'm going to make this a separate message.

Thanks again,

Jason Spisak
CIO
HireTechs.com
6151 West Century Boulevard
Suite 900
Los Angeles, CA 90045
P. 310.665.3444
F. 310.665.3544

Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email
address may not be added to any commercial mail list with out my
permission.  Violation of my privacy with advertising or SPAM will
result in a suit for a MINIMUM of $500 damages/incident, $1500 for
repeats.

___
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: Memory issue 2.1.6 (Hemophelia)

2000-05-26 Thread Jason Spisak

Shane and others:

Currently I have to restart the *server* that Zope runs on everyday in
order to get the memory tat Zope claims in cache back.  Even when I stop
the Zope process, the cache doesn't clear.  Is there a command in Linux to
force that cache to clear?  Also, after a clean reboot, I tried to pack,
and there is nothing left of my 1 gig of memory, and it swapped a bit. :( 

Is there anyway to nail down what is causing the bleeding?  I have reduced
the number of object stored in cache and even flushed the cache in Zope,
but it never reclaims all the memory.  What can I do to keep investigating?
Tools?  Stats that will help?

Hoping to nail this,

Jason Spisak
CIO
HireTechs.com
6151 West Century Boulevard
Suite 900
Los Angeles, CA 90045
P. 310.665.3444
F. 310.665.3544

Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email
address may not be added to any commercial mail list with out my
permission.  Violation of my privacy with advertising or SPAM will
result in a suit for a MINIMUM of $500 damages/incident, $1500 for
repeats.

___
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] Memory 2.1.4-2.1.6 a.k.a. how to get objects out of the cache

2000-05-26 Thread Jason Spisak

Eric Sattler:

> Jason,
> 
> I don't have time right now to post this to the zope
> newsgroup, but we are bleeding profusely, and could
> use any insight you might have...
> 

Unfortunately just before recieving your message, I fired another one out
because I have run out of tests. :(

> 
> I also am having severe problems with memory creep.  Our problem
> exhibits itself by quickly using gobs of memory and eventually requiring
> a
> zope restart.
> 
> First our configuration:
> 
> Core Components:
> 
> FreeBSD 4.0/FreeBSD 3.4 - on separate machines of course
> Postgres 6.5.3/Postgres 7.0(fixes some memory leaks)
> Python 1.5.2
> Zope 2.1.4/2.1.6
> Apache w/mod_ssl 1.3.9 and 1.3.12
> 
> Products:
> 
> ZPySQLDA
> SQLSession
> GenericUserFolder
> 

There was recently a post that detained a leak in a database product.  I
can't remeber if it was SQLSession, or what.

> I have looked at a lot of different things.  This includes:
> 
> Installing the gc(garbage collection) python package
> Installing Postgres 7.0(fixes some connection memory leaks)
> Tracking the cache cleanup inside zope
> Tracking thread locking inside DB.py, Transaction.py
> 
> Results:
> 
> gc python didn't help alleviate the problem
> Postgres 7.0 instead of 6.5.3 didn't help the problem
> 
> I do see GenericUserFolder and SQLSession objects with the
> Control_Panel_Debug screen, and they do not seem to go away.  I wrote
> a simple python script to do nothing more than authenticate (log in)
> using the GenericUserFolder method docLogin.  The memory usage quickly
> grows out of control.  After waiting 15 minutes(my cookie timeout),
> no decrease in memory usage.  The objects are still in the cache also.

This is consistant with what I remember seeing on the list.  I don't use
any external databases, so my situation is really an argument for their
being something amiss in Zope or Python.

> 
> Questions:
> 
> 1.  How does a user's connection resources etc. get cleaned up
> by Zope after a cookie timeout?  Do I need to do this myself?
> 

I don't use cookie here.

> 2.  How does a genericuserfolder's set of objects used by an
> 
> authenticated user get cleaned up.  I can't seem to make those
> objects get reclaimed by the system, even when the user logs
> off?  is there a magic cache setting somewhere?
> 

Or GUF.

> 3.  I am not explicitly removing SQLSession objects.  Will my usage
> counts for these objects remain > 1, thereby never allowing them
> to get cleaned up, and thereby keeping my usage counts for
> genericuserfolder's > 1?
> 
> 4.  Since GenericUserFolder inherits from Folder objects, is it
> possible that the reason my memory grows so fast is that Zope
> does not release the resources used by a user properly, during
> an abrupt disconnect?

That's funny that I am experienceing the same symptoms as you, but my
installation is totally different. I'm not using GUF, or any DA's, and I'm
running on RH 6.1.  We really need to figure this out as a community.  I am
willing to try just about anything short of shipping my machine somewhere
off premisis. ;)

Bledding on the floor,

Jason Spisak
CIO
HireTechs.com
6151 West Century Boulevard
Suite 900
Los Angeles, CA 90045
P. 310.665.3444
F. 310.665.3544

Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email
address may not be added to any commercial mail list with out my
permission.  Violation of my privacy with advertising or SPAM will
result in a suit for a MINIMUM of $500 damages/incident, $1500 for
repeats.

___
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] Problems with LoginManager form-based login

2000-05-26 Thread Phillip J. Eby

At 07:11 PM 5/26/00 +1000, Stuart 'Zen' Bishop wrote:
>On Wed, 24 May 2000, Phillip J. Eby wrote:
>
>> This is a problem that apparently can only be solved by replicating
>> ZPublisher's backward walk, which is the wrong thing to do because the
>> traversal will be O(n^2).  Bleah.  I guess we'll have to do something like
>> Stuart Bishop's backward walk in the GUF, since any enhancement of the
>> ZPublisher architecture to handle login forms properly won't happen until
>> at least 2.2.
>
>The backward walk stuff (which I don't think ever worked - every time
>I fixed one case it seemed I'd break another) has been torn out and
>replaced with code that does what you are after. Grab a copy of the
>latest version and search for 'WooHoo' in GenericUserFolder.py

Been there, done that.  Yours doesn't work either, btw.  Well, actually, it
does, it's just that it causes a memory leak because it leaves an
unintended circular reference.  We've got a version that fixes the circular
reference, but in a really really ugly way (it does a run-time patch to
BaseRequest.close() to remove the poked-in unauthorized() method).  It will
be in LM 0.8.6, which we're trying to finish now.  We might have had it
done today, but there was a bomb threat in one of the buildings in the
complex where we work and we were evacuated for a couple hours.

LM 0.8.6 also works with Zope 2.2 as far as being able to be added,
although I'm not sure it interoperates properly with the new security API.
It will still be backward compatible with Zope 2.1.6 either way, though.

___
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: Memory issue 2.1.6 (Hemophelia)

2000-05-26 Thread Matthew T. Kromer

on 5/26/00 1:04 PM, Jason Spisak at [EMAIL PROTECTED] wrote:

> Shane and others:
> 
> Currently I have to restart the *server* that Zope runs on everyday in
> order to get the memory tat Zope claims in cache back.  Even when I stop
> the Zope process, the cache doesn't clear.  Is there a command in Linux to
> force that cache to clear?  Also, after a clean reboot, I tried to pack,
> and there is nothing left of my 1 gig of memory, and it swapped a bit. :(
> 
> Is there anyway to nail down what is causing the bleeding?  I have reduced
> the number of object stored in cache and even flushed the cache in Zope,
> but it never reclaims all the memory.  What can I do to keep investigating?
> Tools?  Stats that will help?
> 
> Hoping to nail this,

I'm extremely curious that the cache doesn't clear when you restart Zope.
One would normally not expect to see this.  Can you do a "ps xauww" and mail
it to me / the list?  Also a "free" would be helpful too.  Under linux,
shared memory is amongst the last to be scavenged in low memory conditions.
I'm curious to see if something is allocating that memory as shared or what.

You might also try an "ipcs -a" command to make sure it's not SYSV type
shared memory (which can stick around even after a process exits.)
-- 
Matthew T. Kromer
[EMAIL PROTECTED]
[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] Using FSSession from an external method

2000-05-26 Thread Lindell Alderman

I am trying to use FSSession from an external method.  I have no problem
reading from the Session or updating a dictionary in the Session.  My
problem is that I cannot delete or change any of the entries in the Session
from my external method.  Could this an initialization issue or could
it be a permissions issue?  I can't seem to track it down.

-L


___
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] Memory 2.1.4-2.1.6 a.k.a. how to get objects out of the cache

2000-05-26 Thread Bill Anderson

Jason Spisak wrote:

[...]

> That's funny that I am experienceing the same symptoms as you, but my
> installation is totally different. I'm not using GUF, or any DA's, and I'm
> running on RH 6.1.  We really need to figure this out as a community.  I am
> willing to try just about anything short of shipping my machine somewhere
> off premisis. ;)


Ok, let's dig up some more info ( or perhaps I missed it ).

Server setup, as in pcgi/Zserver/Apache w/proxypass, etc?
Compiled on the machine, or binary distribution?

If source, did you start with a clean tree, or did use use the diff
upgrade, or did you use a new 2.1.6 tarball, and drop it on top of the
2.1.4 install?

Bill

___
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] Problems with LoginManager form-based login

2000-05-26 Thread Evan Simpson

- Original Message -
From: Phillip J. Eby <[EMAIL PROTECTED]>
> Been there, done that.  Yours doesn't work either, btw.  Well, actually,
it
> does, it's just that it causes a memory leak because it leaves an
> unintended circular reference.  We've got a version that fixes the
circular
> reference, but in a really really ugly way (it does a run-time patch to
> BaseRequest.close() to remove the poked-in unauthorized() method).

The GUF version, at least, doesn't need this drastic a fix.  Adding the
following line to the top of guf_unauthorized should suffice:

del request.RESPONSE.unauthorized

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] Problems with LoginManager form-based login

2000-05-26 Thread Phillip J. Eby

At 03:05 PM 5/26/00 -0400, Evan Simpson wrote:
>- Original Message -
>From: Phillip J. Eby <[EMAIL PROTECTED]>
>> Been there, done that.  Yours doesn't work either, btw.  Well, actually,
>it
>> does, it's just that it causes a memory leak because it leaves an
>> unintended circular reference.  We've got a version that fixes the
>circular
>> reference, but in a really really ugly way (it does a run-time patch to
>> BaseRequest.close() to remove the poked-in unauthorized() method).
>
>The GUF version, at least, doesn't need this drastic a fix.  Adding the
>following line to the top of guf_unauthorized should suffice:
>
>del request.RESPONSE.unauthorized
>

You're making the assumption that unauthorized gets called.  If it doesn't
get called (because the current user *does* exist in a higher-level
folder), then the hook will never get released.


___
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] Z SQL: "optional" isn't?

2000-05-26 Thread Kyler B. Laird


I'd like to build a Z SQL method for *many*
people to use to list courses that we offer.
I don't want to require that all queries
using it understand all of the columns, but
I do want to be able to modify the query in
many ways.

So...after reading
http://yyy.zope.org/Documentation/Guides/ZSQL-HTML/ZSQL.1.5.3.html
optional 

A flag indicating if the test is optional.
If the test is optional and no value is 
provided for a variable, or the value
provided is an invalid empty string, then
no text is inserted.
I thought I could just use "optional"
with all of my sqltests.
select * from course_catalog











This works only if I provide at least an empty
string for all values.  If I don't provide a
value at all for one of the arguments, I get
Error, Bad Request: ['version'] 

SQL used:

Could not render the query template!
Traceback (innermost last):
  File /data/www/Zope/Zope-2.2.0a1-src/lib/python/ZPublisher/Publish.py, line 
224, in publish_module
  File /data/www/Zope/Zope-2.2.0a1-src/lib/python/ZPublisher/Publish.py, line 
189, in publish
  File /data/www/Zope/Zope-2.2.0a1-src/lib/python/Zope/__init__.py, line 221, 
in zpublisher_exception_hook
(Object: list_courses)
  File /data/www/Zope/Zope-2.2.0a1-src/lib/python/ZPublisher/Publish.py, line 
175, in publish
  File /data/www/Zope/Zope-2.2.0a1-src/lib/python/ZPublisher/mapply.py, line 
160, in mapply
(Object: manage_test)
  File /data/www/Zope/Zope-2.2.0a1-src/lib/python/ZPublisher/Publish.py, line 
112, in call_object
(Object: manage_test)
  File /data/www/Zope/Zope-2.2.0a1-src/lib/python/Shared/DC/ZRDB/DA.py, line 
347, in manage_test
(Object: list_courses)
  File /data/www/Zope/Zope-2.2.0a1-src/lib/python/Shared/DC/ZRDB/DA.py, line 
324, in manage_test
(Object: list_courses)
  File /data/www/Zope/Zope-2.2.0a1-src/lib/python/Shared/DC/ZRDB/DA.py, line 
426, in __call__
(Object: list_courses)
  File /data/www/Zope/Zope-2.2.0a1-src/lib/python/Shared/DC/ZRDB/Aqueduct.py, 
line 150, in _argdata
(Object: list_courses)
Bad Request: (see above)

Looking at Aqueduct.py, I don't understand why it's
not catching the "optional" arg.  Using my limited
Python knowledge, I commented out lines 149 and 150
of Aqueduct.py and now it works great.

Once again, I'm glad that I can add these awful
kludges instead of waiting for the vendor, but this
is something that I hope is fixed soon.

--kyler

___
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] Z SQL: "optional" isn't?

2000-05-26 Thread jpenny

On Fri, May 26, 2000 at 02:59:38PM -0500, Kyler B. Laird wrote:
> 
> I'd like to build a Z SQL method for *many*
> people to use to list courses that we offer.
> I don't want to require that all queries
> using it understand all of the columns, but
> I do want to be able to modify the query in
> many ways.
> 
> So...after reading
>   http://yyy.zope.org/Documentation/Guides/ZSQL-HTML/ZSQL.1.5.3.html
>   optional 
> 
>   A flag indicating if the test is optional.
>   If the test is optional and no value is 
>   provided for a variable, or the value
>   provided is an invalid empty string, then
>   no text is inserted.
> I thought I could just use "optional"
> with all of my sqltests.
>   select * from course_catalog
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   

I have never used that corner of ZSQL methods.  I have a guesses.
I think that the method is working fine, but the nature of HTTP
posting is giving you trouble.  Remember, a REQUEST typically only
contains non-null fields.

There are three suggestions on fixing this. 

1)  preseed the calling form by putting in a
 BEFORE the form.
This way, normal acquisition will get you an empty string
even if there is no value entered in the form.

2) A bit more of a pain, but certainly doable.
Remember that you can use ordinary  logic
in a ZSQL method.  You can use choose among multiple
cases in a single method.  But, here you have 16 cases,
which is unpleasant.  Is it really true that ALL of these
can be simultaneosly empty?

3) Considerable more pain, with some loss of safety.
Construct the body of your method on the fly.  Pass it
in as an argument, and call that.  For certain forms, this
is necessary (if for example the user can modify the form
generation process).


___
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] Setuid code not possible w/new Security API

2000-05-26 Thread Phillip J. Eby

In previous versions of Zope, it was possible to do "setuid" code by
setting AUTHENTICATED_USER to a new user, then resetting when code
completed.  Zope 2.2 loses this ability, as it has absolutely no API for
setting or stacking the "current user", without completely replacing the
ZopeSecurityPolicy.

This is problematic for things like GUF and GUS which want to execute
certain through-the-web objects *as* a particular user.  Not as a mask
between that user and the current user, but *as* that user, because the
object is in the process of finding out what roles the logging-in user has.

Currently, it would seem the only way to do this in bounds of the current
ZopeSecurityPolicy is to poke into getSecurityManager()._context.user,
which seems like a bad idea.  There is already a getUser() method on the
SecurityManager; Should there perhaps be a setUser() (or _setUser()) method
as well?


___
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] [Fwd: ZCatalog.. Again.. I know..]

2000-05-26 Thread R. David Murray

On Wed, 24 May 2000, Chris Withers wrote:
> This is weird... the bit of code in question was:
> lib/python/SearchIndex/Lexicon.py line 132:
[...]
> Now Michel's patch was to change this to:
> else:
> self.counter = self.counter + 1
> self._lexicon[intern(word)] = self.counter
> return self.counter

I patched my 2.1.4 site with the above code, and my key errors
and wrong-results went away.  My site has 60K records being
searched, so this constitues a fairly good test.

> However, in the CVS I see it is now:
> else:
> if not hasattr(self, 'counter'):
> self.counter = 0
> self._lexicon[intern(word)] = self.counter
> self.counter = self.counter + 1
> return self.counter - 1 

This *looks* like it might also work.  We'll just have to wait
for Michel's pronouncement.

--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] Problems with LoginManager form-based login

2000-05-26 Thread Evan Simpson

- Original Message -
From: Phillip J. Eby <[EMAIL PROTECTED]>
> >The GUF version, at least, doesn't need this drastic a fix.  Adding the
> >following line to the top of guf_unauthorized should suffice:
> >
> >del request.RESPONSE.unauthorized
> >
>
> You're making the assumption that unauthorized gets called.  If it doesn't
> get called (because the current user *does* exist in a higher-level
> folder), then the hook will never get released.

D'oh!  How 'bout if REQUEST.close() were to always do a
self.__dict__.clear()?

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] newbie question: parameter passing for ZSQL Object

2000-05-26 Thread Grakka

1. Check that your parameters ara on scope
2. try the following: 
...And in the ZSQL method define your dtml-vars as  (etc)

zope wrote:
> 
> Hi.
> 
> With some values that I got from a formular, I wan't to do some calculation
> stuff, and insert the calculated values into a database.
> 
> My Z SQL method'insertItem' looks like
> 
> Arguments: param1, param2, param3, param4
> 
> INSERT INTO plan
> (field1, field2, field3, field4)
> VALUES
> (, , , )
> 
> (parameters should be integer values)
> 
> Can anybody tell me how I can call this method and pass parameters from my
> DTML method?
> 
> With , Zope gives me following error message:
> 
> Zope has encountered an error while publishing this resource.
> Error Type: Bad Request
> Error Value: ['param1', 'param2', 'param3', 'param4']
> 
> I was checking then "ZSQL Methods User's Guide" but, they don't  give an
> example :-(
> 
> Please help. Any idea?
> 
> Thanks, Marc.
> 
> ___
> 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 )