This is the full view,

################## View list_all.html #################

{{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>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<h1>Final Totals</h1>
</br>


<h2> Number of orders {{=len(query)}}</h2>
<h2> Total Amount {{=final_total_amount}}</h2>


########### FINISH #########################

But this error happen in the customupdate to

############## VIEW customupdate.html ##########

{{extend 'layout.html'}}
{{=crudupdate}}

############## Finish #######################

and by the way i post the controller to

############ CONTROLLER ###################

# # sample index page with internationalization (T)

response.menu =[['Login', False, URL(r=request, f='user/login')],
                ['Logout', False, URL(r=request, f='user/logout')]]

def index():

    link_create=URL(r=request, f='customcreate')
    link_search=URL(r=request, f='list_all')

    return dict(link_create=link_create, link_search=link_search)


# # uncomment the following if you have defined "auth" and "crud" in models
def user():
    return dict(form=auth())


@auth.requires_login()
def data():

    return dict(form=crud())


@auth.requires_login()

def list_all():

    form=FORM(TABLE(TR('Select Store:',
SELECT('All',1,2,3,4,5,6,7,8,9,10,11,12,13,14, value='All',
_name='store_id', requires=IS_NOT_EMPTY())),
                    TR('Reason:', SELECT('All','Afpöntun','Annað',
                                                                 'Ekki
heimild',

'Ómóttekin',
                                                                 'Ósótt',
                                                                 'Remake',
                                                                 'Röng búð',
                                                                 'Sein',

'Símamistök',

'Staffamatur', value='All', _name='reason', requires=IS_NOT_EMPTY())),
                    TR('Date', INPUT(_class="date", _id="date_field",
_type="date",_name="date", _value="All")),
                   ("",INPUT(_type="submit",_value="Go"))))

    query=""
    db_store=db.databasedp.Store_id
    db_reason=db.databasedp.reason
    db_date=db.databasedp.date

    st_store=request.vars.store_id
    st_reason=request.vars.reason
    st_date=request.vars.date

    if st_date!="All":
        q_date=db_date==st_date
    else:
        q_date=db_date==db_date

    if st_store!="All":
        q_store=db_store==st_store
    else:
        q_store=db_store==db_store

    if st_reason!="All":
        q_reason=db_reason==st_reason
    else:
        q_reason=db_reason==db_reason

    if st_store=="All" and st_reason=="All" and st_date=="All": #Se todos
forem all
        query=db().select(db.databasedp.ALL)
    else:
        query=db(q_store&q_date&q_reason).select()


    return dict(form=form, query=query)


@auth.requires_login()
def customread():
    id_order=request.args[0]
    return dict(crudread=crud.read(db.databasedp, int(id_order)))

@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)

@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]

############### FINISH ###################


Ok all the code here and i can not see why i have this error............

Thanks for the time spending :D


On Fri, May 29, 2009 at 4:48 PM, mdipierro <[email protected]> wrote:

>
> 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>&nbsp;</p>\r\n<p>&nbsp;</p>
> > \r\n<p>&nbsp;</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>&nbsp;</p>
> > > > > > <p>&nbsp;</p>
> > > > > > <p>&nbsp;</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
-~----------~----~----~----~------~----~------~--~---

Reply via email to