[web2py] Re: Autocomplete problem ...

2013-01-27 Thread Ivan Gazzola
Il giorno giovedì 24 gennaio 2013 18:56:59 UTC+1, Massimo Di Pierro ha 
scritto:

>
> db.Relation.name.widget=SQLFORM.widgets.autocomplete(request,db.Person,id_field=
> db.Person.id )
>
> db.Relation.contact.widget=SQLFORM.widgetsre.autocomplete(request,db.Person,id_field=
> db.Person.id )
>
> should be
>
>
> db.Relation.name.widget=SQLFORM.widgets.autocomplete(request,db.Person,name,id_field=
> db.Person.id )
> db.Relation.contact.widget=SQLFORM.widgets.autocomplete(request,
> db.Person.name,id_field=db.Person.id )
>
>


I forgot to write "name" in previus post  but the model was ok. Really my 
model is more complex:

db.define_table('Nominativi',
Field('nome',notnull=True, represent=lambda nome:nome.title()),
Field('categoria',db.Categorie_Nominativi,default='1'),
Field('sesso',requires=IS_NULL_OR(IS_IN_SET(['maschio','femmina']))),
Field('mail',requires=IS_NULL_OR(IS_EMAIL(error_message=T('Inserire Una 
Mail Valida',
Field('indirizzo'),
Field('localita', label='Località'),
Field('cap',requires=IS_NULL_OR(IS_LENGTH(5,5, 
error_message=T('Inserire Un CAP valido',
Field('provincia',requires=IS_NULL_OR(IS_IN_SET(Elenco_Province, 
zero=T('Selezionare una Provincia',
Field('codice_fiscale',length=20),
Field('partita_iva',length=20),
Field('data_di_nascita','date'),
Field('professione'),
Field('padre'),
Field('madre'),
Field('inviato_da'),
Field('id_precendente','integer'),
format=lambda 
r:r.nome.title()+'-->'+db.Categorie_Nominativi(r.categoria)['categoria'])


db.Nominativi.categoria.requires=IS_IN_DB(db,'Categorie_Nominativi.id','%(categoria)s',zero=None)
db.Nominativi.categoria.represent = lambda id,row: row.categoria
db.Nominativi.nome.represent = lambda nome,row: nome.title()
db.Nominativi.inviato_da.widget=SQLFORM.widgets.autocomplete(request,db.Nominativi.nome)


db.define_table('Relazioni',
Field('nominativo',db.Nomiantivi,required=True),
Field('referente',db.Nominativi,required=True))
db.Relazioni.nominativo.widget=SQLFORM.widgets.autocomplete(request,db.Nominativi.nome,id_field=db.Nominativi.id)
db.Relazioni.referente.widget=SQLFORM.widgets.autocomplete(request,db.Nominativi.nome,id_field=db.Nominativi.id)

The error log:
 invalid literal for int() with base 10: 
'Pippo Pippo'
and 'pippo pippo' was the value of 'referente'.

If i try a simplified model like that i posted before, i can insert the new 
record but the 'contact' value is stored in 'name' field and 'contact' 
field is always '0'.

db.define_table('Person', Field('name'), format='%(name)s')
db.define_table('Relation', Field('name',db.Person), ('contact',db.Person))
db.Relation.name.widget=SQLFORM.widgets.autocomplete(request,db.Person.name,id_field=
db.Person.id )
db.Relation.contact.widget=SQLFORM.widgets.autocomplete(request,db.Person.name,id_field=
db.Person.id )

I suppose that ajax request lose some data, it would store only the last 
call to table Person ...

-- 





[web2py] Re: Autocomplete problem ...

2013-01-29 Thread Ivan Gazzola
I've deleted the db but error still remains ...



Il giorno lunedì 28 gennaio 2013 16:32:10 UTC+1, Massimo Di Pierro ha 
scritto:
>
> I think your problem is corrupted data. You have "Pippo Pippo" in a field 
> that is either integer or reference. This can happen with sqlite if you 
> change a field type. Delete the database and start again. I do not think 
> there is anything wrong with your code.
>
> On Sunday, 27 January 2013 15:51:33 UTC-6, Ivan Gazzola wrote:
>>
>> Il giorno giovedì 24 gennaio 2013 18:56:59 UTC+1, Massimo Di Pierro ha 
>> scritto:
>>
>>>
>>> db.Relation.name.widget=SQLFORM.widgets.autocomplete(request,db.Person,id_field=
>>> db.Person.id <http://db.person.id/>)
>>>
>>> db.Relation.contact.widget=SQLFORM.widgetsre.autocomplete(request,db.Person,id_field=
>>> db.Person.id <http://db.person.id/>)
>>>
>>> should be
>>>
>>>
>>> db.Relation.name.widget=SQLFORM.widgets.autocomplete(request,db.Person,name,id_field=
>>> db.Person.id <http://db.person.id/>)
>>> db.Relation.contact.widget=SQLFORM.widgets.autocomplete(request,
>>> db.Person.name,id_field=db.Person.id <http://db.person.id/>)
>>>
>>>
>>
>>
>> I forgot to write "name" in previus post  but the model was ok. Really my 
>> model is more complex:
>>
>> db.define_table('Nominativi',
>> Field('nome',notnull=True, represent=lambda nome:nome.title()),
>> Field('categoria',db.Categorie_Nominativi,default='1'),
>> Field('sesso',requires=IS_NULL_OR(IS_IN_SET(['maschio','femmina']))),
>> Field('mail',requires=IS_NULL_OR(IS_EMAIL(error_message=T('Inserire 
>> Una Mail Valida',
>> Field('indirizzo'),
>> Field('localita', label='Località'),
>> Field('cap',requires=IS_NULL_OR(IS_LENGTH(5,5, 
>> error_message=T('Inserire Un CAP valido',
>> Field('provincia',requires=IS_NULL_OR(IS_IN_SET(Elenco_Province, 
>> zero=T('Selezionare una Provincia',
>> Field('codice_fiscale',length=20),
>> Field('partita_iva',length=20),
>> Field('data_di_nascita','date'),
>> Field('professione'),
>> Field('padre'),
>> Field('madre'),
>> Field('inviato_da'),
>> Field('id_precendente','integer'),
>> format=lambda 
>> r:r.nome.title()+'-->'+db.Categorie_Nominativi(r.categoria)['categoria'])
>>
>>
>>
>> db.Nominativi.categoria.requires=IS_IN_DB(db,'Categorie_Nominativi.id','%(categoria)s',zero=None)
>> db.Nominativi.categoria.represent = lambda id,row: row.categoria
>> db.Nominativi.nome.represent = lambda nome,row: nome.title()
>>
>> db.Nominativi.inviato_da.widget=SQLFORM.widgets.autocomplete(request,db.Nominativi.nome)
>>
>>
>> db.define_table('Relazioni',
>> Field('nominativo',db.Nomiantivi,required=True),
>> Field('referente',db.Nominativi,required=True))
>>
>> db.Relazioni.nominativo.widget=SQLFORM.widgets.autocomplete(request,db.Nominativi.nome,id_field=
>> db.Nominativi.id)
>>
>> db.Relazioni.referente.widget=SQLFORM.widgets.autocomplete(request,db.Nominativi.nome,id_field=
>> db.Nominativi.id)
>>
>> The error log:
>>  invalid literal for int() with base 10: 
>> 'Pippo Pippo'
>> and 'pippo pippo' was the value of 'referente'.
>>
>> If i try a simplified model like that i posted before, i can insert the 
>> new record but the 'contact' value is stored in 'name' field and 'contact' 
>> field is always '0'.
>>
>> db.define_table('Person', Field('name'), format='%(name)s')
>> db.define_table('Relation', Field('name',db.Person), 
>> ('contact',db.Person))
>> db.Relation.name.widget=SQLFORM.widgets.autocomplete(request,
>> db.Person.name,id_field=db.Person.id <http://db.person.id/>)
>> db.Relation.contact.widget=SQLFORM.widgets.autocomplete(request,
>> db.Person.name,id_field=db.Person.id <http://db.person.id/>)
>>
>> I suppose that ajax request lose some data, it would store only the last 
>> call to table Person ...
>>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Form.process().accepted stops form (web2py + jquery mobile)???

2013-02-23 Thread Ivan Gazzola
I've the action nominativo, that works. 
When i add the if condition for checking form.process().accepted  (is the 
code from  to <) the form submit data but don't accept the 
variables. Any idea
I need the conditional for redirection after form submission 

def nominativo():
response.menu=[]
response.title=XML("")
if request.args(0)>0:
form=SQLFORM(db.Nominativi,db.Nominativi(request.args(0))).process()
pulsante='Modifica'
icona='refresh'
messaggio='Modificato'
else:
form=SQLFORM(db.Nominativi).process()
pulsante='Inserisci'
icona='plus'
messaggio='Inserito'
   
if form.process().accepted:
response.flash = T("fatto!")  

   return dict(form=form, pulsante=pulsante,icona=icona)

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Form.process().accepted stops form (web2py + jquery mobile)???

2013-02-23 Thread Ivan Gazzola
OPS.

thanks

Il giorno sabato 23 febbraio 2013 16:43:17 UTC+1, Massimo Di Pierro ha 
scritto:
>
> You are doing it twice. The same call always fails.
>
>if request.args(0)>0:
> ...
> else:
> form=SQLFORM(db.Nominativi).*process*()
> 
> if form.*process*().accepted:
> ...
>
> On Saturday, 23 February 2013 07:27:11 UTC-6, Ivan Gazzola wrote:
>>
>> I've the action nominativo, that works. 
>> When i add the if condition for checking form.process().accepted  (is the 
>> code from >>>> to <<<<<) the form submit data but don't accept the 
>> variables. Any idea
>> I need the conditional for redirection after form submission 
>>
>> def nominativo():
>> response.menu=[]
>> response.title=XML("""> id="cerca_nominativo" value="" />""")
>> if request.args(0)>0:
>> 
>> form=SQLFORM(db.Nominativi,db.Nominativi(request.args(0))).process()
>> pulsante='Modifica'
>> icona='refresh'
>> messaggio='Modificato'
>> else:
>> form=SQLFORM(db.Nominativi).process()
>> pulsante='Inserisci'
>> icona='plus'
>> messaggio='Inserito'
>> >>>>   
>> if form.process().accepted:
>> response.flash = T("fatto!")  
>> <<<<
>>return dict(form=form, pulsante=pulsante,icona=icona)
>>
>>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] problem with TAG in module

2013-04-03 Thread Ivan Gazzola
I wrote this module my_util.py:

#!/usr/bin/env python
# coding: utf8

import gluon

def my_form(form, fields): 
table = TAG['']() 
for id, label, controls, help in fields:
lab1=str(label)
tmp_label=lab1.partition('>')
lab1=tmp_label[0]+tmp_label[1]+''+tmp_label[2]
tmp_label=lab1.partition(''+tmp_label[1]+tmp_label[2]
if string.find(str(controls),'legend')>0:
table.append(controls) 
else:
table.append(DIV(XML(_label),'\n', controls,'\n', help,**{
'_data-role':'fieldcontain','_id':id})+'\n')
return table
pass

If i put the function my_form in controllers it works well.
But when i try to do:

from my_util import my_form



def testi_consensi():
response.menu=[]
form = SQLFORM(db.mytable, separator='',showid = False,\
 formstyle=lambda form, fields: form_mia(form, 
fields),submit_button 
= 'Nuovo Testo',)
return dict(form=form)


i've this error:

 global name 'TAG' is not defined


-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: problem with TAG in module

2013-04-04 Thread Ivan Gazzola
Ok

Il giorno giovedì 4 aprile 2013 00:10:02 UTC+2, Massimo Di Pierro ha 
scritto:
>
> import gluon
>
> should be
>
> from gluon import *
>
> On Wednesday, 3 April 2013 16:06:24 UTC-5, Ivan Gazzola wrote:
>>
>> I wrote this module my_util.py:
>>
>> #!/usr/bin/env python
>> # coding: utf8
>>
>> import gluon
>>
>> def my_form(form, fields): 
>> table = TAG['']() 
>> for id, label, controls, help in fields:
>> lab1=str(label)
>> tmp_label=lab1.partition('>')
>> lab1=tmp_label[0]+tmp_label[1]+''+tmp_label[2]
>> tmp_label=lab1.partition('> _label=tmp_label[0]+''+tmp_label[1]+tmp_label[2]
>> if string.find(str(controls),'legend')>0:
>> table.append(controls) 
>> else:
>> table.append(DIV(XML(_label),'\n', controls,'\n', help,**{
>> '_data-role':'fieldcontain','_id':id})+'\n')
>> return table
>> pass
>>
>> If i put the function my_form in controllers it works well.
>> But when i try to do:
>>
>> from my_util import my_form
>>
>>
>>
>> def testi_consensi():
>> response.menu=[]
>> form = SQLFORM(db.mytable, separator='',showid = False,\
>>  formstyle=lambda form, fields: form_mia(form, fields
>> ), submit_button = 'Nuovo Testo',)
>> return dict(form=form)
>>
>>
>> i've this error:
>>
>>  global name 'TAG' is not defined
>>
>>
>>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Encrypt table and search in fields

2013-07-31 Thread Ivan Gazzola
I'm trying to use this 
https://groups.google.com/d/msg/web2py/uGFQD0PBefQ/Zi-SPOLVSXIJ for 
encrypting data in a sqlite table.
I need to search in one field with 'like' operator for buil a ajax list, i 
use this function:

def ajaxlivesearch():
partialstr = request.vars.values()[0]
query = db.Nominativi.nome.like('%'+partialstr+'%')
person = db(query).select(db.Nominativi.nome,db.Nominativi.id,db.
Nominativi.categoria)
items = []
for (i,person) in enumerate(person):
try:
 items.append(LI(A(person.nome,'  -->  
',person.categoria.categoria,_href
=URL('default','nominativo',args=person.id
except:
print "errore nel generare l'elemento"
return TAG[''](*items)

when i try to serch in encrypted field with web2py query i don't get any 
result :( also in admin interface.
Filter_out does not work in searches?
Might be useful to create a temporary virtual table with the decrypted data 
for the search and keep it active only for the session? How can I do that? 
.


-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Encrypt table and search in fields

2013-07-31 Thread Ivan Gazzola
I need to encrypt data (medical data!) in db because if I encode the fs 
when mounted this remains visible and for a web app the fs is always 
mounted.
I would like to protect the data in case of access to the fs.
Any tips?

thx

Ivan 

Il giorno mercoledì 31 luglio 2013 10:33:00 UTC+2, Massimo Di Pierro ha 
scritto:
>
> You cannot search inside an encrypted field. If you could it would not be 
> encrypted. the best you can do  is encrypt your search string too and check 
> that the encrypted value is equal to the encrypted search string. Anyway, 
> even if you succeed in doing this is means that all records are encrypted 
> with the same key (and I think that is the case for you). In this case, why 
> not simply encrypt the filesystem which contains the data instead of 
> encrypted the individual records? This would allow you to perform search 
> and would not require that the application has knowledge of the 
> encryption/decryption key.
>
>
>
> On Wednesday, 31 July 2013 03:27:59 UTC-5, Ivan Gazzola wrote:
>>
>> I'm trying to use this 
>> https://groups.google.com/d/msg/web2py/uGFQD0PBefQ/Zi-SPOLVSXIJ for 
>> encrypting data in a sqlite table.
>> I need to search in one field with 'like' operator for buil a ajax list, 
>> i use this function:
>>
>> def ajaxlivesearch():
>> partialstr = request.vars.values()[0]
>> query = db.Nominativi.nome.like('%'+partialstr+'%')
>> person = db(query).select(db.Nominativi.nome,db.Nominativi.id,db.
>> Nominativi.categoria)
>> items = []
>> for (i,person) in enumerate(person):
>> try:
>>  items.append(LI(A(person.nome,'  -->  ',person.categoria.
>> categoria, _href=URL('default','nominativo',args=person.id
>> except:
>> print "errore nel generare l'elemento"
>> return TAG[''](*items)
>>
>> when i try to serch in encrypted field with web2py query i don't get any 
>> result :( also in admin interface.
>> Filter_out does not work in searches?
>> Might be useful to create a temporary virtual table with the decrypted 
>> data for the search and keep it active only for the session? How can I do 
>> that? 
>> .
>>
>>
>>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Migration from console

2015-12-01 Thread Ivan Gazzola
Is it possible to apply migration from console without changing 
migrate=False in dal connection?
How can I do it?

Thx

Ivan

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Flash message if before_insert fail

2016-02-18 Thread Ivan Gazzola
How can I change that?

I've tried to change response.flash in callback function but this doesn't 
work properly, I always get the "new record inserted" message even if the 
record is not stored in DB.

Thx

Ivan

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Flash message if before_insert fail

2016-02-18 Thread Ivan Gazzola


db.define_table('poc',
Field 
('Name',required=True),
Field 
('Birthday','date',widget=bsdatepicker_widget(),required=True),
Field 
('Angle_Class_Dx',label=T 
("Angle's Class Dx")),
Field 
('Angle_Class_Sn',label=T 
("Angle's Class Sn")),
Field 
('Facial_Type'),
Field ('Overjet'),
Field 
('Overbite'),
Field ('Sex'),
#Field('Ratial_Type'),
Field ('Ratial'),
Field 
('Cot1','upload',required=True),
Field 
('Cot2','upload'),
Field 
('Cot3','upload'),
Field 
('Clench','upload',required=True),
Field 
('Chewing_dx','upload',required=True),
Field 
('Chewing_sn','upload',required=True),
Field 
('Lateral_Ceph','upload'),
Field 
('Dental_Formula','text'),
auth.signature
)



def controlla_record(dati):
nascite=db(db.poc.Birthday==dati.get("Birthday")).select()
for soggetto in nascite:
if CRYPT ()(request 
.vars.get("Name",'').upper())[0]==soggetto.Name:
return "errore"


db.poc.Angle_Class_Dx.requires = IS_IN_SET 
([('1','I'),('2','II'),('3','III')])
db.poc.Angle_Class_Sn.requires = IS_IN_SET 
([('1','I'),('2','II'),('3','III')])
db.poc.Facial_Type.requires=IS_IN_SET 
({'N':'Normo','O':'Open','D':'Deep'})
db.poc.Overjet.requires=IS_IN_SET 
([('1','OJ < 2mm'),('2','2mm 
< OJ < 4mm'),('3','OJ > 4mm')])
db.poc.Overbite.requires=IS_IN_SET 
([('1','OB < 2mm'),('2','2mm 
< OB < 4mm'),('3','OB > 4mm')])
db.poc.Sex.requires=IS_IN_SET 
({'M':'Male','F':'Female'})
db.poc.Name.requires=[IS_UPPER 
(),CRYPT 
()]
db.poc._before_insert.append(lambda dati: controlla_record(dati))

db.define_table('poc',
Field 
('Name',required=True),
Field 
('Birthday','date',widget=bsdatepicker_widget(),required=True),
Field 
('Angle_Class_Dx',label=T 
("Angle's Class Dx")),
Field 
('Angle_Class_Sn',label=T 
("Angle's Class Sn")),
Field 
('Facial_Type'),
Field ('Overjet'),
Field 
('Overbite'),
Field ('Sex'),
Field ('Ratial'),
Field 
('Cot1','upload',required=True),
Field 
('Cot2','upload'),
Field 
('Cot3','upload'),
Field 
('Clench','upload',required=True),
Field 
('Chewing_dx','upload',required=True),
Field 
('Chewing_sn','upload',required=True),
Field 
('Lateral_Ceph','upload'),
Field 
('Dental_Formula','text'),
auth.signature

[web2py] Re: Flash message if before_insert fail

2016-02-18 Thread Ivan Gazzola
### Controller for poc form


def insert_poc():
form=SQLFORM(db.poc)
if form.process().accepted:
   response.flash = T('Record added')
return dict(form=form)


I've posted the full model, the function is colled in _before_insert:

db.poc._before_insert.append(lambda dati: controlla_record(dati))


Il giorno giovedì 18 febbraio 2016 17:28:15 UTC+1, Anthony ha scritto:
>
> We need to see the full code, including the controller. In particular, you 
> show a callback function, but you do not show where it is called.
>
> Anthony
>
> On Thursday, February 18, 2016 at 8:55:49 AM UTC-5, Ivan Gazzola wrote:
>
>
> db.define_table('poc',
> Field 
> <https://xortho.it/examples/global/vars/Field>('Name',required=True),
> Field 
> <https://xortho.it/examples/global/vars/Field>('Birthday','date',widget=bsdatepicker_widget(),required=True),
> Field 
> <https://xortho.it/examples/global/vars/Field>('Angle_Class_Dx',label=T 
> <https://xortho.it/examples/global/vars/T>("Angle's Class Dx")),
> Field 
> <https://xortho.it/examples/global/vars/Field>('Angle_Class_Sn',label=T 
> <https://xortho.it/examples/global/vars/T>("Angle's Class Sn")),
> Field 
> <https://xortho.it/examples/global/vars/Field>('Facial_Type'),
> Field 
> <https://xortho.it/examples/global/vars/Field>('Overjet'),
> Field 
> <https://xortho.it/examples/global/vars/Field>('Overbite'),
> Field <https://xortho.it/examples/global/vars/Field>('Sex'),
> Field 
> <https://xortho.it/examples/global/vars/Field>('Ratial'),
> Field 
> <https://xortho.it/examples/global/vars/Field>('Cot1','upload',required=True),
> Field 
> <https://xortho.it/examples/global/vars/Field>('Cot2','upload'),
> Field 
> <https://xortho.it/examples/global/vars/Field>('Cot3','upload'),
> Field 
> <https://xortho.it/examples/global/vars/Field>('Clench','upload',required=True),
> Field 
> <https://xortho.it/examples/global/vars/Field>('Chewing_dx','upload',required=True),
> Field 
> <https://xortho.it/examples/global/vars/Field>('Chewing_sn','upload',required=True),
> Field 
> <https://xortho.it/examples/global/vars/Field>('Lateral_Ceph','upload'),
> Field 
> <https://xortho.it/examples/global/vars/Field>('Dental_Formula','text'),
> auth.signature
> )
>
>
>
> def controlla_record(dati):
> nascite=db(db.poc.Birthday==dati.get("Birthday")).select()
> for soggetto in nascite:
> if CRYPT <https://xortho.it/examples/global/vars/CRYPT>()(request 
> <https://xortho.it/examples/global/vars/request>.vars.get("Name",'').upper())[0]==soggetto.Name:
>   response.flash=T("Duplicate Records Not Allowed") 
>   return "errore"
>
>
> db.poc.Angle_Class_Dx.requires = IS_IN_SET 
> <https://xortho.it/examples/global/vars/IS_IN_SET>([('1','I'),('2','II'),('3','III')])
> db.poc.Angle_Class_Sn.requires = IS_IN_SET 
> <https://xortho.it/examples/global/vars/IS_IN_SET>([('1','I'),('2','II'),('3','III')])
> db.poc.Facial_Type.requires=IS_IN_SET 
> <https://xortho.it/examples/global/vars/IS_IN_SET>({'N':'Normo','O':'Open','D':'Deep'})
> db.poc.Overjet.requires=IS_IN_SET 
> <https://xortho.it/examples/global/vars/IS_IN_SET>([('1','OJ < 
> 2mm'),('2','2mm < OJ < 4mm'),('3','OJ > 4mm')])
> db.poc.Overbite.requires=IS_IN_SET 
> <https://xortho.it/examples/global/vars/IS_IN_SET>([('1','OB < 
> 2mm'),('2','2mm < OB < 4mm'),('3','OB > 4mm')])
> db.poc.Sex.requires=IS_IN_SET 
> <https://xortho.it/examples/global/vars/IS_IN_SET>({'M':'Male','F':'Female'})
> db.poc.Name.requires=[IS_UPPER 
> <https://xortho.it/examples/global/vars/IS_UPPER>(),CRYPT 
> <https://xortho.it/examples/global/vars/CRYPT>
>
> ...

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Flash message if before_insert fail

2016-02-19 Thread Ivan Gazzola
Thx Anthony !

Il giorno giovedì 18 febbraio 2016 21:22:05 UTC+1, Anthony ha scritto:
>
> .. 
>
>
> db.poc.Name.requires = [IS_UPPER 
> <https://xortho.it/examples/global/vars/IS_UPPER>(), CRYPT 
> <https://xortho.it/examples/global/vars/CRYPT>(),
> IS_NOT_IN_DB(db(db.poc.Birthday == 
> request.vars.Birthday), 'poc.Name')]
>
>
>
I've tried but this doesn't work properly and adds duplicated data. I 
figured out  that is probably because I'm using CRYPT() and I get a 
LazyCrypt Object but IS_NOT_IN_DB expects a string

Where can'I find the source code for _before_insert?

 

> A few additional tips:
>
>
>- form.process() accepts a "message_onsuccess" argument, so you can 
>use that instead of checking if the form is accepted and explicitly 
> setting 
>response.flash.
>
> Tried and this prevent  "record added" message but I'm still unable to 
show a duplicate error message.


>- If your callback function already has the proper signature (i.e., 
>accepts the arguments that will be passed when called), there is no need 
> to 
>wrap it in a lambda. Just do 
>db.poc._before_insert.append(controlla_record).
>
> Good
 

>
>- If you want to determine whether a given value exists in a 
>particular database field, you should not loop through all the records in 
>Python but instead simply let the database do the work:
>
> if not db((db.poc.Birthday == dati.get("Birthday")) &
>   (db.poc.Name == CRYPT()(request.vars.get('Name', 
> '').upper())[0])).isempty():
> return 'error'
>
>
Got it ...
 

>  
>
>
>- If you are going to loop through a set of records, don't recalculate 
>the same value over and over inside the loop (i.e., in your callback, you 
>would move the transformation of the Name via CRYPT outside the loop, as 
>you only need to do it once).
>
>  Correct !




> Anthony
>
> On Thursday, February 18, 2016 at 12:13:55 PM UTC-5, Ivan Gazzola wrote:
>>
>> ### Controller for poc form
>>
>>
>> def insert_poc():
>> form=SQLFORM(db.poc)
>> if form.process().accepted:
>>response.flash = T('Record added')
>> return dict(form=form)
>>
>>
>> I've posted the full model, the function is colled in _before_insert:
>>
>> db.poc._before_insert.append(lambda dati: controlla_record(dati))
>>
>>
>> Il giorno giovedì 18 febbraio 2016 17:28:15 UTC+1, Anthony ha scritto:
>>
>> We need to see the full code, including the controller. In particular, 
>> you show a callback function, but you do not show where it is called.
>>
>> Anthony
>>
>> On Thursday, February 18, 2016 at 8:55:49 AM UTC-5, Ivan Gazzola wrote:
>>
>>
>> db.define_table('poc',
>> Field 
>> <https://xortho.it/examples/global/vars/Field>('Name',required=True),
>> Field 
>> <https://xortho.it/examples/global/vars/Field>('Birthday','date',widget=bsdatepicker_widget(),required=True),
>> Field 
>> <https://xortho.it/examples/global/vars/Field>('Angle_Class_Dx',label=T 
>> <https://xortho.it/examples/global/vars/T>("Angle's Class Dx")),
>> Field 
>> <https://xortho.it/examples/global/vars/Field>('Angle_Class_Sn',label=T 
>> <https://xortho.it/examples/global/vars/T>("Angle's Class Sn")),
>> Field 
>> <https://xortho.it/examples/global/vars/Field>('Facial_Type'),
>> Field 
>> <https://xortho.it/examples/global/vars/Field>('Overjet'),
>> Field 
>> <https://xortho.it/examples/global/vars/Field>('Overbite'),
>> Field <https://xortho.it/examples/global/vars/Field>('Sex'),
>> Field 
>> <https://xortho.it/examples/global/vars/Field>('Ratial'),
>> Field 
>> <https://xortho.it/examples/global/vars/Field>('Cot1','upload',required=True),
>> Field 
>> <https://xortho.it/examples/global/vars/Field>('Cot2','upload'),
>> Field 
>> <https://xortho.it/examples/global/vars/Field>('Cot3','upload'),
>> Field 
>> <https://xortho.it/examples/global/vars/Field>('Clench','uploa

[web2py] request.args and special character

2016-05-24 Thread Ivan Gazzola
I've tried an URI like this "app/controller/function/1%C2%B0%20Classe" for 
sending the "1° Classe" value

If in my function i call

request.args(0)

I get "1__Classe"

If I call  

request.url.split('/')[-1]

I get "1° Classe"

Why? I've tried to find the source code for args assignment but I can't 
find it :(

Thx

Ivan

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] IPN paypal 404 ???

2014-07-30 Thread Ivan Gazzola
When i call /paypal/ipn from a browser is ok, when paypall try to send IPN 
the relay is 404???

x.x.x.x - - [30/Jul/2014:13:09:03 +0200] "POST /paypal/ipn HTTP/1.0" 404 66 
"-" "PayPal IPN ( https://www.paypal.com/ipn )"
x.x.x.x - - [30/Jul/2014:13:10:25 +0200] "POST /paypal/ipn HTTP/1.0" 404 66 
"-" "PayPal IPN ( https://www.paypal.com/ipn )"
x.x.x.x - - [30/Jul/2014:13:13:07 +0200] "POST /paypal/ipn HTTP/1.0" 404 66 
"-" "PayPal IPN ( https://www.paypal.com/ipn )"
x.x.x.x - - [30/Jul/2014:13:14:24 +0200] "GET /paypal/ipn HTTP/1.1" 200 35 
"-" "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like 
Gecko) Chrome/36.0.1985.125 Safari/537.36"

any advice?
The controller is like this:

def ipn():
verifyurl = "www.paypal.com"
if request.vars.test_ipn != None and request.vars.test_ipn == '1':
verifyurl = "www.sandbox.paypal.com"
stato=""
params=""
if len(request.vars.keys()) > 0:
params = "cmd=_notify-validate&" + urllib.urlencode(parameters)
headers = {"Content-type": "application/x-www-form-urlencoded",
   "Content-Length": "%s" % (len(params))}

stato=None
conn = httplib.HTTPSConnection(verifyurl)
conn.request("POST", "/cgi-bin/webscr", params, headers )
stato = conn.getresponse()


 if stato != "VERIFIED":
#@todo: figure out how to fail
f = open(logfile, "a")
f.write("Message not verified: %s\n" %(stato))
f.write(repr(params) + "\n\n")
f.close()
return None

  if request.vars.payment_status != 'Completed':
 f = open(logfile, "a")
f.write("Ignore pending transaction:\n")
f.write(repr(params) + "\n\n")
f.close()
return None
  . 
 return None

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] foreign key constraint failed ???

2013-12-08 Thread Ivan Gazzola
I can't resolve this ticket in mhy app. I try to insert from appadmin but 
i've always this error:
"
 foreign key constraint failed
"

This is my model:

db.define_table('Nominativi',
Field('nome',notnull=True, represent=lambda nome:nome.title()),
Field('categoria',db.Categorie_Nominativi,default='1'),
Field('sesso',requires=IS_EMPTY_OR(IS_IN_SET(['maschio','femmina']))),
Field('mail',requires=IS_EMPTY_OR(IS_EMAIL(error_message=T('Inserire 
Una Mail Valida',
Field('indirizzo'),
Field('localita', label='Località'),
Field('cap',requires=IS_EMPTY_OR(IS_LENGTH(5,5, 
error_message=T('Inserire Un CAP valido',
Field('provincia',requires=IS_EMPTY_OR(IS_IN_SET(Elenco_Province, 
zero=T('Selezionare una Provincia',
Field('codice_fiscale',length=20),
Field('partita_iva',length=20),
Field('data_di_nascita','date'),
Field('professione'),
Field('padre'),
Field('madre'),
Field('inviato_da'),
Field('id_precendente','integer'),
format=lambda 
r:r.nome.title()+'-->'+db.Categorie_Nominativi(r.categoria)['categoria'])

db.Nominativi.nome.filter_in = lambda value : w2p_encrypt(value,key=chiave)
db.Nominativi.nome.filter_out = lambda value : w2p_decrypt(value,key=chiave)
db.Nominativi.mail.filter_in = lambda value : w2p_encrypt(value,key=chiave)
db.Nominativi.mail.filter_out = lambda value : w2p_decrypt(value,key=chiave)
db.Nominativi.indirizzo.filter_in = lambda value : 
w2p_encrypt(value,key=chiave)
db.Nominativi.indirizzo.filter_out = lambda value : 
w2p_decrypt(value,key=chiave)
db.Nominativi.localita.filter_in = lambda value : 
w2p_encrypt(value,key=chiave)
db.Nominativi.localita.filter_out = lambda value : 
w2p_decrypt(value,key=chiave)
db.Nominativi.cap.filter_in = lambda value : w2p_encrypt(value,key=chiave)
db.Nominativi.cap.filter_out = lambda value : w2p_decrypt(value,key=chiave)
db.Nominativi.codice_fiscale.filter_in = lambda value : 
w2p_encrypt(value,key=chiave)
db.Nominativi.codice_fiscale.filter_out = lambda value : 
w2p_decrypt(value,key=chiave)
db.Nominativi.padre.filter_in = lambda value : w2p_encrypt(value,key=chiave)
db.Nominativi.padre.filter_out = lambda value : 
w2p_decrypt(value,key=chiave)
db.Nominativi.madre.filter_in = lambda value : w2p_encrypt(value,key=chiave)
db.Nominativi.madre.filter_out = lambda value : 
w2p_decrypt(value,key=chiave)
db.Nominativi.categoria.requires=IS_IN_DB(db,'Categorie_Nominativi.id','%(categoria)s',zero=None)
db.Nominativi.categoria.represent = lambda id,row: row.categoria
db.Nominativi.nome.represent = lambda nome,row: nome.title()
db.Nominativi.inviato_da.widget=SQLFORM.widgets.autocomplete(request,db.Nominativi.nome)

db.define_table('Relazioni',
Field('nominativo',db.Nominativi,required=True,requires=[IS_IN_DB(db, 
'Nominativi.id')]),
Field('referente',db.Nominativi,required=True,requires=[IS_IN_DB(db, 
'Nominativi.id')]),
Field('tipo_relazione',label='Tipo di relazione'))

db.Relazioni.tipo_relazione.widget = lambda field,value: \
 SQLFORM.widgets.string.widget(field,value,_placeholder="Inserire il 
tipo di relazione")
db.Relazioni.referente.widget=SQLFORM.widgets.autocomplete(request,db.Nominativi.nome,id_field=db.Nominativi.id,limitby=(0,10),
 
min_length=3)


db.define_table("Consulenze",
Field('dentista',db.Nominativi,required=True),
Field('data_inizio_collaborazione','date'),
Field('data_fine_collaborazione','date'),
Field('id_precedente','integer'),
format=lambda r:db.Nominativi(r.dentista)['nome'])
odontoiatri=db(db.Nominativi.categoria==2)
db.Consulenze.dentista.requires=IS_IN_DB(odontoiatri,'Nominativi.id','%(nome)s')

db.define_table("Pazienti_Consulenza",
Field('dentista',db.Consulenze, required=True),
Field('paziente',db.Nominativi,required=True, unique=True))

everything worked fine when I've added the table.
I can't see what is wrong in the last table ...

Thx

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: foreign key constraint failed ???

2013-12-08 Thread Ivan Gazzola
I changed all fields in 'referece field' format but nothing changes :(
For the validatos IS_IN_DB(db,db.table.field,format) is mistaken and return 
errors, indeed the correct form is IS_IN_DB(db,table.field,format) ...

Regards

Ivan

Il giorno domenica 8 dicembre 2013 17:20:15 UTC+1, 黄祥 ha scritto:
>
> had you already try using :
> 'reference Nominativi' instead of db.Nominativi 
> and 
> requires is set to db.Nominativi.id instead of 'Nominativi.id'?
>
> e.g. 
> db.define_table('Relazioni',
> Field('nominativo', 'reference Nominativi', 
> required=True,requires=[IS_IN_DB(db, db.Nominativi.id)]),
> Field('referente', reference Nominativi', 
> required=True,requires=[IS_IN_DB(db, db.Nominativi.id)]),
> Field('tipo_relazione',label='Tipo di relazione'))
>
> best regards,
> stifan
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: foreign key constraint failed ???

2013-12-08 Thread Ivan Gazzola
If possible I prefer to keep foreign_keys=True for db integrity.

Thx

Ivan

Il giorno domenica 8 dicembre 2013 15:41:03 UTC+1, Ivo ha scritto:
>
> though it may not be the preferred solution I resolved it by adding:
> adapter_args=dict(foreign_keys=False) to db = 
> DAL('sqlite://storage.sqlite') in db.py
>
>
> On Sunday, December 8, 2013 3:16:36 PM UTC+1, Ivan Gazzola wrote:
>>
>> I can't resolve this ticket in my app. I try to insert in 
>> Pazienti_Consulenza from appadmin but i've always this error:
>> "
>>  foreign key constraint failed
>> "
>>
>> This is my model:
>>
>> db.define_table('Nominativi',
>> Field('nome',notnull=True, represent=lambda nome:nome.title()),
>> Field('categoria',db.Categorie_Nominativi,default='1'),
>> Field('sesso',requires=IS_EMPTY_OR(IS_IN_SET(['maschio','femmina']))),
>> Field('mail',requires=IS_EMPTY_OR(IS_EMAIL(error_message=T('Inserire 
>> Una Mail Valida',
>> Field('indirizzo'),
>> Field('localita', label='Località'),
>> Field('cap',requires=IS_EMPTY_OR(IS_LENGTH(5,5, 
>> error_message=T('Inserire Un CAP valido',
>> Field('provincia',requires=IS_EMPTY_OR(IS_IN_SET(Elenco_Province, 
>> zero=T('Selezionare una Provincia',
>> Field('codice_fiscale',length=20),
>> Field('partita_iva',length=20),
>> Field('data_di_nascita','date'),
>> Field('professione'),
>> Field('padre'),
>> Field('madre'),
>> Field('inviato_da'),
>> Field('id_precendente','integer'),
>> format=lambda 
>> r:r.nome.title()+'-->'+db.Categorie_Nominativi(r.categoria)['categoria'])
>>
>> db.Nominativi.nome.filter_in = lambda value : 
>> w2p_encrypt(value,key=chiave)
>> db.Nominativi.nome.filter_out = lambda value : 
>> w2p_decrypt(value,key=chiave)
>> db.Nominativi.mail.filter_in = lambda value : 
>> w2p_encrypt(value,key=chiave)
>> db.Nominativi.mail.filter_out = lambda value : 
>> w2p_decrypt(value,key=chiave)
>> db.Nominativi.indirizzo.filter_in = lambda value : 
>> w2p_encrypt(value,key=chiave)
>> db.Nominativi.indirizzo.filter_out = lambda value : 
>> w2p_decrypt(value,key=chiave)
>> db.Nominativi.localita.filter_in = lambda value : 
>> w2p_encrypt(value,key=chiave)
>> db.Nominativi.localita.filter_out = lambda value : 
>> w2p_decrypt(value,key=chiave)
>> db.Nominativi.cap.filter_in = lambda value : w2p_encrypt(value,key=chiave)
>> db.Nominativi.cap.filter_out = lambda value : 
>> w2p_decrypt(value,key=chiave)
>> db.Nominativi.codice_fiscale.filter_in = lambda value : 
>> w2p_encrypt(value,key=chiave)
>> db.Nominativi.codice_fiscale.filter_out = lambda value : 
>> w2p_decrypt(value,key=chiave)
>> db.Nominativi.padre.filter_in = lambda value : 
>> w2p_encrypt(value,key=chiave)
>> db.Nominativi.padre.filter_out = lambda value : 
>> w2p_decrypt(value,key=chiave)
>> db.Nominativi.madre.filter_in = lambda value : 
>> w2p_encrypt(value,key=chiave)
>> db.Nominativi.madre.filter_out = lambda value : 
>> w2p_decrypt(value,key=chiave)
>>
>> db.Nominativi.categoria.requires=IS_IN_DB(db,'Categorie_Nominativi.id','%(categoria)s',zero=None)
>> db.Nominativi.categoria.represent = lambda id,row: row.categoria
>> db.Nominativi.nome.represent = lambda nome,row: nome.title()
>>
>> db.Nominativi.inviato_da.widget=SQLFORM.widgets.autocomplete(request,db.Nominativi.nome)
>>
>> db.define_table('Relazioni',
>> Field('nominativo',db.Nominativi,required=True,requires=[IS_IN_DB(db, 
>> 'Nominativi.id')]),
>> Field('referente',db.Nominativi,required=True,requires=[IS_IN_DB(db, 
>> 'Nominativi.id')]),
>> Field('tipo_relazione',label='Tipo di relazione'))
>>
>> db.Relazioni.tipo_relazione.widget = lambda field,value: \
>>  SQLFORM.widgets.string.widget(field,value,_placeholder="Inserire il 
>> tipo di relazione")
>>
>> db.Relazioni.referente.widget=SQLFORM.widgets.autocomplete(request,db.Nominativi.nome,id_field=
>> db.Nominativi.id,limitby=(0,10), min_length=3)
>>
>>
>> db.define_table("Consulenze",
>> Field('dentista',db.Nominativi,required=True),
>> Field('

[web2py] Re: autofocus html5 attribute support?

2013-12-14 Thread Ivan Gazzola
I use in view:

form.element('#id_field')['_autofocus']=''


 and i get:



like html5 


Il giorno venerdì 9 agosto 2013 04:04:17 UTC+2, Anthony ha scritto:
>
> form.custom.widget.tm_home["_autofocus"]
>
> This is just standard Python, so the above simply attempts to retrieve the 
> value with key "_autofocus" -- it doesn't add the key if it doesn't exist. 
> Instead, you can do:
>
> form.custom.widget.tm_home["_autofocus"] = True
>
> which will yield:
>
> 
>
> which should work.
>
> Anthony
>
> On Thursday, August 8, 2013 9:37:13 PM UTC-4, davedigerati wrote:
>>
>> using a custom sqlform, in my view I can use the placeholder attribute 
>> but not the autofocus- is this being ignored by web2py?
>>
>> {{form.custom.widget.tm_home["_autofocus"]}}
>> {{form.custom.widget.tm_home["_placeholder"] = "Home Team Name"}}
>>
>> I also tried autofocus without the _ with similar result: not rendering 
>> in the html - no errors either which is weird because it seems like every 
>> other thing I type generators an error of some kind ;)
>>
>> http://www.w3schools.com/tags/att_input_autofocus.asp
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] how to refer to other field in filter_in filter_out?

2013-12-17 Thread Ivan Gazzola
db.define_table('files',
   Field('nome','reference Nomi',required=True, requires=[IS_IN_DB(db, 
'Nomi.id')]),
   Field('title', "string", unique=False,label="Descrizione"),
   Field('note'),   
   Field('immagine', 'upload', autodelete=True),
   Field('datecreated','datetime',default=now,readable=False),
  
 Field('data_file','date',label="Data",requires=IS_DATE(format=('%d/%m/%Y'

I would like to set uploadfolder for immagine to ../data/nome.id  like 
"../data/3"

How can I access the values of the fields in the same row?

Thx

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: how to refer to other field in filter_in filter_out?

2013-12-17 Thread Ivan Gazzola
Currently I manage the upload folder in the controller with a function 
called by a ajax request.
But, for code optimization, I would prefer it be in the model.
I use this table in multiple pages and for different data files (jpg, tiff, 
pdf) and I would like to manage it in a single code.

Il giorno martedì 17 dicembre 2013 15:07:32 UTC+1, Anthony ha scritto:
>
> If you're dealing with form submissions, you could get the value from 
> request.post_vars.nome. Note, if you change the upload folder dynamically, 
> you will also need a way to set it when you retrieve the file.
>
> Anthony
>
> On Tuesday, December 17, 2013 7:35:09 AM UTC-5, Ivan Gazzola wrote:
>>
>> db.define_table('files',
>>Field('nome','reference Nomi',required=True, requires=[IS_IN_DB(db, 
>> 'Nomi.id')]),
>>Field('title', "string", unique=False,label="Descrizione"),
>>Field('note'),   
>>Field('immagine', 'upload', autodelete=True),
>>Field('datecreated','datetime',default=now,readable=False),
>>   
>>  
>> Field('data_file','date',label="Data",requires=IS_DATE(format=('%d/%m/%Y'
>>
>> I would like to set uploadfolder for immagine to ../data/nome.id  like 
>> "../data/3"
>>
>> How can I access the values of the fields in the same row?
>>
>> Thx
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: web2py Italy

2013-12-18 Thread Ivan Gazzola
Arrivo anch'io ...

Il giorno mercoledì 18 dicembre 2013 14:41:57 UTC+1, Raffaele Tesi ha 
scritto:
>
> Alla grande!!!
>
> Il giorno venerdì 27 settembre 2013 10:37:23 UTC+2, Gael Princivalle ha 
> scritto:
>>
>> Hi.
>>
>> For web2py users that speak Italian, I've create the web2py-it group. It 
>> could be a complementary tool for the Italian web2py community.
>> https://groups.google.com/forum/?fromgroups#!forum/web2py-it
>>
>> Ciao !
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Bug in DAL with SQLFORM, upload field and required field ???

2014-01-15 Thread Ivan Gazzola
I've this table:
db.define_table("Consulenze",
Field('dentista','reference Nominativi', required=True),
Field('data_inizio_collaborazione','date'),
Field('data_fine_collaborazione','date'),
Field  ('percentuale','integer'),
Field('logo','upload'))

In console insert and update works but if i try to insert from SQLFORM 
without specifying the upload field I get this error:
 foreign key constraint failed
and the query generated is:

"INSERT INTO Consulenze(logo,data_inizio_collabor...sta,percentuale) VALUES 
('',NULL,NULL,1240,NULL);"

^^ -->I think this 
is wrong and cuts the query before the required field!!!
If I comment the upload file 'logo' all works fine 



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Bug in DAL with SQLFORM, upload field and required field ???

2014-01-16 Thread Ivan Gazzola

The value for dentista is correct, is equal to Nominativi.id selected in 
drop-down list.
When I insert or update the record with 'logo' empty the query is generated 
with '' instead of NULL and sqlite cannot parse the full query.
if I update with db.Consulenze.insert(dentista=1240) it woks.



Il giorno giovedì 16 gennaio 2014 00:00:41 UTC+1, Anthony ha scritto:
>
> What value of dentista is being inserted, and have you confirmed that that 
> value is the id of one of the records in the Nominativi table?
>
> On Wednesday, January 15, 2014 5:56:18 PM UTC-5, Ivan Gazzola wrote:
>>
>> I've this table:
>> db.define_table("Consulenze",
>> Field('dentista','reference Nominativi', required=True),
>> Field('data_inizio_collaborazione','date'),
>> Field('data_fine_collaborazione','date'),
>> Field  ('percentuale','integer'),
>> Field('logo','upload'))
>>
>> In console insert and update works but if i try to insert from SQLFORM 
>> without specifying the upload field I get this error:
>>  foreign key constraint failed
>> and the query generated is:
>>
>> "INSERT INTO Consulenze(logo,data_inizio_collabor...sta,percentuale) 
>> VALUES ('',NULL,NULL,1240,NULL);"
>>   
>>   ^^ -->I think 
>> this is wrong and cuts the query before the required field!!!
>> If I comment the upload file 'logo' all works fine 
>>
>> 
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Bug in DAL with SQLFORM, upload field and required field ???

2014-01-16 Thread Ivan Gazzola
I found the code in sqlhtml.py, the empty upload value is '' or default

elif field.type == 'upload':
f = self.vars[fieldname]
fd = '%s__delete' % fieldname
if f == '' or f is None:
if self.vars.get(fd, False):
f = self.table[fieldname].default or ''
fields[fieldname] = f
elif self.record:
if self.record[fieldname]:
fields[fieldname] = self.record[fieldname]
else:
f = self.table[fieldname].default or ''
fields[fieldname] = f
else:
f = self.table[fieldname].default or ''
fields[fieldname] = f
self.vars[fieldname] = fields[fieldname]
if not f:
continue
else:


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Bug in DAL with SQLFORM, upload field and required field ???

2014-01-16 Thread Ivan Gazzola
Ok, i renamed the field logo in logo2 and all works fine...
Rechecking the code I saw that I had defined in a previous version the 
field "logo" as "reference".
it is probably not deleted the foreign key in sqlite when I change the 
definition of the field from "reference" to "upload"



thx

Ivan

Il giorno giovedì 16 gennaio 2014 15:17:24 UTC+1, Anthony ha scritto:
>
> I cannot reproduce the problem. Can you pack ttach an app the exhibits the 
> problem?
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: MULTIPLE APPLICATIONS IN SAME HOST/SUBDOMAINS WITH NGINX

2017-02-07 Thread Ivan Gazzola
Just edit the routes.py file
I'm using sub-domains and a file like this:

# -*- coding: utf-8 -*-

routers = dict(

BASE  = dict(

default_application="site1",

domains= {

'domain.com':'site1',

'app.domain.com':'app',

'app2.domain.com':'app2',
 

}
))

l codice...



Il giorno lunedì 6 febbraio 2017 13:39:03 UTC+1, Áureo Dias Neto ha scritto:
>
> Hello guys,
>
> how i'm host more than one application, in the same server, with 
> sub-domains on nginx?
>
> example: http://192.168.1.13/app1 -> 'app1'
> http://192.168.1.13/app2 -> 'app2'
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] ondelete attribute missing in 2.17.2

2018-11-04 Thread Ivan Gazzola
I've updated to 2.17.2-stable but i've got this error:

 invalid table "Prestazioni" attributes: set(['ondelete'])
invalid_kwargs  set(['ondelete'])
tablename 'Prestazioni'

My field is definied as:

Field('preventivo',db.Preventivi,requires=IS_EMPTY_OR(IS_IN_DB(db, 
'Preventivi.id'))),ondelete='SET NULL')

Is it changed pydal?

Regards


Ivan

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: ondelete attribute missing in 2.17.2

2018-11-04 Thread Ivan Gazzola
Sorry, I've found typo and removed message but you've been faster :)
I don't know why but the previous wrong syntax worked without problems for 
months on the previous version ... 

Thx Massimo!



Il giorno domenica 4 novembre 2018 22:07:41 UTC+1, Massimo Di Pierro ha 
scritto:
>
> It has not changed. I think you have a typo
>
> Field('preventivo',db.Preventivi,requires=IS_EMPTY_OR(IS_IN_DB(db, 
> 'Preventivi.id'))),ondelete='SET NULL')
>
> should be
>
> Field('preventivo',db.Preventivi,requires=IS_EMPTY_OR(IS_IN_DB(db, 
> 'Preventivi.id')),ondelete='SET NULL')
>
>
>
> On Sunday, 4 November 2018 12:50:21 UTC-8, Ivan Gazzola wrote:
>>
>> I've updated to 2.17.2-stable from 2.16.1 but i've got this error:
>>
>>  invalid table "Prestazioni" attributes: set(['ondelete'])
>> invalid_kwargs  set(['ondelete'])
>> tablename 'Prestazioni'
>>
>> My field is definied as:
>>
>> Field('preventivo',db.Preventivi,requires=IS_EMPTY_OR(IS_IN_DB(db, 
>> 'Preventivi.id'))),ondelete='SET NULL')
>>
>> Is it changed pydal?
>>
>> Regards
>>
>>
>> Ivan
>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Problem with sessions2trash.py

2015-02-05 Thread Ivan Gazzola
#!/bin/bash
while IFS= read -r app; do
  python /www/web2py/web2py.py --nogui --no-banner -S $app -M -R 
/www/web2pyscripts/sessions2trash.py -A -o -x 28800 -f 
>>/www/web2py/clean.txt 2>&1
done http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Problem with sessions2trash.py

2015-02-05 Thread Ivan Gazzola
I've checked but nothing found.
If I try to clean sessions from admin panel I can do it.

Il giorno venerdì 6 febbraio 2015 00:50:18 UTC+1, Massimo Di Pierro ha 
scritto:
>
> Is it possible you upgraded web2py but you have an older session2trash 
> running?
>
> On Thursday, 5 February 2015 17:17:56 UTC-6, Ivan Gazzola wrote:
>>
>> #!/bin/bash
>> while IFS= read -r app; do
>>   python /www/web2py/web2py.py --nogui --no-banner -S $app -M -R 
>> /www/web2pyscripts/sessions2trash.py -A -o -x 28800 -f 
>> >>/www/web2py/clean.txt 2>&1
>> done >
>>
>> I'm trying to clean sessions for many applications with a cron job.
>> I've stored all application names in list_app.txt, the file is like:
>>
>> app1
>> app2
>> app3
>> 
>>
>> When I run the script web2py start regularly but don't clean sessions.
>> I've tried also  replacing $app with a real application name (instead of 
>> a variable), but nothing happened indeed.
>> Any suggestion?
>>
>> Thx
>>
>> Ivan
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Problem with JSON

2015-02-16 Thread Ivan Gazzola
After last upgrade i've this problem with response.json

-Controller  cut ---


if form.process().accepted:
 return response.json({'formkey':form.formkey,'html'
:XML(html_from_helpers)})


-cut ---

The json generated by controller fails in this js because don't escape 
double quotes in html_from_helpers string. Is it a bug?  Before last update 
it worked fine 


$('#form').submit(function(e){
e.preventDefault();
$.ajax({
   type: "POST",
   url: "/my/url",
   data: $('#form').serialize(), // serializes the form's elements.
   success: function(json)
   {
   risposta=JSON.parse(json);; // show response from the php script.
  $('#form:input[name="_formkey"]').val(risposta.formkey);
  $('#myUL').html(risposta.html).listview('refresh');
  $(".risposta_flash").remove();$('Stato di cura 
inserito').prependTo("#content_principale").hide().slideDown();
   }
 });
return false;
});

Thx

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Problem with JSON

2015-02-18 Thread Ivan Gazzola
Ok, solved :)

The issue was in some changes in Jquery.

Now JQuery parses ajax response before than it is passed to success 
function, so js fails if I call "parse" on it:

risposta=JSON.parse(json);
  ^^^

THX

Ivan
Il giorno lunedì 16 febbraio 2015 21:12:17 UTC+1, Niphlod ha scritto:
>
> uhm. what does your shell print out of this ?
>
>
> response.json({'html' : XML('bar')})
>
>
>
> mine does
>
> u'{"html": "bar"}'
>
>
>
> so it's not the issue you're describing.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] How to debug views?

2018-11-18 Thread Ivan Gazzola
I'm writing my code with Pycharm and I like testing my code and debug with 
breakpoints.
Is there a way to debug python code in views?
I can't figure out how to do that, I just check errors in admin interface :(

Thx

Ivan 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Admin password

2019-10-25 Thread Ivan Gazzola
I've got the same problem
How did you solve it?
Thx

Ivan Gazzola

Il giorno giovedì 16 maggio 2019 17:32:26 UTC+2, Gaël Princivalle ha 
scritto:
>
> >Does parameters_443.py exist in web2py dir?
> Yes.
>
> >Check permissions - does web2py have access to this file?
> Yes
>
> Il giorno giovedì 16 maggio 2019 10:10:25 UTC+2, Val K ha scritto:
>>
>> Hi!
>> Does parameters_443.py exist in web2py dir?
>> Check permissions - does web2py have access to this file?
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/0ae54616-2031-41d3-b10e-6df9098f5f59%40googlegroups.com.


[web2py] Looking for web2py developer for Italian small company

2020-01-21 Thread Ivan Gazzola
We are a small company in Italy, we need a new developer for our project 
(xortho.it)

The web app is developed with jquery mobile and web2py, we are planning to 
move to angular and web2py or better py4web.
 
If you're interested please contact us.

Ciao

Ivan

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/9b87d283-adc7-4fbb-830a-8f3a3a45eddf%40googlegroups.com.


[web2py] Web2py fail auth to mysql

2022-05-01 Thread Ivan Gazzola


I'm ring to connect to a new db:

db=DAL('mysql://userx:password@localhost/IgXortho?set_encoding=utf8mb4')

I can login with corteo user, when I check grants I've got this:

><

mysql> show grants;

+---+

| Grants for userx@localhost   |

+---+

| GRANT USAGE ON *.* TO `userx`@`localhost`|

| GRANT ALL PRIVILEGES ON `IgXortho`.* TO `userx`@`localhost`  |

| GRANT ALL PRIVILEGES ON `ig_xortho`.* TO `userx`@`localhost` I 

 I've tried with common user and with root user but always same problem 
(you can see 2 db because I've changed name removing underscore from the 
name):

OperationalError: (1045, u"Access denied for user 'userx'@'localhost' 
(using password: NO)")

Web2py latest version, python 2.7.18 and MySQL is:

mysql  Ver 8.0.29 for Linux on x86_64 (MySQL Community Server - GPL)

I can't figure out why, it seems like the password doesn't go to the server
>>>

Traceback (most recent call last):

  File "", line 1, in 

  File "/www/web2py/gluon/packages/dal/pydal/base.py", line 679, in 
define_table

table = self.lazy_define_table(tablename, *fields, **kwargs)

  File "/www/web2py/gluon/packages/dal/pydal/base.py", line 720, in 
lazy_define_table

polymodel=polymodel,

  File "/www/web2py/gluon/packages/dal/pydal/adapters/base.py", line 943, 
in create_table

return self.migrator.create_table(*args, **kwargs)

  File "/www/web2py/gluon/packages/dal/pydal/migrator.py", line 337, in 
create_table

self.adapter.create_sequence_and_triggers(query, table)

  File "/www/web2py/gluon/packages/dal/pydal/adapters/base.py", line 1027, 
in create_sequence_and_triggers

self.execute(query)

  File "/www/web2py/gluon/packages/dal/pydal/adapters/__init__.py", line 
65, in wrap

if not args[0].connection:

  File "/www/web2py/gluon/packages/dal/pydal/connection.py", line 32, in 
connection

return self.get_connection()

  File "/www/web2py/gluon/packages/dal/pydal/connection.py", line 65, in 
get_connection

connection = self.connector()

  File "/www/web2py/gluon/packages/dal/pydal/adapters/mysql.py", line 64, 
in connector

conn = self.driver.connect(**self.driver_args)

  File "gluon/contrib/pymysql/__init__.py", line 90, in Connect

return Connection(*args, **kwargs)

  File "gluon/contrib/pymysql/connections.py", line 688, in __init__

self.connect()

  File "gluon/contrib/pymysql/connections.py", line 906, in connect

self._request_authentication()

  File "gluon/contrib/pymysql/connections.py", line 1114, in 
_request_authentication

auth_packet = self._read_packet()

  File "gluon/contrib/pymysql/connections.py", line 981, in _read_packet

packet.check_error()

  File "gluon/contrib/pymysql/connections.py", line 393, in check_error

err.raise_mysql_exception(self._data)

  File "gluon/contrib/pymysql/err.py", line 107, in raise_mysql_exception

raise errorclass(errno, errval)

gluon.contrib.pymysql.err.OperationalError: (1045, u"Access denied for user 
'userx'@'localhost' (using password: NO)")

<<<

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/0117bb75-7bb1-4d16-87a0-831a39711021n%40googlegroups.com.


[web2py] web2py fails auth on mysql with 1045 error

2022-05-01 Thread Ivan Gazzola


I'm trying to connect to a new db:

db=DAL('mysql://userx:password@localhost/IgXortho?set_encoding=utf8mb4')

I can login with my user, when I check grants I've got this:

><

mysql> show grants;

+---+

| Grants for userx@localhost   |

+---+

| GRANT USAGE ON *.* TO `userx`@`localhost`|

| GRANT ALL PRIVILEGES ON `IgXortho`.* TO `userx`@`localhost`  |

| GRANT ALL PRIVILEGES ON `ig_xortho`.* TO `userx`@`localhost` I 

 I've tried with common user and with root user but always same problem 
(you can see 2 db because I've changed name removing underscore from the 
name):

OperationalError: (1045, u"Access denied for user 'userx'@'localhost' 
(using password: NO)")

Web2py latest version, python 2.7.18 and MySQL is:

mysql  Ver 8.0.29 for Linux on x86_64 (MySQL Community Server - GPL)

I can't figure out why, it seems like the password doesn't go to the server
>>>

Traceback (most recent call last):

  File "", line 1, in 

  File "/www/web2py/gluon/packages/dal/pydal/base.py", line 679, in 
define_table

table = self.lazy_define_table(tablename, *fields, **kwargs)

  File "/www/web2py/gluon/packages/dal/pydal/base.py", line 720, in 
lazy_define_table

polymodel=polymodel,

  File "/www/web2py/gluon/packages/dal/pydal/adapters/base.py", line 943, 
in create_table

return self.migrator.create_table(*args, **kwargs)

  File "/www/web2py/gluon/packages/dal/pydal/migrator.py", line 337, in 
create_table

self.adapter.create_sequence_and_triggers(query, table)

  File "/www/web2py/gluon/packages/dal/pydal/adapters/base.py", line 1027, 
in create_sequence_and_triggers

self.execute(query)

  File "/www/web2py/gluon/packages/dal/pydal/adapters/__init__.py", line 
65, in wrap

if not args[0].connection:

  File "/www/web2py/gluon/packages/dal/pydal/connection.py", line 32, in 
connection

return self.get_connection()

  File "/www/web2py/gluon/packages/dal/pydal/connection.py", line 65, in 
get_connection

connection = self.connector()

  File "/www/web2py/gluon/packages/dal/pydal/adapters/mysql.py", line 64, 
in connector

conn = self.driver.connect(**self.driver_args)

  File "gluon/contrib/pymysql/__init__.py", line 90, in Connect

return Connection(*args, **kwargs)

  File "gluon/contrib/pymysql/connections.py", line 688, in __init__

self.connect()

  File "gluon/contrib/pymysql/connections.py", line 906, in connect

self._request_authentication()

  File "gluon/contrib/pymysql/connections.py", line 1114, in 
_request_authentication

auth_packet = self._read_packet()

  File "gluon/contrib/pymysql/connections.py", line 981, in _read_packet

packet.check_error()

  File "gluon/contrib/pymysql/connections.py", line 393, in check_error

err.raise_mysql_exception(self._data)

  File "gluon/contrib/pymysql/err.py", line 107, in raise_mysql_exception

raise errorclass(errno, errval)

gluon.contrib.pymysql.err.OperationalError: (1045, u"Access denied for user 
'userx'@'localhost' (using password: NO)")

<<<

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/c674d8eb-4aae-4978-a316-7f96b5d7bb5cn%40googlegroups.com.


[web2py] Autocomplete problem ...

2013-01-24 Thread Ivan Gazzola
I'm trying my first application in web2py.

I've this model

db.define_table('Person', Field('name'), format='%(name)s')
db.define_table('Relation', Field('name',db.Person), ('contact',db.Person))
db.Relation.name.widget=SQLFORM.widgets.autocomplete(request,db.Person,id_field=db.Person.id)
db.Relation.contact.widget=SQLFORM.widgets.autocomplete(request,db.Person,id_field=db.Person.id)

When i try to insert a new record in Relation from appadmin i can't do for 
type mismatch, the form post db.Person.name value, not db.Person.id as i 
expected ...

I use web2py 2.3.2 for win. 

any suggestions???

--