On this on the local machine you may have an old web2py version.

On Nov 19, 11:01 am, JoeCodeswell <joecodesw...@gmail.com> wrote:
> For both local and remote machine, the Controllers and Views are
> identical:
>
> ***BUT*** On the local machine I get this ERROR response
>
> Traceback (most recent call last):
>   File "gluon/restricted.py", line 178, in restricted
>   File "C:\web2py\applications\mobyjoe/views\default/showLists.html",
> line 42, in <module>
>   File "gluon/html.py", line 184, in URL
> SyntaxError: not enough information to build the url
> ...
> 40. for list in listD:
> 41.     response.write('\r\n',escape=False)
> 42.     response.write(A(list.name, _href=URL("showAList",
> args=list.id)))
> 43.     response.write(' - ',escape=False)
> 44.     response.write(list.name)
> 45.     response.write(' - ',escape=False)
> 46.     response.write(list.id)
> 47.     response.write('<br/>\r\n\r\n',escape=False)
> 48.     pass
>
> ***AND*** On the remote machine I get this GOOD response:
> mobyJoe
> My Current Lists
> l5 - l5 - 3
> l6 - l6 - 4
> l8 - l8 - 5
> l8 - l8 - 6
> l8 - l8 - 7
> l8 - l8 - 8
> l8 - l8 - 9
> l8 - l8 - 11
> l9 - l9 - 10
> l9 - l9 - 12
> l9 - l9 - 13
> list 4 - list 4 - 1
> list 5 - list 5 - 2
> lj1 - lj1 - 14
> lj2 - lj2 - 15
> lj3 - lj3 - 16
>
> Here is the Controller and View code. Anyone see anything stupid I am
> doing, any ideas?
>
> Thanks in advance.
> All the best,
>
> Joe
>
> ****************************************************************************************
> Controller:
> ****************************************************************************************
> # -*- coding: utf-8 -*-
> #<!-- local and remote -->
> #########################################################################
> ## This is a samples controller
> ## - index is the default action of any application
> ## - user is required for authentication and authorization
> ## - download is for downloading files uploaded in the db (does
> streaming)
> ## - call exposes all registered services (none by default)
> #########################################################################
>
> def index():
>     """
>     example action using the internationalization operator T and flash
>     rendered by views/default/index.html or views/generic.html
>     """
>     #response.flash = T('Welcome to web2py')
>     #return dict(message=T('Hello World'))
>     return dict(message=T(''))
>
> def addList():
>     """
>     displays dem volunteer signup form
>     rendered by views/default/index.html or views/generic.html
>     """
>     # we want to insert so seehttp://www.web2py.com/book/default/chapter/07
>     # search for """ Forms and Validators """ and """ def
> insert_numbers():  """ and
>     #        """ SQLFORM without database IO  """
>     #form = crud.create(db.volunteers, URL(f='showvol',
> args=volunteers.id),
>     #                 message='Your signup was recored.')
>
>     #form_labels = {'lname':'Last Name','fname':'First Name'}
>     #form = SQLFORM(db.list, labels=form_labels)
>     form =SQLFORM(db.mylist)
>     if form.accepts(request.vars, session):
>         ## insert the lines in the textbox into the mylines table
>         newlist = db(db.mylist.id.max()).select()
>         for line in newlist.tlines.split('\n'):
>             mylines_id = db.mylines.insert(mylist_id=newlist.id,
> aline=line)
>         pass
>     return dict(form=form, request=request, session=session)
>
> def showLists():
>     #return dict(db.list)
>     the_lists = db().select(db.mylist.ALL, orderby=db.mylist.name)
>     return dict(listD=the_lists)
>
> def showAList():
>     l = db(db.mylist.id==request.args(0)).select().first()
>     #lineList = l.tlines.split('\n')
>     lineList = db(db.mylines.mylist_id==l.id).select()
>     return dict(name=l.name, lines=lineList)
>
> def user():
>     """
>     exposes:
>    http://..../[app]/default/user/login
>    http://..../[app]/default/user/logout
>    http://..../[app]/default/user/register
>    http://..../[app]/default/user/profile
>    http://..../[app]/default/user/retrieve_password
>    http://..../[app]/default/user/change_password
>     use @auth.requires_login()
>         @auth.requires_membership('group name')
>         @auth.requires_permission('read','table name',record_id)
>     to decorate functions that need access control
>     """
>     return dict(form=auth())
>
> def debug():
>     return dict(request=request, response=response, session=session )
>
> def download():
>     """
>     allows downloading of uploaded files
>    http://..../[app]/default/download/[filename]
>     """
>     return response.download(request,db)
>
> def call():
>     """
>     exposes services. for example:
>    http://..../[app]/default/call/jsonrpc
>     decorate with @services.jsonrpc the functions to expose
>     supports xml, json, xmlrpc, jsonrpc, amfrpc, rss, csv
>     """
>     session.forget()
>     return service()
>
> ****************************************************************************************
> View:
> ****************************************************************************************
> {{extend 'layout.html'}}
> <!-- local and remote -->
> {{#=message}}
> {{#=BEAUTIFY(response._vars)}}
>
> <h1>My Current Lists</h1>
>
> {{for list in listD:}}
> {{=A(list.name, _href=URL("showAList", args=list.id))}} -
> {{=list.name}} - {{=list.id}}<br/>
>
> {{pass}}

Reply via email to