Hi,

I have a problem when i perform a select() on a model with an 
"ReferenceProperty" Field.
I'am getting this error:

*("'ReferenceProperty' object has no attribute 'startswith'",)*
*
*
related but nor sure it's the same:
https://groups.google.com/forum/?fromgroups#!topic/web2py/M7civkMWRyo

and it occurs at this line in dal.py:

    def represent(self, obj, fieldtype):
*        field_is_type = fieldtype.startswith*
        if isinstance(obj, CALLABLETYPES):
            obj = obj()
        if isinstance(fieldtype, SQLCustomType):
            return fieldtype.encoder(obj)
        if isinstance(obj, (Expression, Field)):
            raise SyntaxError("non supported on GAE")
        if self.dbengine == 'google:datastore':
            if isinstance(fieldtype, gae.Property):
                return obj


Now, at the time the exception occurs the Fieldtype is of type 
"ReferenceProperty" which does not have a "startswith" attribute.

When i move this line to another position, the error is gone.
But i'm not familiar enough with the code to be sure this i the correct 
solution.
Maybe the source of the problem lies somewhere else..

this works:

def represent(self, obj, fieldtype):

        if isinstance(obj, CALLABLETYPES):
            obj = obj()
        if isinstance(fieldtype, SQLCustomType):
            return fieldtype.encoder(obj)
        if isinstance(obj, (Expression, Field)):
            raise SyntaxError("non supported on GAE")
        if self.dbengine == 'google:datastore':
            if isinstance(fieldtype, gae.Property):
                return obj

        *field_is_type = fieldtype.startswith*

Any idea?

thanks!



-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to