Ah, so I thought you were trying to access the object key.

In this case, does your model definition have the ()?

So,

class ProgressEvent(db.Model):
  senderId = db.StringProperty()

?

On Thu, Nov 13, 2008 at 10:45 AM, Faber Fedor <[EMAIL PROTECTED]> wrote:

> On Thu, Nov 13, 2008 at 1:33 PM, Marzia Niccolai <[EMAIL PROTECTED]> wrote:
>
>> Hi,
>>
>> It should be:
>>
>> self.response.out.write(pevent.key())
>
>
> That didn't work either. :-?
>
> Bad choice of member name on my part.  Let me rephrase the code:
>
>        for pevent in pevents: # I've also used "for pevent in query:"
>            self.response.out.write(pevent.senderId)
>            self.response.out.write("\n")
>
> where senderId is a member of the object.
>
> On a whim, I did
>
>            self.response.out.write(pevent.senderId())
>
> which, to my mind, should have generated an error, but didn't.  The code
> still printed out
>     Showing events:
>     <class 'google.appengine.ext.db.StringProperty'>
>     <class 'google.appengine.ext.db.StringProperty'>
>
>
> Sometimes these kinds of things are hard to see in your own code :)
>
>
> I know.  The strange thing is I have this working in *another* project.  I
> can't tell the difference between the two (other than the objects in
> question).
>
>
>>
>>
>> -Marzia
>>
>>
>> On Thu, Nov 13, 2008 at 9:41 AM, faber <[EMAIL PROTECTED]> wrote:
>>
>>>
>>> I think I'm missing something really simple here but I can't see
>>> what.  I have an object I'm calling ProgressEvent (PE) which is a
>>> db.Model that I've successfully written and stored.  I am now writing
>>> a function to show all the PEs in the datastore, so I wrote this:
>>>
>>> class showProgressEvents(webapp.RequestHandler):
>>>    def get(self):
>>>        query = ProgressEvent.all()
>>>        pevents = query.fetch(10)
>>>
>>>        self.response.out.write("Showing events:\n")
>>>
>>>        for pevent in pevents: # I've also used "for pevent in query:"
>>>            self.response.out.write(pevent.key)
>>>            self.response.out.write("\n")
>>>
>>> But all it ever prints is:
>>> Showing events:
>>> <class 'google.appengine.ext.db.StringProperty'>
>>> <class 'google.appengine.ext.db.StringProperty'>
>>>
>>> The number of lines printed is correct. What am I missing?
>>>
>>> --
>>>
>>> faber
>>>
>>>
>>>
>>
>>
>>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to