Thing is the timeout. I manage inconsistencies from this start. Also
check appengine admin which catches bad references.
http://code.google.com/p/appengine-admin/

http://dpaste.com/hold/99361/

class ImagePage(webapp.RequestHandler):
  def get(self):
    if users.is_current_user_admin():
        if self.request.get('h'):
            from datetime import datetime, timedelta
            then = datetime.now () - timedelta (hours = int
(self.request.get('h')))
            query = db.GqlQuery("SELECT * FROM Image where added > :1
ORDER BY added desc", then)
        else:
            query = db.GqlQuery("SELECT * FROM Image ORDER BY added
desc limit "+self.request.get('limit')+" offset "+self.request.get
('offset'))
        count = query.count()
        self.response.out.write(str(count)+'<table border ="1">')

        for image in query:
            self.response.out.write('<tr><td><a href="/admin/Image/
edit/%s/"><img src="/gallery/%s' %
                              (image.key(), image.key
()))
            self.response.out.write('.'+image.thumb_ext+'"></a>')
            try:
                self.response.out.write('</td><td><a href="/%d/url">'
%
                              image.reference.key().id
())
                self.response.out.write('%s</a>' %
                              image.reference.url+'<br/
>'+image.reference.title)
                self.response.out.write('</td><td> %s ' %
                              image.reference.added)
                self.response.out.write('</td><td>ad published? %s ' %
 
image.reference.published)
                self.response.out.write('</td><td>image published? %s
' %
                              image.published)
                self.response.out.write('</td><td><a href="/edit?id=
%d">Edit ad</a> - ' %
                              image.reference.key().id
())
                self.response.out.write('</td></tr>')
            except:
                self.response.out.write('no reference')
        self.response.out.write('</table><br/>')
        nextoffset = int(self.request.get('offset')) + int
(self.request.get('limit'))
        self.response.out.write('<a href="/images.html?
limit='+self.request.get('limit')+'&offset='+ str(nextoffset) +
'">next</a>')



On Dec 14, 10:47 pm, James <thelevybre...@gmail.com> wrote:
> Most of the time, the errors you get from your model properties will
> happen when you're saving data. For instance, if you try saving a
> string as an IntegerProperty, that will result in an error.
>
> The one exception (no pun intended) is ReferenceProperty. If you have
> lots of references and you're not completely careful about leaving in
> bad references, it's common to be greeted with an error like
> "TemplateSyntaxError: Caught an exception while rendering:
> ReferenceProperty failed to be resolved".
>
> And this is if there's only one bad reference in the view. D'oh.
>
> I could write a try/except block to try to access all the reference
> properties and delete them if an exception is raised, but this
> functionality could surely be useful to many other developers if there
> was a more generic method than the one I'd be capable of writing. I
> imagine it would take a list of model types and try to access each
> reference property of each entity in each model, setting the property
> to None if an exception is raised.
>
> I'll see if I can do this myself, but it would definitely help to have
> some suggestions/snippets to get me started.
--~--~---------~--~----~------------~-------~--~----~
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 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to