Hi Bing,
Dear all:
A bug in Z SQL method wasted my whole precious morning! Write
That's what bugs are supposed to do, if not wasting whole precious days!
replaced argument name "client" to "clientname" , then everything is fine.
Woo, but WHY???? what's inside this? I didn't read this at anywhere. Is there still more like this ahead?
Apparently "client" is something like a reserved variable/keyword, and you'd better not use these words for your own variables. Same case for "id" and probably many more variable names. It would be nice indeed to have a list somewhere on zope.org or in the book with 'forbidden variable names'. (Debugger: Aiieeee! "client" is an FVN!) Enjoy the remaining of your afternoon, Roger
Hi, Roger: Thanks. I agree, a whole morning is not that bad. But the point is the name is "client" but not "id", I know "id" should be avoid of, but who expects "client"? And the most important is that, there's nowhere mentioned "client", and supposely explicitly specified argument or variable should override other thing except reserved keyword of python language, is that right? OK, I checked python documentation, "client" is not a reserved keyword. My understanding is that something named "client" is used in the same namespace, if this is some internal one and must reside in the same space with arguments, it should be renamed to "__client__" for better. Anyway, I am grateful for guys who brings Zope out. It's true flexible and amazing :-) I wish this bug fixed ASAP. Thanks Ren Bing -----Original Message----- From: Roger Erens [mailto:rerens@dela.org] Sent: Tuesday, March 26, 2002 4:49 PM To: 'Ren Bing' Cc: 'zope@zope.org' Subject: Forbidden Variable Names Hi Bing,
Dear all:
A bug in Z SQL method wasted my whole precious morning! Write
That's what bugs are supposed to do, if not wasting whole precious days!
replaced argument name "client" to "clientname" , then everything is fine.
Woo, but WHY???? what's inside this? I didn't read this at anywhere. Is there still more like this ahead?
Apparently "client" is something like a reserved variable/keyword, and you'd better not use these words for your own variables. Same case for "id" and probably many more variable names. It would be nice indeed to have a list somewhere on zope.org or in the book with 'forbidden variable names'. (Debugger: Aiieeee! "client" is an FVN!) Enjoy the remaining of your afternoon, Roger
Ren, Would you be able to submit the bug's symptom and your solution to the Collector at http://collector.zope.org ? That way it has a chance of getting fixed. Thanks! - C ----- Original Message ----- From: "Ren Bing" <bing.ren@eastip.com> To: "Roger Erens" <rerens@dela.org> Cc: <zope@zope.org> Sent: Tuesday, March 26, 2002 4:02 AM Subject: [Zope] RE: Forbidden Variable Names
Hi, Roger:
Thanks. I agree, a whole morning is not that bad. But the point is the name is "client" but not "id", I know "id" should be avoid of, but who expects "client"? And the most important is that, there's nowhere mentioned "client", and supposely explicitly specified argument or variable should override other thing except reserved keyword of python language, is that right? OK, I checked python documentation, "client" is not a reserved keyword.
My understanding is that something named "client" is used in the same namespace, if this is some internal one and must reside in the same space with arguments, it should be renamed to "__client__" for better.
Anyway, I am grateful for guys who brings Zope out. It's true flexible and amazing :-) I wish this bug fixed ASAP.
Thanks
Ren Bing
-----Original Message----- From: Roger Erens [mailto:rerens@dela.org] Sent: Tuesday, March 26, 2002 4:49 PM To: 'Ren Bing' Cc: 'zope@zope.org' Subject: Forbidden Variable Names
Hi Bing,
Dear all:
A bug in Z SQL method wasted my whole precious morning! Write
That's what bugs are supposed to do, if not wasting whole precious days!
replaced argument name "client" to "clientname" , then everything is fine.
Woo, but WHY???? what's inside this? I didn't read this at anywhere. Is there still more like this ahead?
Apparently "client" is something like a reserved variable/keyword, and you'd better not use these words for your own variables. Same case for "id" and probably many more variable names.
It would be nice indeed to have a list somewhere on zope.org or in the book with 'forbidden variable names'. (Debugger: Aiieeee! "client" is an FVN!)
Enjoy the remaining of your afternoon,
Roger
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
On Tue, Mar 26, 2002 at 09:50:18AM -0500, Chris McDonough wrote:
Ren,
Would you be able to submit the bug's symptom and your solution to the Collector at http://collector.zope.org ? That way it has a chance of getting fixed.
Thanks!
- C
Actually, it is kind of interesting that this bug is being exercised at all. "client" is not a string in lib/python/Products/ZSQL/*.py, lib/python/Products/ZSQL/*/*, lib/python/Shared/DC/ZRDB/*.py, or lib/python/Shared/DC/*/*. So, where is it being defined? On the other hand, if you define a dtml method that has only contents <dtml-var client>, a name space violation is raised, suggesting that it is not a part of normal acquisition. Jim Penny
----- Original Message ----- From: "Ren Bing" <bing.ren@eastip.com> To: "Roger Erens" <rerens@dela.org> Cc: <zope@zope.org> Sent: Tuesday, March 26, 2002 4:02 AM Subject: [Zope] RE: Forbidden Variable Names
Hi, Roger:
Thanks. I agree, a whole morning is not that bad. But the point is the name is "client" but not "id", I know "id" should be avoid of, but who expects "client"? And the most important is that, there's nowhere mentioned "client", and supposely explicitly specified argument or variable should override other thing except reserved keyword of python language, is that right? OK, I checked python documentation, "client" is not a reserved keyword.
My understanding is that something named "client" is used in the same namespace, if this is some internal one and must reside in the same space with arguments, it should be renamed to "__client__" for better.
Anyway, I am grateful for guys who brings Zope out. It's true flexible and amazing :-) I wish this bug fixed ASAP.
Thanks
Ren Bing
-----Original Message----- From: Roger Erens [mailto:rerens@dela.org] Sent: Tuesday, March 26, 2002 4:49 PM To: 'Ren Bing' Cc: 'zope@zope.org' Subject: Forbidden Variable Names
Hi Bing,
Dear all:
A bug in Z SQL method wasted my whole precious morning! Write
That's what bugs are supposed to do, if not wasting whole precious days!
replaced argument name "client" to "clientname" , then everything is fine.
Woo, but WHY???? what's inside this? I didn't read this at anywhere. Is there still more like this ahead?
Apparently "client" is something like a reserved variable/keyword, and you'd better not use these words for your own variables. Same case for "id" and probably many more variable names.
It would be nice indeed to have a list somewhere on zope.org or in the book with 'forbidden variable names'. (Debugger: Aiieeee! "client" is an FVN!)
Enjoy the remaining of your afternoon,
Roger
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
On Tuesday 26 March 2002 09:04 am, Jim Penny wrote:
On Tue, Mar 26, 2002 at 09:50:18AM -0500, Chris McDonough wrote:
Ren,
Would you be able to submit the bug's symptom and your solution to the Collector at http://collector.zope.org ? That way it has a chance of getting fixed.
Thanks!
- C
Actually, it is kind of interesting that this bug is being exercised at all. "client" is not a string in lib/python/Products/ZSQL/*.py, lib/python/Products/ZSQL/*/*, lib/python/Shared/DC/ZRDB/*.py, or lib/python/Shared/DC/*/*. So, where is it being defined?
DocumentTemplate/DT_String.py ZSQL Methods are dtml with some extra tags. -kapil
Ren Bing writes:
But the point is the name is "client" but not "id", I know "id" should be avoid of, but who expects "client"? And the most important is that, there's nowhere mentioned "client", and supposely explicitly specified argument or variable should override other thing except reserved keyword of python language, is that right? OK, I checked python documentation, "client" is not a reserved keyword.
The following happens in your case: The DTML object's "__call__" is defined by def __call__(client=None, REQUEST=None, **kw) The ZSQL method wants to call it with itself as client (to allow the DTML object to use acquisition) and the provided arguments as keywords. It probably calls it with something like: apply(self.source,(self,),kw) and Python raises the exception you saw, because "client" got two values. "client" is mentioned many times -- in the context of DTML objects. And the body of a Z SQL method is a DTML object. I do not blame you that you did not recognize this. It is very natural. On the other hand, it is really difficult to document and catch all such potential issues. The best possible solution would be that Z SQL methods would check for such name clashes and provide a meaningful error message. Please file a bug report to <http://collector.zope.org>. Dieter
participants (6)
-
Chris McDonough -
Dieter Maurer -
Jim Penny -
kapil thangavelu -
Ren Bing -
Roger Erens