Anybody run into a similar issue?
I cannot seem to figure it out. :(

Thanks
-Miguel

On Mon, Feb 22, 2010 at 6:09 PM, Miguel <[email protected]> wrote:

> Hi
>
> I implemented the following function to delete an entry in a db:
>
> @auth.requires_login()
> def DeleteSite():
>        msg = T("Cannot delete specified record.")
>        try:
>                record_id = request.vars['id']
>                next_page = request.vars['next']
>        except:
>                response.flash = msg
>                return dict( message=msg)
>
>        if record_id is None or next_page is None or len(next_page) == 0:
>                response.flash = msg
>                return dict( message=msg)
>
>        crud.delete(db.sites,record_id, next=URL(r=request,f=next_page))
>
>
> It gets invoked like this (local server on GAE):
> http://127.0.0.1:8081/mlinks/default/DeleteSite?id=388&next=MySites
>
>
> This used to work nicely however now when this gets invoked, the item
> gets deleted from the database BUT I get a ticket error:
>
> Error traceback
>
> Traceback (most recent call last):
>  File "C:\web2py\gluon\restricted.py", line 173, in restricted
>    exec ccode in environment
>  File "C:\web2py\applications\mlinks/controllers/
> default.py:DeleteSite", line 164, in <module>
>  File "C:\web2py\gluon\globals.py", line 96, in <lambda>
>    self._caller = lambda f: f()
>  File "C:\web2py\gluon\tools.py", line 1848, in f
>    return action(*a, **b)
>  File "C:\web2py\applications\mlinks/controllers/
> default.py:DeleteSite", line 130, in DeleteSite
>  File "C:\web2py\gluon\tools.py", line 2377, in delete
>    del table[record_id]
>  File "C:\web2py\gluon\sql.py", line 1545, in __delitem__
>    raise SyntaxError, 'No such record: %s' % key
> SyntaxError: No such record: 388
>
> Before invoking the delete I made sure the entry I wanted to delete
> was indeed in the DB.
> After the error the correct entry  has been deleted.
>
> It is like the delete is being called twice!
> Any idea of what might be causing this?
>
> thanks
> Miguel
>
> --
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<web2py%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.

Reply via email to