I would go for

records=self.db(self.db.user.email==email).select()
if not records:
    self.db.user.insert(email=email,greet=True)
else
    records[0].update_record(greet=True)

commit is implicit on relational database and useless on GAE.

On May 27, 11:49 am, Carl <carl.ro...@gmail.com> wrote:
> This guy said so last May:http://tr.im/mzuv:)
> Sounds like the statement is out of date (if so... can you point me to
> the most up to date source on this subject?).
>
> I've used GAE's Data Viewer where I see that multiple entries exist
> with the same email address. On my dev version I can use web2py's data
> viewer to see that email addresses remain unique.
>
> I have an .insert that I don't think is throwing an exception where I
> then call .update
>
> try:
>     self.db.user.insert(email=email,
>                                 greet=True)
>     self.db.commit()
> except:
>     self.db(self.db.user.email==email).update(email=email,
>                                                       greet=True)
>     self.db.commit()
>
> So... I was thinking that GAE wasn't throwing the exception.
> And if there is a less crazy code to use to achieve this please feel
> free to be blunt.
>
> C
>
> On May 27, 5:24 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > IS_NOT_IN_DB works on GAE, who said it does not?
>
> > On May 27, 10:57 am, Carl <carl.ro...@gmail.com> wrote:
>
> > > As IS_NOT_IN_DB isn't implemented on GAE does anyone know what an
> > > alternative implementation on the App Engine is?
>
> > > I'm wanting rows to have unique email addresses. Is there a solution
> > > on GAE or do I change the question and consequently,  implementation?
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to