Re: [Zope-dev] NASTY error. Why?

2000-07-10 Thread Dieter Maurer

Chris Withers writes:
 > I'm trying to do a tree walk and copy with:
 > 
 > 
 >  
 >  Created  in 
 >  
 >
 >
 >
 > 
 > etc...
 > 
 > but I get the following truly horrible error from the manage_addFolder
 > 
 > any ideas?
 > 
 > Chris
 > 
 > Error Type: TypeError
 > Error Value: read-only character buffer, Python Method
"manage_addFolder" wants to have a string argument (that is
what "read-only character buffer" usually means).
Instead, it get a "Python Method".

Explanation:
  "id" is often a method returning a string, not directly a string.
  Sometimes, i.e. for some classes, it is the string itself.

You may use "_['id']". This is equivalent to "id()", if
"id" is callable and to "id", if it is not.


Dieter

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )




RE: [Zope-dev] NASTY error. Why?

2000-07-10 Thread Brian Lloyd

> Interesting commentary from the Interfaces Wiki:
> 
> http://www.zope.org/Members/michel/Projects/Interfaces/ObjectM
> anagerItem
> 
> """Some old objects provide id methods that return ids. This practice
> should be avoided for new objects. We can't change the old objects for
> backward compatability reasons. Maybe we should fix this in 
> Zope 3.0."""

This is one of the things on my List Of Evil Things that 
should be changed one day in Zope3K :)


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] NASTY error. Why?

2000-07-10 Thread Steve Alexander

Chris Withers wrote:
> 
> Chris Withers wrote:
> > Can someone please tell me why folder.id is a method and
> > everything-else.id is a string?
> 
> Sorry, that should be folder.id is a string and everything-else.id is a
> method.

Interesting commentary from the Interfaces Wiki:

http://www.zope.org/Members/michel/Projects/Interfaces/ObjectManagerItem

"""Some old objects provide id methods that return ids. This practice
should be avoided for new objects. We can't change the old objects for
backward compatability reasons. Maybe we should fix this in Zope 3.0."""

--
Steve Alexander
Software Engineer
Cat-Box limited
http://www.cat-box.net

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )




Re: [Zope-dev] NASTY error. Why?

2000-07-10 Thread Chris Withers

Chris Withers wrote:
> Can someone please tell me why folder.id is a method and
> everything-else.id is a string?

Sorry, that should be folder.id is a string and everything-else.id is a
method.

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] NASTY error. Why?

2000-07-10 Thread Chris Withers

Evan,

Thanks, that worked...

Evan Simpson wrote:
> 
> From: Chris Withers <[EMAIL PROTECTED]>
> 
> >  
> 
> > Error Type: TypeError
> > Error Value: read-only character buffer, Python Method
> 
> Looks like the 'id' of something along the line is a method rather than a
> string.  Try "_.getitem('id', 1)".

I thought I'd seen it all when it came to Zope being bad, but this is
TRULY horrible, it even beats (_,_.None,...) and I thought that would
never happen...

Can someone please tell me why folder.id is a method and
everything-else.id is a string?

Should I chuck this in the collector? (I think I will anyway! :P)

Excuse me while I go off to be sick ;-)

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] NASTY error. Why?

2000-07-10 Thread Evan Simpson

From: Chris Withers <[EMAIL PROTECTED]>

>  

> Error Type: TypeError
> Error Value: read-only character buffer, Python Method

Looks like the 'id' of something along the line is a method rather than a
string.  Try "_.getitem('id', 1)".

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] NASTY error. Why? More...

2000-07-10 Thread Chris Withers

Found the problem, now what's the solution:

Chris Withers wrote:
> 
>  

 in this context returns a Python Method object.

WHY?! ;-)

In a more constructive tone, how can I get the string id from this?

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] NASTY error. Why?

2000-07-10 Thread Chris Withers

Hi,

I'm trying to do a tree walk and copy with:


 
 Created  in 
 
   
   
   

...etc...

but I get the following truly horrible error from the manage_addFolder

any ideas?

Chris

Error Type: TypeError
Error Value: read-only character buffer, Python Method

Traceback (innermost last):
  File /usr/local/zope/2-1-6/lib/python/ZPublisher/Publish.py, line 214,
in publish_module
  File /usr/local/zope/2-1-6/lib/python/ZPublisher/Publish.py, line 179,
in publish
  File /usr/local/zope/2-1-6/lib/python/Zope/__init__.py, line 202, in
zpublisher_exception_hook
(Object: ElementWithAttributes)
  File /usr/local/zope/2-1-6/lib/python/ZPublisher/Publish.py, line 165,
in publish
  File /usr/local/zope/2-1-6/lib/python/ZPublisher/mapply.py, line 160,
in mapply
(Object: start)
  File /usr/local/zope/2-1-6/lib/python/ZPublisher/Publish.py, line 102,
in call_object
(Object: start)
  File /usr/local/zope/2-1-6/lib/python/OFS/DTMLMethod.py, line 150, in
__call__
(Object: start)
  File /usr/local/zope/2-1-6/lib/python/DocumentTemplate/DT_String.py,
line 502, in __call__
(Object: start)
  File /usr/local/zope/2-1-6/lib/python/DocumentTemplate/DT_With.py,
line 148, in render
(Object: o-e-s)
  File /usr/local/zope/2-1-6/lib/python/OFS/DTMLMethod.py, line 146, in
__call__
(Object: iterate)
  File /usr/local/zope/2-1-6/lib/python/DocumentTemplate/DT_String.py,
line 502, in __call__
(Object: iterate)
  File /usr/local/zope/2-1-6/lib/python/DocumentTemplate/DT_In.py, line
691, in renderwob
(Object: objectValues)
  File /usr/local/zope/2-1-6/lib/python/DocumentTemplate/DT_Util.py,
line 335, in eval
(Object: REQUEST['where'][-1].manage_addFolder(id))
(Info: REQUEST)
  File , line 0, in ?
  File /usr/local/zope/2-1-6/lib/python/OFS/Folder.py, line 119, in
manage_addFolder
(Object: ElementWithAttributes)
  File /usr/local/zope/2-1-6/lib/python/OFS/ObjectManager.py, line 231,
in _setObject
(Object: ElementWithAttributes)
  File /usr/local/zope/2-1-6/lib/python/OFS/ObjectManager.py, line 200,
in _checkId
(Object: ElementWithAttributes)
  File /usr/local/zope/2-1-6/lib/python/ts_regex.py, line 139, in match
TypeError: (see above)

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