ro a écrit :
> On 5/18/07, sophana <[EMAIL PROTECTED]> wrote:
>> ro a écrit :
>> > hi all
>> >
>> > I meet a problem
>> > I write a _get_ function in my class:
>> >
>> > class Page(SQLObject):
>> >     ...
>> >     def _get_link_copy_by_space(self, space_id):
>> >     ....
>> >         return None
>> >
>> > And while I call this function by such code:
>> > page = Page.get(page_id)
>> > page.link_copy_by_space(space.id)
>> >
>> > sqlobject give me this error:
>> > TypeError: _get_link_copy_by_space() takes exactly 2 arguments (1
>> given)
>> >
>> > I dont know what is the argument I missed.
>> >
>> >
>> have you tried this?
>> def link_copy_by_space(self, space_id): ...
>
> Yes, if define this function as a normal function is OK.
> I just want to know why deos it cause that error as a _get_ function
>
I think it's because the _get_ feature is to add virtual attributes, not
methods.
You are trying to add a method, not an attribute.
An _get_attribute does not get any additionnal argument I think.
You add methods the standard way.

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to