Search code examples
pythonweb2py

How can I manually create a signature for record editing?


The SQLFORM.grid method generates an Edit button with the following generic URL:

a/c/f/table/record_id?_signature=md5

(Where a=application, c=controller and f=function.)

How can I obtain, given the record id, such URL (or at least the _signature argument) so I can place an Edit button somewhere else in my web application?


Solution

  • The following should generate the proper URL:

    URL('a', 'c', 'f', args=['table', record_id], user_signature=True, hash_vars=False)
    

    In this case, hash_vars=False isn't strictly necessary, as there are no URL variables, but just in case...