Re: [Zope-dev] PlugIns.py bug.... (was incorrectly ZPatterns: transaction bug)

2000-09-05 Thread Steve Spicklemire


OK I think I found the actual intent of aq_base() in _checkId of PlugIns.py:

if hasattr(aq_base(self), id):
# The object is located in this ObjectManager.
if not flags  REPLACEABLE:
raise 'Bad Request', ('The id "%s" is invalid - ' \
  'it is already in use.' % id)
# else the object is replaceable even if the UNIQUE
# flag is set.
elif flags  UNIQUE:
raise 'Bad Request', \
  ('The id "%s" is reserved.' % id)

it comes from the ObjectManager _checkId which has basically the same
code execpt it ObjectManager.py also has the needed:

from Acquisition import aq_base

which PlugIns.py does not..  so looking at Acquisition.c it appears
that there is no real difference between

hasattr(aq_base(self), id)

which calls 

  if (WRAPPER(self)-obj)
{
  r=WRAPPER(self)-obj;
  while (isWrapper(r)  WRAPPER(r)-obj) r=WRAPPER(r)-obj;
}
  else r=Py_None;
  Py_INCREF(r);
  return r;

and hasattr( self.aq_base, id) which calls

case 'b':
  if (strcmp(name,"base")==0)
{
  if (self-obj)
{
  r=self-obj;
  while (isWrapper(r)  WRAPPER(r)-obj) r=WRAPPER(r)-obj;
}
  else r=Py_None;
  Py_INCREF(r);
  return r;
}
  break;

Anyway.. it looks like either fix is OK... I guess!

-steve

 "Steve" == Steve Spicklemire [EMAIL PROTECTED] writes:

Steve ZPatterns 0.4.2a1 PlugIns.py bug?

Steve I get a 'Name Error' aq_base when I hit the following code
Steve while trying to update the index_html method of one of my
Steve Specialists from CVSMixin.. I think that this would get hit
Steve anytime you add an object whose id is already in the
Steve acquisition path

Steve -steve

Steve diff -c -r1.1.1.2 PlugIns.py *** PlugIns.py 2000/09/04
Steve 14:17:29 1.1.1.2 --- PlugIns.py 2000/09/04 18:53:17
Steve *** *** 265,271  # An object by the given
Steve id exists either in this # ObjectManager or in the
Steve acquisition path.  flags = getattr(obj, '__replaceable__',
Steve NOT_REPLACEABLE) !  if hasattr(aq_base(self), id): # The
Steve object is located in this ObjectManager.  if not flags 
Steve REPLACEABLE: raise 'Bad Request', ('The id "%s" is invalid
Steve - ' \ --- 265,271  # An object by the given id exists
Steve either in this # ObjectManager or in the acquisition path.
Steve flags = getattr(obj, '__replaceable__', NOT_REPLACEABLE) !
Steve if hasattr(self.aq_base, id): # The object is located in
Steve this ObjectManager.  if not flags  REPLACEABLE: raise 'Bad
Steve Request', ('The id "%s" is invalid - ' \

Steve ___ Zope-Dev
Steve maillist - [EMAIL PROTECTED]
Steve http://lists.zope.org/mailman/listinfo/zope-dev ** No cross
Steve posts or HTML encoding!  ** (Related lists -
Steve http://lists.zope.org/mailman/listinfo/zope-announce
Steve 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] PlugIns.py bug.... (was incorrectly ZPatterns: transaction bug)

2000-09-05 Thread Phillip J. Eby

At 08:46 AM 9/5/00 -0500, Steve Spicklemire wrote:

OK I think I found the actual intent of aq_base() in _checkId of PlugIns.py:
...
it comes from the ObjectManager _checkId which has basically the same
code execpt it ObjectManager.py also has the needed:

from Acquisition import aq_base


Fixed in my CVS.  Thanks!


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