Get rid of the regular expression match, i.e.
urls = (
'/', 'index',
'/act', 'acGET'
)
When you use the parenthesis to capture a regular expression match it
is passed on as an argument to your GET method. If you do this you
need to add another parameter to GET. But you don't need it, so just
get rid of it.
On Apr 8, 8:26 pm, dineshv <[EMAIL PROTECTED]> wrote:
> Hi Lewis, this is my test Autocomplete code:
>
> ############## act.py ##############
>
> import web
> import simplejson
>
> urls = (
> '/', 'index',
> '/act(.*)', 'acGET',
> )
>
> data = ["string 1", "string 2", "string 3", "string 4", "string 5",
> "string 6", "string 7", "string 8", "string 9", "string 10", "string
> 11"]
>
> class index():
> def GET(self):
> web.header("Content-Type", "text/html; charset=iso-8859-1")
> print render.act()
>
> class acGET():
> def GET(self):
> global q
> entry = web.input()
> web.debug()
> q = entry.q
> limit = entry.limit
> # for test purposes I'm not using 'q' or 'limit' and just
> returning
> 'data'
> result = simplejson.dumps(data)
> print result
>
> ############## act.js ##############
>
> $().ready(function() {
>
> function findValueCallback(event, data, formatted) {
> $("<li>").html( !data ? "No match!" : "Selected: " +
> formatted).appendTo("#result");
> }
>
> function formatItem(row) {
> return row[0] + " (<strong>id: " + row[1] + "</strong>)";
> }
> function formatResult(row) {
> return row[0].replace(/(<.+?>)/gi, '');
> }
>
> $("#suggest").autocomplete("/act");
>
> });
>
> The input box displays and accepts inputs. The Autocomplete displays
> data but NOT the correct data. The Traceback error is:
>
> localhost - - [08/Apr/2008 03:14:15] "GET /static/js/act.js HTTP/1.1"
> 200 -
> Traceback (most recent call last):
> File "c:\python25\lib\site-packages\web\webapi.py", line 304, in
> wsgifunc
> result = func()
> File "c:\python25\lib\site-packages\web\request.py", line 131, in
> <lambda>
> func = lambda: handle(inp, fvars)
> File "c:\python25\lib\site-packages\web\request.py", line 61, in
> handle
> return tocall(*([x and urllib.unquote(x) for x in args] + fna))
> TypeError: GET() takes exactly 1 argument (2 given)
>
> All help appreciated!
>
> On Apr 7, 3:46 pm, "Lewis O'Neill" <[EMAIL PROTECTED]> wrote:
>
> > JQuery autocomplete is sending a GET request. So is your webpy method
> > GET as well? Just thought I'd check because you used POST in your
> > example.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web.py" 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/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---