Please try again the latest code in trunk.
On May 11, 8:27 am, NewBeen <[email protected]> wrote:
> i try to use the last version 1.62rc2
>
> and a still with the same problem, now show right what is doing but
> still showing none in the record
> something like
>
> Record None create
> Record None update
>
> i gonna post my model and control maybe im doing something wrong
>
> ### Model ######
>
> try:
> from gluon.contrib.gql import * # if running on Google App Engine
> except:
> db = SQLDB('mysql://r...@localhost:3306/oli')
> else:
> db = GQLDB() # connect to Google BigTable
> session.connect(request, response, db=db) # and store sessions
> there
> # or use the following lines to store sessions in Memcache
> #from gluon.contrib.memdb import MEMDB
> #from google.appengine.api.memcache import Client
> #session.connect(request, response, db=MEMDB(Client()))
>
> ### My Table Define ###
>
> from gluon.tools import Mail, Auth, Crud # new in web2py 1.56
> mail=Mail() # mailer
> mail.settings.server='mail.dominos.is:25' # your SMTP server
> mail.settings.sender='[email protected]' # your email
> #mail.settings.login='username:password' # your credentials
> auth=Auth(globals(),db) # authentication/
> authorization
> auth.settings.mailer=mail # for user email
> verification
> auth.define_tables() # creates all needed
> tables
> crud=Crud(globals(),db) # for CRUD helpers using
> auth
> crud.settings.auth=auth
>
> try:
>
> if auth.is_logged_in:
> user_name=auth.user.first_name
> else:
> user_name=""
> except:
> user_name=""
>
> db.define_table('databasedp',
> db.Field('week', 'integer', label="Week Number" ),
> db.Field('date', 'date'),
> db.Field('Store_id', 'integer', label="Store Number",
> requires=IS_IN_SET((range(1,15)))),
> db.Field('Order_id', 'integer', label="Order
> Number" ),
> db.Field('phone_number', 'string', label="Phone
> Number"),
> db.Field('store_manager', 'string', length=10,
> label="Store Manager"),
> db.Field('pickup_delivery', 'string',
> requires=IS_IN_SET(('Pickup', 'Delivery')), label="Pickup/Delivery"),
> db.Field('time', 'time', label="Hour"),
> db.Field('total_amount', 'integer', label="Total
> Amount"),
> db.Field('total_credit', 'double', label="Total
> Credit"),
> db.Field('total_payd', 'double', label="Total Payd"),
>
> db.Field('reason', 'string', requires=IS_IN_SET
> (('Afpöntun',
>
> 'Annað',
> 'Ekki
> heimild',
>
> 'Ómóttekin',
>
> 'Ósótt',
>
> 'Remake',
> 'Röng
> búð',
>
> 'Sein',
>
> 'Símamistök',
>
> 'Staffamatur')),label="Reason"),
>
> db.Field('explain_reason', 'string', label="Explain
> Reason"),
> db.Field('manager_callcenter', 'string',
> label="Manager CallCenter", default=user_name, writable=False ),
> db.Field('callcenter_reason', 'string',
> label="CallCenter Reason"),
> db.Field('with_discount_amount', 'string', label="With
> Discount"),
> db.Field('payment_type', 'string', label="Payment
> Type"),
> db.Field('u_contact_person', 'string', label="Who
> Contact Person"),
> migrate=False)
>
> crud.settings.logger=auth
>
> ### Controller #####
>
> response.menu =[['Login', False, URL(r=request, f='user/login')],
> ['Logout', False, URL(r=request, f='user/logout')],
> ['Registe', False, URL(r=request, f='user/register')]]
>
> def index():
>
> link='/'+request.application+'/default/customcreate'
>
> return dict(link=link)
>
> # # 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.settings.login_url=URL(r=request,f='../default/user/login')
>
> response.menu =[['Login', False, URL(r=request,f='default/user/
> login')],
> ['Logout', False, URL(r=request,f='default/user/
> logout')],
> ['Registe', False, URL(r=request,f='default/user/
> default/user/register')]]
>
> @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]), log="Record %i update"%(int
> (id_order)))
> return dict(crudupdate=crud_output)
>
> @auth.requires_login()
> def customcreate():
> form = crud.create('databasedp')
>
> return dict(form=form)
>
> On May 6, 2:05 pm, mdipierro <[email protected]> wrote:
>
> > I think I just fixed it in trunk. Please give it a try
>
> > On May 6, 5:31 am, NewBeen <[email protected]> wrote:
>
> > > Any news about this.... 8-)
>
> > > Thanks in advance
>
> > > Rui Gomes
>
> > > On 5 Maio, 16:16, mdipierro <[email protected]> wrote:
>
> > > > It may be a bug. I will look into it and fix it tonight.
>
> > > > On May 5, 10:21 am, NewBeen <[email protected]> wrote:
>
> > > > > Greetings I'm trying to log the events when a create a table withcrud
> > > > > but i always get the same error
>
> > > > > my code is
>
> > > > > in the model
>
> > > > >crud.settings.logger=auth
>
> > > > > in the controller i try already
>
> > > > > @auth.requires_login()
> > > > > def customcreate():
> > > > > form =crud.create('databasedp', log='Record %(id)s created')
> > > > > try to without log and log=crud.settings.create_log
>
> > > > > and i always get in the db.auth_event this result
>
> > > > > "Record None updated"
>
> > > > > but I'm not updating I'm creating a new record some idea what is wrong
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---