Thanks, now it works. Man, seems like learning this stuff would be a lot easier *if I had already learned it*. Then spotting/fixing these book errors would be a breeze.
On Tue, Aug 20, 2013 at 1:46 PM, Alex <[email protected]> wrote: > seems like > import re > is missing at beginning of function. > > Alex > > Am Dienstag, 20. August 2013 18:47:29 UTC+2 schrieb REM: > >> There appears to be another error in the 5th Edition Web2Py book in >> Chapter 7 on P.369. >> >> The issue is with the following code block: >> >> def list_records(): >> REGEX = re.compile('^(\w+).(\w+).(\w+)**\=\=(\d+)$') >> match = REGEX.match(request.vars.query**) >> if not match: >> redirect(URL('error')) >> table, field, id = match.group(2), match.group(3), match.group(4) >> records = db(db[table][field]==id).selec**t() >> return dict(records=records) >> >> When the related action is run, we get the following error: >> >> *<type 'exceptions.NameError'> global name 're' is not defined >> * >> And referring to line 2 of the above function as being the source of the >> issue: >> >> REGEX = re.compile('^(\w+).(\w+).(\w+)**\=\=(\d+)$') >> >> So, my question is: with what do we replace the "re" in the problem line? >> >> >> >> Many thanks! >> >> >> >> >> -- > > --- > You received this message because you are subscribed to a topic in the > Google Groups "web2py-users" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/web2py/V_0dYYN6B8E/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.

