I cannot reproduce this problem. I have idea of what may cause it but I cannot find the incrimiating line. Can you post the content of the filed:
h:\python\web2py_win\web2py_source\svn\applications\Dominos_Times/ views/default/list_all.html and its associated action On May 29, 10:30 am, NewBeen <[email protected]> wrote: > the output i get is > > Traceback (most recent call last): > File "H:\python\web2py_win\web2py_source\svn\gluon\restricted.py", > line 107, in restricted > exec ccode in environment > File "h:\python\web2py_win\web2py_source\svn\applications > \Dominos_Times/views/default/list_all.html", line 62, in <module> > File "h:\python\web2py_win\web2py_source\svn\gluon\sql.py", line > 2215, in __iter__ > yield self[i] > File "h:\python\web2py_win\web2py_source\svn\gluon\sql.py", line > 2180, in __getitem__ > s = self._db(table.id == id), **a: update_record(t, s, a) > File "h:\python\web2py_win\web2py_source\svn\gluon\sql.py", line > 496, in __setattr__ > raise SyntaxError, 'Object %s exists and cannot be redefined' % > key > SyntaxError: Object update_record exists and cannot be redefined > > and the lines under 50, because on top in most of the things belong to > layout.html > > if response.flash: > response.write('\r\n <div class="flash">',escape=False) > response.write(response.flash) > response.write('</div>\r\n ',escape=False) > pass > response.write('\r\n \r\n',escape=False) > response.write(form) > response.write('\r\n\r\n',escape=False) > if query: > response.write('\r\n\r\n<h2>You are checking Store',escape=False) > response.write(request.vars.store_id) > response.write(' in ',escape=False) > response.write(request.vars.date) > response.write('</h2> \r\n\r\n\r\n<br/>\r\n<br/>\r\n\r\n<table > border="1" style="border-color: #FF9C00; border-collapse: collapse; > table-align: center;">\r\n<tr>\r\n<th> Options </th> \r\n<th> Order > Numer </th> \r\n<th> Store Number </th>\r\n<th> Reason </th>\r\n<th> > Total Amount </th>\r\n<th> Total Credit </th>\r\n<th> Total Payd </th> > \r\n<tr>\r\n\r\n',escape=False) > final_total_amount=0 > response.write('\r\n',escape=False) > for order in query: > response.write('\r\n\r\n',escape=False) > if order.total_amount: > response.write('\r\n',escape=False) > final_total_amount+=order.total_amount > response.write('\r\n',escape=False) > pass > response.write('\r\n\r\n<td><a href=',escape=False) > response.write(URL(r=request,f="customread",args=[order.id])) > response.write(' target="_blank">|Read|</a>\r\n<a > href=',escape=False) > response.write(URL(r=request,f="customupdate",args= > [order.id])) > response.write(' target="_blank">|Edit|</a></td>\r\n\r\n<td > style="text-align: center;">',escape=False) > response.write(order.Order_id) > response.write('</td> \r\n<td style="text-align: > center;">',escape=False) > response.write(order.Store_id) > response.write('</td>\r\n<td style="text-align: > center;">',escape=False) > response.write(order.reason) > response.write('</td>\r\n<td style="text-align: > center;">',escape=False) > response.write(order.total_amount) > response.write('</td> \r\n<td style="text-align: > center;">',escape=False) > response.write(order.total_credit) > response.write('</td>\r\n<td style="text-align: > center;">',escape=False) > response.write(order.total_payd) > response.write('</td>\r\n</tr>\r\n\r\n\r\n\r\n</br>\r > \n',escape=False) > pass > response.write('\r\n</table>\r\n\r\n<p> </p>\r\n<p> </p> > \r\n<p> </p>\r\n<h1>Final Totals</h1>\r\n</br>\r\n\r\n\r\n<h2> > Number of orders ',escape=False) > response.write(len(query)) > response.write('</h2>\r\n<h2> Total Amount ',escape=False) > response.write(final_total_amount) > response.write('</h2>\r\n\r\n </div>\r\n </div>\r\n </div> > \r\n</div>\r\n<div id="footer" class="fixed">\r\n <h1>Dominos Pizza > Iceland</h1>\r\n</div>\r\n</body>\r\n</html>\r\n',escape=False) > > On May 29, 3:13 pm, mdipierro <[email protected]> wrote: > > > I agree, a change in a different controller cannot break the update > > controller. > > > In file gluon/sql.py > > > please replace line > > > raise SyntaxError, 'Object exists and cannot be redefined' > > > with > > > raise SyntaxError, 'Object %s exists and cannot be redefined' % key > > > and let me know what the error looks like. > > > It would also be useful to know with some confidence if a change in > > web2py triggered the error or a change in your code did it. > > > Massimo > > > On May 29, 9:52 am, NewBeen <[email protected]> wrote: > > > > Sorry im testing with version 1.62 and don“t work to, > > > i don't get why this just stop to work. > > > > exactly the some code been working nice before!!! > > > the only thing i change is this. > > > > @auth.requires_login() > > > def customcreate(): > > > > try: > > > if session.create: > > > pass > > > except: > > > session.create=[] > > > > form = crud.create('databasedp',onaccept=lambda form: f(form)) > > > type(session.create) > > > > return dict(form=form) > > > > def f(form): > > > if session.create: > > > session.create.append(form.vars.id) > > > else: > > > session.create=[form.vars.id] > > > > but i don't see any connection! > > > > On May 29, 2:38 pm, mdipierro <[email protected]> wrote: > > > > > Just so that I understand, this works fine with 1.63 stable but not > > > > 1.63 intrunk? > > > > Seems like an odd error, can you email me your code so that I can do > > > > some debugging? > > > > > Massimo > > > > > On May 29, 9:21 am, NewBeen <[email protected]> wrote: > > > > > > This is working fine but when i update to the last version in the svn > > > > > start give this error > > > > > > ######## Error traceback ############# > > > > > > Traceback (most recent call last): > > > > > File "H:\python\web2py_win\web2py_source\svn\gluon\restricted.py", > > > > > line 107, in restricted > > > > > exec ccode in environment > > > > > File "h:\python\web2py_win\web2py_source\svn\applications > > > > > \Dominos_Times/views/default/list_all.html", line 62, in <module> > > > > > File "h:\python\web2py_win\web2py_source\svn\gluon\sql.py", line > > > > > 2215, in __iter__ > > > > > yield self[i] > > > > > File "h:\python\web2py_win\web2py_source\svn\gluon\sql.py", line > > > > > 2180, in __getitem__ > > > > > s = self._db(table.id == id), **a: update_record(t, s, a) > > > > > File "h:\python\web2py_win\web2py_source\svn\gluon\sql.py", line > > > > > 496, in __setattr__ > > > > > raise SyntaxError, 'Object exists and cannot be redefined' > > > > > SyntaxError: Object exists and cannot be redefined > > > > > > ############## end ################### > > > > > > And this is the function is giving the error > > > > > > ########### Controller Code ############## > > > > > > @auth.requires_login() > > > > > def customupdate(): > > > > > id_order=request.args[0] > > > > > crud_output=crud.update(db.databasedp, int(id_order) ,next=URL > > > > > (r=request,args=request.args[0])) > > > > > return dict(crudupdate=crud_output) > > > > > > ########### END ######################## > > > > > > ######## VIEW CODE ############# > > > > > > {{extend 'layout.html'}} > > > > > {{=form}} > > > > > > {{if query:}} > > > > > > <h2>You are checking Store{{=request.vars.store_id}} in > > > > > {{=request.vars.date}}</h2> > > > > > > <br/> > > > > > <br/> > > > > > > <table border="1" style="border-color: #FF9C00; border-collapse: > > > > > collapse; table-align: center;"> > > > > > <tr> > > > > > <th> Options </th> > > > > > <th> Order Numer </th> > > > > > <th> Store Number </th> > > > > > <th> Reason </th> > > > > > <th> Total Amount </th> > > > > > <th> Total Credit </th> > > > > > <th> Total Payd </th> > > > > > <tr> > > > > > > {{final_total_amount=0}} > > > > > {{for order in query:}} > > > > > > {{if order.total_amount:}} > > > > > {{final_total_amount+=order.total_amount}} > > > > > {{pass}} > > > > > > <td><a href={{=URL(r=request,f="customread",args=[order.id])}} > > > > > target="_blank">|Read|</a> > > > > > <a href={{=URL(r=request,f="customupdate",args=[order.id])}} > > > > > target="_blank">|Edit|</a></td> > > > > > > <td style="text-align: center;">{{=order.Order_id}}</td> > > > > > <td style="text-align: center;">{{=order.Store_id}}</td> > > > > > <td style="text-align: center;">{{=order.reason}}</td> > > > > > <td style="text-align: center;">{{=order.total_amount}}</td> > > > > > <td style="text-align: center;">{{=order.total_credit}}</td> > > > > > <td style="text-align: center;">{{=order.total_payd}}</td> > > > > > </tr> > > > > > > </br> > > > > > {{pass}} > > > > > </table> > > > > > > <p> </p> > > > > > <p> </p> > > > > > <p> </p> > > > > > <h1>Final Totals</h1> > > > > > </br> > > > > > > <h2> Number of orders {{=len(query)}}</h2> > > > > > <h2> Total Amount {{=final_total_amount}}</h2> > > > > > > ############# END ############### > > > > > > Can some one tell me why start to give me this error now? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" 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 -~----------~----~----~----~------~----~------~--~---

