[web2py] Bug in gluon/scheduler.py

2022-08-08 Thread Tom Clerckx
Version:
Version 2.22.5-stable+timestamp.2022.06.04.18.13.51

There is a problem with the calculation of next_run_time in 
gluon/scheduler.py at line 1024

It calculates:
steps = secondspassed // task.period + 1

However, there is no check done for task.period being 0

This can cause the following scheduler error:
ZeroDivisionError: float divmod()

I think it would be better to initialize next_run_time and change the last 
else condition to "elif task.period".

-- 
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/0dafdff8-a64b-47a9-8e5b-98336517a296n%40googlegroups.com.


[web2py] BUG response.cookies and sessions2trash.py

2020-02-27 Thread 'Annet' via web2py-users
I scheduled cron to regularly trash the session in my web2py applications. 
this worked well
until I added this line of code to a model.py file;

response.cookies[response.session_id_name]['domain'] = '.leonexus.nl'

My scripts log any errors at ~my/logs/user/sessions2trash.log.
That file is full of lines like:

Traceback (most recent call last):
  File "/home/my/webapps/web2py/web2py/gluon/restricted.py", line 227, in 
restricted
exec ccode in environment
  File "applications/init/models/00_init_db.py", line 6, in 
response.cookies[response.session_id_name]['domain'] = '.mydomain.com'
KeyError: None

I know in python a KeyError is raised when a dictionary is accessed but the 
key requested is not in it.
However, I have no idea why the line of code interferes with calling 
/scripts/sessions2trash.py

I am working with web2py 2.14.5 and python 2.7
Hope someone can help me solve the issue.


Kind regards,

Annet

-- 
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/ca03bcf7-2e00-4aee-a645-8ea01fd90f3b%40googlegroups.com.


[web2py] Bug? uploaded file is deleted by delete_record() even if record versioning enabled

2019-10-19 Thread 'jim kaubisch' via web2py-users
As expected, when RECORD VERSIONING is enabled, a db record deletion causes 
the RECORD to be archived with all the record contents maintained rather 
than being deleted. 
And if the record is reactivated, all the record contents are restored 

However, if the record has an upload field and autodelete=True  is 
specified, the ACTUAL FILE is deleted. 

In my opinion this produces an inconsistent result. The archived db record 
retains the path - but now to a non-existent file.
if delete() and record_delete() don't mean truly delete, then the 
autodelete shouldn't either

with autodelete
Field('the_file', 'upload' , label=T('Audio File')
 , writable=True
 , autodelete=True
 , default=None
 , 
uploadfolder=os.path.join(request.folder,'uploads/resources/audio')
),

and the result of a record delete is...

archive_x2m: archive base_table record = audios[10]

archive_x2m: uploaded audio file path = 
/Applications/web2py_dev/applications/MFMCurrAssetMgr/uploads/resources/audio/audios.the_file.b96db9904e30d353.6131343035323731312e6d7033.mp3

archive_x2m: Does uploaded file exists BEFORE delete_record(), i.e. 
os.path.exists(full_path)? -  True

archive_x2m:   >> execute "db(db.audios.id == record_id).delete()"

archive_x2m: Does uploaded file exist AFTER delete_record(), i.e. 
os.path.exists(full_path)? -  False

archive_x2m: Done !




the following without autodelete...
Field('the_file', 'upload' , label=T('Audio File')
 , writable=True
 , default=None
 , 
uploadfolder=os.path.join(request.folder,'uploads/resources/audio')

),


and the result

archive_x2m: archive base_table record = audios[30]

archive_x2m: uploaded audio file path = 
/Applications/web2py_dev/applications/MFMCurrAssetMgr/uploads/resources/audio/audios.the_file.bd416488d5bffdf5.6131343035323733322e6d7033.mp3

archive_x2m: Does uploaded file exists BEFORE delete_record(), i.e. 
os.path.exists(full_path)? -  True

archive_x2m:   >> execute "db(db.audios.id == record_id).delete()"

archive_x2m: Does uploaded file exist AFTER delete_record(), i.e. 
os.path.exists(full_path)? -  True

archive_x2m: Done !



-- 
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/00f6f338-2294-4878-b918-e15cc5e44888%40googlegroups.com.


[web2py] Bug in grid's edit validation.

2019-04-10 Thread João Matos
Hello,

I found a bug in the grid's edit validation.
I follow this procedure:
 - Select a record to edit.
 - Change one of the fields that must be unique and change it to a value 
that already exists.
 - web2py shows an error message (which is correct and happens before going 
to onvalidation, which is also correct).
 - Change the value to something that doesn't already exist in the table.
 - Mark the record for deletion.
 - Submit the record.

The bug I found is that web2py was supposed to go to onvalidation before 
deleting the record and that doesn't happen.

Can someone confirm this behavior and that it is indeed a bug? 

Thanks,

JM


My env:
Windows 7 Pro x64 w/SP1+all upd
Firefox 66.0.2 x64
web2py 2.18.5 (2.18.4 showed the same problem)
Python 3.7.1 x86

-- 
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] BUG Reset password link Spanish

2019-03-05 Thread Yann Dulondel
2.18.2-stable+timestamp.2019.02.26.06.11.06
(Running on Microsoft-IIS/7.5, Python 2.7.15) 

Hi all,
I force the application to display in Spanish by using the T.force('es-es').
When i use the link to reset 'Forgot yout password' , i have the error 
below.
Understand that Spanish can't be ascii. How can i fix this ? or is it a 
conception error ?
Best regard
Yann

-- 
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] Bug in tools.py

2018-12-12 Thread Ben Duncan
in tools.py,  function :login_bare there is the command:

if ((user.registration_key is None or not user.registration_key.strip()) and
password == user[settings.passfield]):
self.login_user(user)
return user

strip requires the the import of string.method
Shouldn't there be a "import string" after the def login_bare ?

Thanks.

*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division

-- 
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] BUG LOGIN WEB2PY WHEN USE ORACLE

2018-10-11 Thread benito . pena
Hello guys,

When i use Oracle database, Login method not working and return a error 
ilegal variable name (When i use Sqlite or MySQL everything is ok)

Somebody help me


Thanks



-- 

Parque Empresarial Estrella del Sur
Edificio Vilaser. C\ Aviación, 31 

Oficina 1 · 41007 Sevilla 
T: +34 955 54 08 27 · F: +34 955 43 29 14 

*www.guadaltech.es  · * 
    
  





Antes de imprimir este e-mail, 
piense bien si es necesario hacerlo: el medioambiente es cosa de todos.


Este correo electrónico y, en su caso, cualquier fichero anexo al mismo, 
contiene información de carácter confidencial exclusivamente dirigida a su 
destinatario o destinatarios. Queda prohibida su divulgación, copia o 
distribución a terceros sin la previa autorización escrita del remitente. 
En el caso de haber recibido este correo electrónico por error, se ruega 
notificar inmediatamente esta circunstancia mediante reenvío a la dirección 
electrónica del remitente.













Política Privacidad: Este mensaje y 
sus archivos adjuntos van dirigidos exclusivamente a su destinatario, 
pudiendo contener información confidencial sometida a secreto profesional. 
No está permitida su reproducción o distribución sin la autorización 
expresa de Guadaltech. Si usted no es el destinatario final por favor 
elimínelo e infórmenos por esta vía. Sus datos serán incorporados a un 
fichero del que es titular y responsable Guadaltech, de procedencia 
facilitada por el/la interesado/a y los trataremos de forma confidencial y 
exclusivamente con la finalidad de prestar los servicios solicitados, 
enviar comunicaciones comerciales o gestionar la relación laboral, 
legitimado por la ejecución de un contrato o por interés legítimo del 
Responsable. El tratamiento de los datos se hará conforme a todas las 
garantías legales y de seguridad que impone la Ley Orgánica 15/1999 de 13 
de diciembre, de protección de datos de carácter personal (LOPD), como por 
el Real Decreto 1720/2007, de 21 de diciembre, que la desarrolla (RLOPD), 
así como por el Reglamento (UE) 2016/679 del Parlamento Europeo y del 
Consejo, de 27 de abril de 2016, relativo a la protección de las personas 
físicas en lo que respecta al tratamiento de datos personales y a la libre 
circulación de estos datos (RGPD) tras su entrada en vigor el 25 de mayo de 
2018. No está prevista la cesión de datos, salvo requerimiento legal. 
Igualmente informarle que podrá revocar el consentimiento prestado y 
ejercer los derechos de acceso, rectificación, supresión, limitación de 
tratamiento, portabilidad de los datos, oposición y a no ser objeto de 
decisiones individualizadas. Puede consultar información adicional y 
detallada sobre Protección de Datos en nuestra web www.guadaltech.es 
.


-- 
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.


Re: [web2py] Bug in ldap library for python3?

2018-03-15 Thread Richard Vézina
Migth be interesting in this patch :
https://github.com/web2py/web2py/issues/1880

On Wed, Mar 14, 2018 at 12:43 PM, Richard Vézina <
ml.richard.vez...@gmail.com> wrote:

> It debian package... If you goes with pip it should be python-ldap...
>
> Good luck
>
> Richard
>
> On Wed, Mar 14, 2018 at 3:57 AM, Johann Spies 
> wrote:
>
>> Thanks Richard for your attention.
>>
>> I have checked my setup again and saw that I had the debian-package
>> python3-ldap3 and not python3-ldap.
>>
>> I have installed  python3-ldap and now it works - at least so far for
>> importing:
>>
>> from gluon.contrib.login_methods.ldap_auth import ldap_auth
>>
>> Regards
>> Johann
>>
>> On 13 March 2018 at 19:05, Richard Vézina 
>> wrote:
>> > It might not be an issue with auth_ldap.py
>> >
>> > On Tue, Mar 13, 2018 at 12:29 PM, Richard Vézina
>> >  wrote:
>> >>
>> >> It works fine...
>> >>
>> >> On Tue, Mar 13, 2018 at 12:28 PM, Richard Vézina
>> >>  wrote:
>> >>>
>> >>> I try with a module of mine using ldap and had issues with ldapS
>> >>> connection...
>> >>>
>> >>> I had to follow this :
>> >>>
>> >>> https://github.com/python-ldap/python-ldap/issues/55
>> >>>
>> >>> l = ldap.initialize("ldaps://{s}:{p}".format(s=server, p=636))
>> >>> l.set_option(ldap.OPT_PROTOCOL_VERSION, ldap.VERSION3)
>> >>> # l.set_option(ldap.OPT_X_TLS_CACERTFILE, 'path/to/ca.pem')  # Wasn't
>> >>> required...
>> >>> l.set_option(ldap.OPT_X_TLS_REQUIRE_CERT, ldap. OPT_X_TLS_NEVER)
>> >>> l.set_option(ldap.OPT_X_TLS_NEWCTX, 0)
>> >>>
>> >>> Then it connected properly under python3 only...
>> >>>
>> >>> Will make some test in python2 if the back port of the above cause any
>> >>> issue...
>> >>>
>> >>> Richard
>> >>>
>> >>>
>> >>> On Tue, Mar 13, 2018 at 11:58 AM, Richard Vézina
>> >>>  wrote:
>> 
>>  Please try this :
>> 
>>  sudo apt-get install libsasl2-dev python-dev libldap2-dev libssl-dev
>>  # setuptools should be there... I was miss leading...
>>  sudo pip3 install python-ldap
>> 
>>  Please provide progress as if auth_ldap.py works properly with
>> python3
>>  once you install python-ldap properly under python3.
>> 
>>  Thanks
>> 
>>  Richard
>> 
>> 
>>  On Tue, Mar 13, 2018 at 11:39 AM, Richard Vézina
>>   wrote:
>> >
>> > I open this issue :
>> >
>> > https://github.com/python-ldap/python-ldap/issues/181
>> >
>> > On Tue, Mar 13, 2018 at 11:03 AM, Richard Vézina
>> >  wrote:
>> >>
>> >> python3-ldap -> ldap3
>> >> (https://pypi.python.org/pypi/python3-ldap/0.9.8.4/) is not the
>> same thing
>> >> as python-ldap...
>> >>
>> >> It seems that python-ldap support python 3 :
>> >>
>> >> https://github.com/python-ldap/python-ldap
>> >>
>> >> Saddly enough, I hadn't successfully install python-ldap under
>> python3
>> >> with pip3... It fails over importing setuptools issue...
>> Setuptools is
>> >> installed, so I wonder what going on...
>> >>
>> >> It seems to be working with python 3.4+ :
>> >> https://www.python-ldap.org/en/latest/installing.html#build-
>> prerequisites
>> >>
>> >> If you have ubuntu you can try on your side :
>> >>
>> >> sudo pip3 install -U setuptools
>> >> sudo pip3 install python-ldap
>> >>
>> >>
>> >> It would be nice if python-ldap just works under python3 as we
>> >> wouldn't have to touch ldap_auth.py as python-ldap should have
>> keep the same
>> >> API under python3...
>> >>
>> >> Though ldap3 seems to offer interresting progres, but I didn't try
>> it.
>> >>
>> >> Please keep posting here your progress.
>> >>
>> >> Thanks
>> >>
>> >> Richard
>> >>
>> >>
>> >>
>> >> On Tue, Mar 13, 2018 at 8:32 AM, Johann Spies <
>> johann.sp...@gmail.com>
>> >> wrote:
>> >>>
>> >>> Version 2.16.1
>> >>>
>> >>> In python (2.7) I can do:
>> >>>
>> >>> python web2py.py -S welcome
>> >>> ..
>> >>>
>> >>> In [1]: from gluon.contrib.login_methods.ldap_auth import
>> ldap_auth
>> >>>
>> >>> In [2]:
>> >>>
>> >>> But not when I use python3 (and I have python3-ldap installed).
>> >>>
>> >>>
>> >>> ```
>> >>> /home/js/web2py/gluon/custom_import.py in custom_importer(name,
>> >>> globals, locals, fromlist, level)
>> >>> 109 import_tb = None
>> >>> 110
>> >>> --> 111 return NATIVE_IMPORTER(name, globals, locals,
>> fromlist,
>> >>> level)
>> >>> 112
>> >>> 113
>> >>>
>> >>> /home/js/web2py/gluon/contrib/login_methods/ldap_auth.py in
>> >>> ()
>> >>>  12 except Exception as e:
>> >>>  13 logging.error('missing ldap, try "easy_install
>> >>> 

Re: [web2py] Bug in ldap library for python3?

2018-03-14 Thread Richard Vézina
It debian package... If you goes with pip it should be python-ldap...

Good luck

Richard

On Wed, Mar 14, 2018 at 3:57 AM, Johann Spies 
wrote:

> Thanks Richard for your attention.
>
> I have checked my setup again and saw that I had the debian-package
> python3-ldap3 and not python3-ldap.
>
> I have installed  python3-ldap and now it works - at least so far for
> importing:
>
> from gluon.contrib.login_methods.ldap_auth import ldap_auth
>
> Regards
> Johann
>
> On 13 March 2018 at 19:05, Richard Vézina 
> wrote:
> > It might not be an issue with auth_ldap.py
> >
> > On Tue, Mar 13, 2018 at 12:29 PM, Richard Vézina
> >  wrote:
> >>
> >> It works fine...
> >>
> >> On Tue, Mar 13, 2018 at 12:28 PM, Richard Vézina
> >>  wrote:
> >>>
> >>> I try with a module of mine using ldap and had issues with ldapS
> >>> connection...
> >>>
> >>> I had to follow this :
> >>>
> >>> https://github.com/python-ldap/python-ldap/issues/55
> >>>
> >>> l = ldap.initialize("ldaps://{s}:{p}".format(s=server, p=636))
> >>> l.set_option(ldap.OPT_PROTOCOL_VERSION, ldap.VERSION3)
> >>> # l.set_option(ldap.OPT_X_TLS_CACERTFILE, 'path/to/ca.pem')  # Wasn't
> >>> required...
> >>> l.set_option(ldap.OPT_X_TLS_REQUIRE_CERT, ldap. OPT_X_TLS_NEVER)
> >>> l.set_option(ldap.OPT_X_TLS_NEWCTX, 0)
> >>>
> >>> Then it connected properly under python3 only...
> >>>
> >>> Will make some test in python2 if the back port of the above cause any
> >>> issue...
> >>>
> >>> Richard
> >>>
> >>>
> >>> On Tue, Mar 13, 2018 at 11:58 AM, Richard Vézina
> >>>  wrote:
> 
>  Please try this :
> 
>  sudo apt-get install libsasl2-dev python-dev libldap2-dev libssl-dev
>  # setuptools should be there... I was miss leading...
>  sudo pip3 install python-ldap
> 
>  Please provide progress as if auth_ldap.py works properly with python3
>  once you install python-ldap properly under python3.
> 
>  Thanks
> 
>  Richard
> 
> 
>  On Tue, Mar 13, 2018 at 11:39 AM, Richard Vézina
>   wrote:
> >
> > I open this issue :
> >
> > https://github.com/python-ldap/python-ldap/issues/181
> >
> > On Tue, Mar 13, 2018 at 11:03 AM, Richard Vézina
> >  wrote:
> >>
> >> python3-ldap -> ldap3
> >> (https://pypi.python.org/pypi/python3-ldap/0.9.8.4/) is not the
> same thing
> >> as python-ldap...
> >>
> >> It seems that python-ldap support python 3 :
> >>
> >> https://github.com/python-ldap/python-ldap
> >>
> >> Saddly enough, I hadn't successfully install python-ldap under
> python3
> >> with pip3... It fails over importing setuptools issue... Setuptools
> is
> >> installed, so I wonder what going on...
> >>
> >> It seems to be working with python 3.4+ :
> >> https://www.python-ldap.org/en/latest/installing.html#
> build-prerequisites
> >>
> >> If you have ubuntu you can try on your side :
> >>
> >> sudo pip3 install -U setuptools
> >> sudo pip3 install python-ldap
> >>
> >>
> >> It would be nice if python-ldap just works under python3 as we
> >> wouldn't have to touch ldap_auth.py as python-ldap should have keep
> the same
> >> API under python3...
> >>
> >> Though ldap3 seems to offer interresting progres, but I didn't try
> it.
> >>
> >> Please keep posting here your progress.
> >>
> >> Thanks
> >>
> >> Richard
> >>
> >>
> >>
> >> On Tue, Mar 13, 2018 at 8:32 AM, Johann Spies <
> johann.sp...@gmail.com>
> >> wrote:
> >>>
> >>> Version 2.16.1
> >>>
> >>> In python (2.7) I can do:
> >>>
> >>> python web2py.py -S welcome
> >>> ..
> >>>
> >>> In [1]: from gluon.contrib.login_methods.ldap_auth import
> ldap_auth
> >>>
> >>> In [2]:
> >>>
> >>> But not when I use python3 (and I have python3-ldap installed).
> >>>
> >>>
> >>> ```
> >>> /home/js/web2py/gluon/custom_import.py in custom_importer(name,
> >>> globals, locals, fromlist, level)
> >>> 109 import_tb = None
> >>> 110
> >>> --> 111 return NATIVE_IMPORTER(name, globals, locals, fromlist,
> >>> level)
> >>> 112
> >>> 113
> >>>
> >>> /home/js/web2py/gluon/contrib/login_methods/ldap_auth.py in
> >>> ()
> >>>  12 except Exception as e:
> >>>  13 logging.error('missing ldap, try "easy_install
> >>> python-ldap"')
> >>> ---> 14 raise e
> >>>  15
> >>>  16
> >>>
> >>> /home/js/web2py/gluon/contrib/login_methods/ldap_auth.py in
> >>> ()
> >>>   7 import logging
> >>>   8 try:
> >>> > 9 import ldap
> >>>  10 import ldap.filter
> >>>  11 

Re: [web2py] Bug in ldap library for python3?

2018-03-14 Thread Johann Spies
Thanks Richard for your attention.

I have checked my setup again and saw that I had the debian-package
python3-ldap3 and not python3-ldap.

I have installed  python3-ldap and now it works - at least so far for importing:

from gluon.contrib.login_methods.ldap_auth import ldap_auth

Regards
Johann

On 13 March 2018 at 19:05, Richard Vézina  wrote:
> It might not be an issue with auth_ldap.py
>
> On Tue, Mar 13, 2018 at 12:29 PM, Richard Vézina
>  wrote:
>>
>> It works fine...
>>
>> On Tue, Mar 13, 2018 at 12:28 PM, Richard Vézina
>>  wrote:
>>>
>>> I try with a module of mine using ldap and had issues with ldapS
>>> connection...
>>>
>>> I had to follow this :
>>>
>>> https://github.com/python-ldap/python-ldap/issues/55
>>>
>>> l = ldap.initialize("ldaps://{s}:{p}".format(s=server, p=636))
>>> l.set_option(ldap.OPT_PROTOCOL_VERSION, ldap.VERSION3)
>>> # l.set_option(ldap.OPT_X_TLS_CACERTFILE, 'path/to/ca.pem')  # Wasn't
>>> required...
>>> l.set_option(ldap.OPT_X_TLS_REQUIRE_CERT, ldap. OPT_X_TLS_NEVER)
>>> l.set_option(ldap.OPT_X_TLS_NEWCTX, 0)
>>>
>>> Then it connected properly under python3 only...
>>>
>>> Will make some test in python2 if the back port of the above cause any
>>> issue...
>>>
>>> Richard
>>>
>>>
>>> On Tue, Mar 13, 2018 at 11:58 AM, Richard Vézina
>>>  wrote:

 Please try this :

 sudo apt-get install libsasl2-dev python-dev libldap2-dev libssl-dev
 # setuptools should be there... I was miss leading...
 sudo pip3 install python-ldap

 Please provide progress as if auth_ldap.py works properly with python3
 once you install python-ldap properly under python3.

 Thanks

 Richard


 On Tue, Mar 13, 2018 at 11:39 AM, Richard Vézina
  wrote:
>
> I open this issue :
>
> https://github.com/python-ldap/python-ldap/issues/181
>
> On Tue, Mar 13, 2018 at 11:03 AM, Richard Vézina
>  wrote:
>>
>> python3-ldap -> ldap3
>> (https://pypi.python.org/pypi/python3-ldap/0.9.8.4/) is not the same 
>> thing
>> as python-ldap...
>>
>> It seems that python-ldap support python 3 :
>>
>> https://github.com/python-ldap/python-ldap
>>
>> Saddly enough, I hadn't successfully install python-ldap under python3
>> with pip3... It fails over importing setuptools issue... Setuptools is
>> installed, so I wonder what going on...
>>
>> It seems to be working with python 3.4+ :
>> https://www.python-ldap.org/en/latest/installing.html#build-prerequisites
>>
>> If you have ubuntu you can try on your side :
>>
>> sudo pip3 install -U setuptools
>> sudo pip3 install python-ldap
>>
>>
>> It would be nice if python-ldap just works under python3 as we
>> wouldn't have to touch ldap_auth.py as python-ldap should have keep the 
>> same
>> API under python3...
>>
>> Though ldap3 seems to offer interresting progres, but I didn't try it.
>>
>> Please keep posting here your progress.
>>
>> Thanks
>>
>> Richard
>>
>>
>>
>> On Tue, Mar 13, 2018 at 8:32 AM, Johann Spies 
>> wrote:
>>>
>>> Version 2.16.1
>>>
>>> In python (2.7) I can do:
>>>
>>> python web2py.py -S welcome
>>> ..
>>>
>>> In [1]: from gluon.contrib.login_methods.ldap_auth import ldap_auth
>>>
>>> In [2]:
>>>
>>> But not when I use python3 (and I have python3-ldap installed).
>>>
>>>
>>> ```
>>> /home/js/web2py/gluon/custom_import.py in custom_importer(name,
>>> globals, locals, fromlist, level)
>>> 109 import_tb = None
>>> 110
>>> --> 111 return NATIVE_IMPORTER(name, globals, locals, fromlist,
>>> level)
>>> 112
>>> 113
>>>
>>> /home/js/web2py/gluon/contrib/login_methods/ldap_auth.py in
>>> ()
>>>  12 except Exception as e:
>>>  13 logging.error('missing ldap, try "easy_install
>>> python-ldap"')
>>> ---> 14 raise e
>>>  15
>>>  16
>>>
>>> /home/js/web2py/gluon/contrib/login_methods/ldap_auth.py in
>>> ()
>>>   7 import logging
>>>   8 try:
>>> > 9 import ldap
>>>  10 import ldap.filter
>>>  11 ldap.set_option(ldap.OPT_REFERRALS, 0)
>>>
>>> /home/js/web2py/gluon/custom_import.py in custom_importer(name,
>>> globals, locals, fromlist, level)
>>> 102 return NATIVE_IMPORTER(name, globals, locals,
>>> fromlist, level)
>>> 103 except (ImportError, KeyError) as e3:
>>> --> 104 raise ImportError(e1, import_tb)  # there an
>>> import error in the module
>>> 105 except Exception as e2:

Re: [web2py] Bug in ldap library for python3?

2018-03-13 Thread Richard Vézina
It might not be an issue with auth_ldap.py

On Tue, Mar 13, 2018 at 12:29 PM, Richard Vézina <
ml.richard.vez...@gmail.com> wrote:

> It works fine...
>
> On Tue, Mar 13, 2018 at 12:28 PM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>> I try with a module of mine using ldap and had issues with ldapS
>> connection...
>>
>> I had to follow this :
>>
>> https://github.com/python-ldap/python-ldap/issues/55
>>
>> l = ldap.initialize("ldaps://{s}:{p}".format(s=server, p=636))
>> l.set_option(ldap.OPT_PROTOCOL_VERSION, ldap.VERSION3)
>> # l.set_option(ldap.OPT_X_TLS_CACERTFILE, 'path/to/ca.pem')  # Wasn't
>> required...
>> l.set_option(ldap.OPT_X_TLS_REQUIRE_CERT, ldap. OPT_X_TLS_NEVER)
>> l.set_option(ldap.OPT_X_TLS_NEWCTX, 0)
>>
>> Then it connected properly under python3 only...
>>
>> Will make some test in python2 if the back port of the above cause any
>> issue...
>>
>> Richard
>>
>>
>> On Tue, Mar 13, 2018 at 11:58 AM, Richard Vézina <
>> ml.richard.vez...@gmail.com> wrote:
>>
>>> Please try this :
>>>
>>> sudo apt-get install libsasl2-dev python-dev libldap2-dev libssl-dev
>>> # setuptools should be there... I was miss leading...
>>> sudo pip3 install python-ldap
>>>
>>> Please provide progress as if auth_ldap.py works properly with python3
>>> once you install python-ldap properly under python3.
>>>
>>> Thanks
>>>
>>> Richard
>>>
>>>
>>> On Tue, Mar 13, 2018 at 11:39 AM, Richard Vézina <
>>> ml.richard.vez...@gmail.com> wrote:
>>>
 I open this issue :

 https://github.com/python-ldap/python-ldap/issues/181

 On Tue, Mar 13, 2018 at 11:03 AM, Richard Vézina <
 ml.richard.vez...@gmail.com> wrote:

> python3-ldap -> ldap3 (https://pypi.python.org/pypi/
> python3-ldap/0.9.8.4/) is not the same thing as python-ldap...
>
> It seems that python-ldap support python 3 :
>
> https://github.com/python-ldap/python-ldap
>
> Saddly enough, I hadn't successfully install python-ldap under python3
> with pip3... It fails over importing setuptools issue... Setuptools is
> installed, so I wonder what going on...
>
> It seems to be working with python 3.4+ : https://www.python-ldap.org/
> en/latest/installing.html#build-prerequisites
>
> If you have ubuntu you can try on your side :
>
> sudo pip3 install -U setuptools
> sudo pip3 install python-ldap
>
>
> It would be nice if python-ldap just works under python3 as we
> wouldn't have to touch ldap_auth.py as python-ldap should have keep the
> same API under python3...
>
> Though ldap3 seems to offer interresting progres, but I didn't try it.
>
> Please keep posting here your progress.
>
> Thanks
>
> Richard
>
>
>
> On Tue, Mar 13, 2018 at 8:32 AM, Johann Spies 
> wrote:
>
>> Version 2.16.1
>>
>> In python (2.7) I can do:
>>
>> python web2py.py -S welcome
>> ..
>>
>> In [1]: from gluon.contrib.login_methods.ldap_auth import ldap_auth
>>
>> In [2]:
>>
>> But not when I use python3 (and I have python3-ldap installed).
>>
>>
>> ```
>> /home/js/web2py/gluon/custom_import.py in custom_importer(name,
>> globals, locals, fromlist, level)
>> 109 import_tb = None
>> 110
>> --> 111 return NATIVE_IMPORTER(name, globals, locals, fromlist,
>> level)
>> 112
>> 113
>>
>> /home/js/web2py/gluon/contrib/login_methods/ldap_auth.py in
>> ()
>>  12 except Exception as e:
>>  13 logging.error('missing ldap, try "easy_install
>> python-ldap"')
>> ---> 14 raise e
>>  15
>>  16
>>
>> /home/js/web2py/gluon/contrib/login_methods/ldap_auth.py in
>> ()
>>   7 import logging
>>   8 try:
>> > 9 import ldap
>>  10 import ldap.filter
>>  11 ldap.set_option(ldap.OPT_REFERRALS, 0)
>>
>> /home/js/web2py/gluon/custom_import.py in custom_importer(name,
>> globals, locals, fromlist, level)
>> 102 return NATIVE_IMPORTER(name, globals, locals,
>> fromlist, level)
>> 103 except (ImportError, KeyError) as e3:
>> --> 104 raise ImportError(e1, import_tb)  # there an
>> import error in the module
>> 105 except Exception as e2:
>> 106 raise  # there is an error in the module
>>
>> ImportError: (ImportError("Cannot import module
>> 'applications.welcome.modules.ldap'",), > 0x7fe54161fd88>)
>>
>> ```
>>
>> It seems to me like a bug?
>>
>> Regards
>> Johann
>>
>> --
>> Because experiencing your loyal love is better than life itself,
>> my lips will praise you.  (Psalm 63:3)
>>
>> --
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - 

Re: [web2py] Bug in ldap library for python3?

2018-03-13 Thread Richard Vézina
It works fine...

On Tue, Mar 13, 2018 at 12:28 PM, Richard Vézina <
ml.richard.vez...@gmail.com> wrote:

> I try with a module of mine using ldap and had issues with ldapS
> connection...
>
> I had to follow this :
>
> https://github.com/python-ldap/python-ldap/issues/55
>
> l = ldap.initialize("ldaps://{s}:{p}".format(s=server, p=636))
> l.set_option(ldap.OPT_PROTOCOL_VERSION, ldap.VERSION3)
> # l.set_option(ldap.OPT_X_TLS_CACERTFILE, 'path/to/ca.pem')  # Wasn't
> required...
> l.set_option(ldap.OPT_X_TLS_REQUIRE_CERT, ldap. OPT_X_TLS_NEVER)
> l.set_option(ldap.OPT_X_TLS_NEWCTX, 0)
>
> Then it connected properly under python3 only...
>
> Will make some test in python2 if the back port of the above cause any
> issue...
>
> Richard
>
>
> On Tue, Mar 13, 2018 at 11:58 AM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>> Please try this :
>>
>> sudo apt-get install libsasl2-dev python-dev libldap2-dev libssl-dev
>> # setuptools should be there... I was miss leading...
>> sudo pip3 install python-ldap
>>
>> Please provide progress as if auth_ldap.py works properly with python3
>> once you install python-ldap properly under python3.
>>
>> Thanks
>>
>> Richard
>>
>>
>> On Tue, Mar 13, 2018 at 11:39 AM, Richard Vézina <
>> ml.richard.vez...@gmail.com> wrote:
>>
>>> I open this issue :
>>>
>>> https://github.com/python-ldap/python-ldap/issues/181
>>>
>>> On Tue, Mar 13, 2018 at 11:03 AM, Richard Vézina <
>>> ml.richard.vez...@gmail.com> wrote:
>>>
 python3-ldap -> ldap3 (https://pypi.python.org/pypi/
 python3-ldap/0.9.8.4/) is not the same thing as python-ldap...

 It seems that python-ldap support python 3 :

 https://github.com/python-ldap/python-ldap

 Saddly enough, I hadn't successfully install python-ldap under python3
 with pip3... It fails over importing setuptools issue... Setuptools is
 installed, so I wonder what going on...

 It seems to be working with python 3.4+ : https://www.python-ldap.org/
 en/latest/installing.html#build-prerequisites

 If you have ubuntu you can try on your side :

 sudo pip3 install -U setuptools
 sudo pip3 install python-ldap


 It would be nice if python-ldap just works under python3 as we wouldn't
 have to touch ldap_auth.py as python-ldap should have keep the same API
 under python3...

 Though ldap3 seems to offer interresting progres, but I didn't try it.

 Please keep posting here your progress.

 Thanks

 Richard



 On Tue, Mar 13, 2018 at 8:32 AM, Johann Spies 
 wrote:

> Version 2.16.1
>
> In python (2.7) I can do:
>
> python web2py.py -S welcome
> ..
>
> In [1]: from gluon.contrib.login_methods.ldap_auth import ldap_auth
>
> In [2]:
>
> But not when I use python3 (and I have python3-ldap installed).
>
>
> ```
> /home/js/web2py/gluon/custom_import.py in custom_importer(name,
> globals, locals, fromlist, level)
> 109 import_tb = None
> 110
> --> 111 return NATIVE_IMPORTER(name, globals, locals, fromlist,
> level)
> 112
> 113
>
> /home/js/web2py/gluon/contrib/login_methods/ldap_auth.py in ()
>  12 except Exception as e:
>  13 logging.error('missing ldap, try "easy_install
> python-ldap"')
> ---> 14 raise e
>  15
>  16
>
> /home/js/web2py/gluon/contrib/login_methods/ldap_auth.py in ()
>   7 import logging
>   8 try:
> > 9 import ldap
>  10 import ldap.filter
>  11 ldap.set_option(ldap.OPT_REFERRALS, 0)
>
> /home/js/web2py/gluon/custom_import.py in custom_importer(name,
> globals, locals, fromlist, level)
> 102 return NATIVE_IMPORTER(name, globals, locals,
> fromlist, level)
> 103 except (ImportError, KeyError) as e3:
> --> 104 raise ImportError(e1, import_tb)  # there an
> import error in the module
> 105 except Exception as e2:
> 106 raise  # there is an error in the module
>
> ImportError: (ImportError("Cannot import module
> 'applications.welcome.modules.ldap'",),  0x7fe54161fd88>)
>
> ```
>
> It seems to me like a bug?
>
> Regards
> Johann
>
> --
> Because experiencing your loyal love is better than life itself,
> my lips will praise you.  (Psalm 63:3)
>
> --
> 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

Re: [web2py] Bug in ldap library for python3?

2018-03-13 Thread Richard Vézina
I try with a module of mine using ldap and had issues with ldapS
connection...

I had to follow this :

https://github.com/python-ldap/python-ldap/issues/55

l = ldap.initialize("ldaps://{s}:{p}".format(s=server, p=636))
l.set_option(ldap.OPT_PROTOCOL_VERSION, ldap.VERSION3)
# l.set_option(ldap.OPT_X_TLS_CACERTFILE, 'path/to/ca.pem')  # Wasn't
required...
l.set_option(ldap.OPT_X_TLS_REQUIRE_CERT, ldap. OPT_X_TLS_NEVER)
l.set_option(ldap.OPT_X_TLS_NEWCTX, 0)

Then it connected properly under python3 only...

Will make some test in python2 if the back port of the above cause any
issue...

Richard


On Tue, Mar 13, 2018 at 11:58 AM, Richard Vézina <
ml.richard.vez...@gmail.com> wrote:

> Please try this :
>
> sudo apt-get install libsasl2-dev python-dev libldap2-dev libssl-dev
> # setuptools should be there... I was miss leading...
> sudo pip3 install python-ldap
>
> Please provide progress as if auth_ldap.py works properly with python3
> once you install python-ldap properly under python3.
>
> Thanks
>
> Richard
>
>
> On Tue, Mar 13, 2018 at 11:39 AM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>> I open this issue :
>>
>> https://github.com/python-ldap/python-ldap/issues/181
>>
>> On Tue, Mar 13, 2018 at 11:03 AM, Richard Vézina <
>> ml.richard.vez...@gmail.com> wrote:
>>
>>> python3-ldap -> ldap3 (https://pypi.python.org/pypi/
>>> python3-ldap/0.9.8.4/) is not the same thing as python-ldap...
>>>
>>> It seems that python-ldap support python 3 :
>>>
>>> https://github.com/python-ldap/python-ldap
>>>
>>> Saddly enough, I hadn't successfully install python-ldap under python3
>>> with pip3... It fails over importing setuptools issue... Setuptools is
>>> installed, so I wonder what going on...
>>>
>>> It seems to be working with python 3.4+ : https://www.python-ldap.org/
>>> en/latest/installing.html#build-prerequisites
>>>
>>> If you have ubuntu you can try on your side :
>>>
>>> sudo pip3 install -U setuptools
>>> sudo pip3 install python-ldap
>>>
>>>
>>> It would be nice if python-ldap just works under python3 as we wouldn't
>>> have to touch ldap_auth.py as python-ldap should have keep the same API
>>> under python3...
>>>
>>> Though ldap3 seems to offer interresting progres, but I didn't try it.
>>>
>>> Please keep posting here your progress.
>>>
>>> Thanks
>>>
>>> Richard
>>>
>>>
>>>
>>> On Tue, Mar 13, 2018 at 8:32 AM, Johann Spies 
>>> wrote:
>>>
 Version 2.16.1

 In python (2.7) I can do:

 python web2py.py -S welcome
 ..

 In [1]: from gluon.contrib.login_methods.ldap_auth import ldap_auth

 In [2]:

 But not when I use python3 (and I have python3-ldap installed).


 ```
 /home/js/web2py/gluon/custom_import.py in custom_importer(name,
 globals, locals, fromlist, level)
 109 import_tb = None
 110
 --> 111 return NATIVE_IMPORTER(name, globals, locals, fromlist,
 level)
 112
 113

 /home/js/web2py/gluon/contrib/login_methods/ldap_auth.py in ()
  12 except Exception as e:
  13 logging.error('missing ldap, try "easy_install
 python-ldap"')
 ---> 14 raise e
  15
  16

 /home/js/web2py/gluon/contrib/login_methods/ldap_auth.py in ()
   7 import logging
   8 try:
 > 9 import ldap
  10 import ldap.filter
  11 ldap.set_option(ldap.OPT_REFERRALS, 0)

 /home/js/web2py/gluon/custom_import.py in custom_importer(name,
 globals, locals, fromlist, level)
 102 return NATIVE_IMPORTER(name, globals, locals,
 fromlist, level)
 103 except (ImportError, KeyError) as e3:
 --> 104 raise ImportError(e1, import_tb)  # there an
 import error in the module
 105 except Exception as e2:
 106 raise  # there is an error in the module

 ImportError: (ImportError("Cannot import module
 'applications.welcome.modules.ldap'",), >>> 0x7fe54161fd88>)

 ```

 It seems to me like a bug?

 Regards
 Johann

 --
 Because experiencing your loyal love is better than life itself,
 my lips will praise you.  (Psalm 63:3)

 --
 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.

>>>
>>>
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- 

Re: [web2py] Bug in ldap library for python3?

2018-03-13 Thread Richard Vézina
Please try this :

sudo apt-get install libsasl2-dev python-dev libldap2-dev libssl-dev
# setuptools should be there... I was miss leading...
sudo pip3 install python-ldap

Please provide progress as if auth_ldap.py works properly with python3 once
you install python-ldap properly under python3.

Thanks

Richard


On Tue, Mar 13, 2018 at 11:39 AM, Richard Vézina <
ml.richard.vez...@gmail.com> wrote:

> I open this issue :
>
> https://github.com/python-ldap/python-ldap/issues/181
>
> On Tue, Mar 13, 2018 at 11:03 AM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>> python3-ldap -> ldap3 (https://pypi.python.org/pypi/python3-ldap/0.9.8.4/)
>> is not the same thing as python-ldap...
>>
>> It seems that python-ldap support python 3 :
>>
>> https://github.com/python-ldap/python-ldap
>>
>> Saddly enough, I hadn't successfully install python-ldap under python3
>> with pip3... It fails over importing setuptools issue... Setuptools is
>> installed, so I wonder what going on...
>>
>> It seems to be working with python 3.4+ : https://www.python-ldap.org/
>> en/latest/installing.html#build-prerequisites
>>
>> If you have ubuntu you can try on your side :
>>
>> sudo pip3 install -U setuptools
>> sudo pip3 install python-ldap
>>
>>
>> It would be nice if python-ldap just works under python3 as we wouldn't
>> have to touch ldap_auth.py as python-ldap should have keep the same API
>> under python3...
>>
>> Though ldap3 seems to offer interresting progres, but I didn't try it.
>>
>> Please keep posting here your progress.
>>
>> Thanks
>>
>> Richard
>>
>>
>>
>> On Tue, Mar 13, 2018 at 8:32 AM, Johann Spies 
>> wrote:
>>
>>> Version 2.16.1
>>>
>>> In python (2.7) I can do:
>>>
>>> python web2py.py -S welcome
>>> ..
>>>
>>> In [1]: from gluon.contrib.login_methods.ldap_auth import ldap_auth
>>>
>>> In [2]:
>>>
>>> But not when I use python3 (and I have python3-ldap installed).
>>>
>>>
>>> ```
>>> /home/js/web2py/gluon/custom_import.py in custom_importer(name,
>>> globals, locals, fromlist, level)
>>> 109 import_tb = None
>>> 110
>>> --> 111 return NATIVE_IMPORTER(name, globals, locals, fromlist,
>>> level)
>>> 112
>>> 113
>>>
>>> /home/js/web2py/gluon/contrib/login_methods/ldap_auth.py in ()
>>>  12 except Exception as e:
>>>  13 logging.error('missing ldap, try "easy_install python-ldap"')
>>> ---> 14 raise e
>>>  15
>>>  16
>>>
>>> /home/js/web2py/gluon/contrib/login_methods/ldap_auth.py in ()
>>>   7 import logging
>>>   8 try:
>>> > 9 import ldap
>>>  10 import ldap.filter
>>>  11 ldap.set_option(ldap.OPT_REFERRALS, 0)
>>>
>>> /home/js/web2py/gluon/custom_import.py in custom_importer(name,
>>> globals, locals, fromlist, level)
>>> 102 return NATIVE_IMPORTER(name, globals, locals,
>>> fromlist, level)
>>> 103 except (ImportError, KeyError) as e3:
>>> --> 104 raise ImportError(e1, import_tb)  # there an
>>> import error in the module
>>> 105 except Exception as e2:
>>> 106 raise  # there is an error in the module
>>>
>>> ImportError: (ImportError("Cannot import module
>>> 'applications.welcome.modules.ldap'",), >> 0x7fe54161fd88>)
>>>
>>> ```
>>>
>>> It seems to me like a bug?
>>>
>>> Regards
>>> Johann
>>>
>>> --
>>> Because experiencing your loyal love is better than life itself,
>>> my lips will praise you.  (Psalm 63:3)
>>>
>>> --
>>> 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.
>>>
>>
>>
>

-- 
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.


Re: [web2py] Bug in ldap library for python3?

2018-03-13 Thread Richard Vézina
I open this issue :

https://github.com/python-ldap/python-ldap/issues/181

On Tue, Mar 13, 2018 at 11:03 AM, Richard Vézina <
ml.richard.vez...@gmail.com> wrote:

> python3-ldap -> ldap3 (https://pypi.python.org/pypi/python3-ldap/0.9.8.4/)
> is not the same thing as python-ldap...
>
> It seems that python-ldap support python 3 :
>
> https://github.com/python-ldap/python-ldap
>
> Saddly enough, I hadn't successfully install python-ldap under python3
> with pip3... It fails over importing setuptools issue... Setuptools is
> installed, so I wonder what going on...
>
> It seems to be working with python 3.4+ : https://www.python-ldap.org/
> en/latest/installing.html#build-prerequisites
>
> If you have ubuntu you can try on your side :
>
> sudo pip3 install -U setuptools
> sudo pip3 install python-ldap
>
>
> It would be nice if python-ldap just works under python3 as we wouldn't
> have to touch ldap_auth.py as python-ldap should have keep the same API
> under python3...
>
> Though ldap3 seems to offer interresting progres, but I didn't try it.
>
> Please keep posting here your progress.
>
> Thanks
>
> Richard
>
>
>
> On Tue, Mar 13, 2018 at 8:32 AM, Johann Spies 
> wrote:
>
>> Version 2.16.1
>>
>> In python (2.7) I can do:
>>
>> python web2py.py -S welcome
>> ..
>>
>> In [1]: from gluon.contrib.login_methods.ldap_auth import ldap_auth
>>
>> In [2]:
>>
>> But not when I use python3 (and I have python3-ldap installed).
>>
>>
>> ```
>> /home/js/web2py/gluon/custom_import.py in custom_importer(name,
>> globals, locals, fromlist, level)
>> 109 import_tb = None
>> 110
>> --> 111 return NATIVE_IMPORTER(name, globals, locals, fromlist, level)
>> 112
>> 113
>>
>> /home/js/web2py/gluon/contrib/login_methods/ldap_auth.py in ()
>>  12 except Exception as e:
>>  13 logging.error('missing ldap, try "easy_install python-ldap"')
>> ---> 14 raise e
>>  15
>>  16
>>
>> /home/js/web2py/gluon/contrib/login_methods/ldap_auth.py in ()
>>   7 import logging
>>   8 try:
>> > 9 import ldap
>>  10 import ldap.filter
>>  11 ldap.set_option(ldap.OPT_REFERRALS, 0)
>>
>> /home/js/web2py/gluon/custom_import.py in custom_importer(name,
>> globals, locals, fromlist, level)
>> 102 return NATIVE_IMPORTER(name, globals, locals,
>> fromlist, level)
>> 103 except (ImportError, KeyError) as e3:
>> --> 104 raise ImportError(e1, import_tb)  # there an
>> import error in the module
>> 105 except Exception as e2:
>> 106 raise  # there is an error in the module
>>
>> ImportError: (ImportError("Cannot import module
>> 'applications.welcome.modules.ldap'",), > 0x7fe54161fd88>)
>>
>> ```
>>
>> It seems to me like a bug?
>>
>> Regards
>> Johann
>>
>> --
>> Because experiencing your loyal love is better than life itself,
>> my lips will praise you.  (Psalm 63:3)
>>
>> --
>> 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.
>>
>
>

-- 
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.


Re: [web2py] Bug in ldap library for python3?

2018-03-13 Thread Richard Vézina
python3-ldap -> ldap3 (https://pypi.python.org/pypi/python3-ldap/0.9.8.4/)
is not the same thing as python-ldap...

It seems that python-ldap support python 3 :

https://github.com/python-ldap/python-ldap

Saddly enough, I hadn't successfully install python-ldap under python3 with
pip3... It fails over importing setuptools issue... Setuptools is
installed, so I wonder what going on...

It seems to be working with python 3.4+ :
https://www.python-ldap.org/en/latest/installing.html#build-prerequisites

If you have ubuntu you can try on your side :

sudo pip3 install -U setuptools
sudo pip3 install python-ldap


It would be nice if python-ldap just works under python3 as we wouldn't
have to touch ldap_auth.py as python-ldap should have keep the same API
under python3...

Though ldap3 seems to offer interresting progres, but I didn't try it.

Please keep posting here your progress.

Thanks

Richard



On Tue, Mar 13, 2018 at 8:32 AM, Johann Spies 
wrote:

> Version 2.16.1
>
> In python (2.7) I can do:
>
> python web2py.py -S welcome
> ..
>
> In [1]: from gluon.contrib.login_methods.ldap_auth import ldap_auth
>
> In [2]:
>
> But not when I use python3 (and I have python3-ldap installed).
>
>
> ```
> /home/js/web2py/gluon/custom_import.py in custom_importer(name,
> globals, locals, fromlist, level)
> 109 import_tb = None
> 110
> --> 111 return NATIVE_IMPORTER(name, globals, locals, fromlist, level)
> 112
> 113
>
> /home/js/web2py/gluon/contrib/login_methods/ldap_auth.py in ()
>  12 except Exception as e:
>  13 logging.error('missing ldap, try "easy_install python-ldap"')
> ---> 14 raise e
>  15
>  16
>
> /home/js/web2py/gluon/contrib/login_methods/ldap_auth.py in ()
>   7 import logging
>   8 try:
> > 9 import ldap
>  10 import ldap.filter
>  11 ldap.set_option(ldap.OPT_REFERRALS, 0)
>
> /home/js/web2py/gluon/custom_import.py in custom_importer(name,
> globals, locals, fromlist, level)
> 102 return NATIVE_IMPORTER(name, globals, locals,
> fromlist, level)
> 103 except (ImportError, KeyError) as e3:
> --> 104 raise ImportError(e1, import_tb)  # there an
> import error in the module
> 105 except Exception as e2:
> 106 raise  # there is an error in the module
>
> ImportError: (ImportError("Cannot import module
> 'applications.welcome.modules.ldap'",),  0x7fe54161fd88>)
>
> ```
>
> It seems to me like a bug?
>
> Regards
> Johann
>
> --
> Because experiencing your loyal love is better than life itself,
> my lips will praise you.  (Psalm 63:3)
>
> --
> 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.
>

-- 
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] Bug in ldap library for python3?

2018-03-13 Thread Johann Spies
Version 2.16.1

In python (2.7) I can do:

python web2py.py -S welcome
..

In [1]: from gluon.contrib.login_methods.ldap_auth import ldap_auth

In [2]:

But not when I use python3 (and I have python3-ldap installed).


```
/home/js/web2py/gluon/custom_import.py in custom_importer(name,
globals, locals, fromlist, level)
109 import_tb = None
110
--> 111 return NATIVE_IMPORTER(name, globals, locals, fromlist, level)
112
113

/home/js/web2py/gluon/contrib/login_methods/ldap_auth.py in ()
 12 except Exception as e:
 13 logging.error('missing ldap, try "easy_install python-ldap"')
---> 14 raise e
 15
 16

/home/js/web2py/gluon/contrib/login_methods/ldap_auth.py in ()
  7 import logging
  8 try:
> 9 import ldap
 10 import ldap.filter
 11 ldap.set_option(ldap.OPT_REFERRALS, 0)

/home/js/web2py/gluon/custom_import.py in custom_importer(name,
globals, locals, fromlist, level)
102 return NATIVE_IMPORTER(name, globals, locals,
fromlist, level)
103 except (ImportError, KeyError) as e3:
--> 104 raise ImportError(e1, import_tb)  # there an
import error in the module
105 except Exception as e2:
106 raise  # there is an error in the module

ImportError: (ImportError("Cannot import module
'applications.welcome.modules.ldap'",), )

```

It seems to me like a bug?

Regards
Johann

-- 
Because experiencing your loyal love is better than life itself,
my lips will praise you.  (Psalm 63:3)

-- 
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] Bug with auth.settings.table_user_name and auth.signature?

2018-02-07 Thread Marvi Benedet
hello,
I tried the code on bottom, where I changed the default auth_user table
name and I used the "auth.signature' feature, but I get an error:

‘*Cannot resolve reference auth_user in tests definition*’

this happen only when a table contain "auth.signature".

Debuggin a bit I found that when running the code (in authapi.py):

reference_user = 'reference %s' % settings.table_user_name

the value of variable settings.table_user_name is still “*auth_user*”, not “
*users*”.

I tried also to hardcode the value “*users*” in this way

reference_user = 'reference %s' % 'users'

and all is gone fine, but obv. is not the right solution...


the example code:

auth = Auth(db, host_names=configuration.get('host.names'))
auth.settings.table_user_name = 'users'
#auth.settings.extra_fields['users'] = []
auth.define_tables(username=False, signature=False)

db.define_table('tests',
Field('name',   length=100,
requires=IS_NOT_EMPTY()),
auth.signature,
format='%(name)s',
)

​

-- 
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] Bug with URL encoding?

2017-10-19 Thread Francisco Ribeiro
Hi,

I have found that when I do request.args(), colons ':' even when properly 
URL encoded become an underscore '_' .

def echo():
print request.args(0)
return dict()

A request http://.../echo/%a_ will become :
__ 

which prevents me from distinguishing one from another.

Am I missing something? shouldn't request.args() take care of URL encoding 
/ decoding for me?

Thank you
Kind regards,
Francisco Ribeiro

-- 
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] Bug?: Spanish formatted dates won't store on database(english ones do)

2016-08-16 Thread Luciano Laporta Podazza
Hello,

I'm working on a simple case file project and realized that working with 
english date format has no issues but if I use spanish ones(taking 
advantage of internacionalization) they don't get stored on database.

Here is my controller:
@auth.requires_login()
def index():
"""
example action using the internationalization operator T and flash
rendered by views/default/index.html or views/generic.html


if you need a simple wiki simply replace the two lines below with:
return auth.wiki()
"""
form = SQLFORM.smartgrid(db.case_file)
return dict(form=form)

Here is my model:

db.define_table('case_file',
Field('auth_user_id', db.auth_user),
Field('case_file_number', 'integer', label=T("Case Number"), requires=
IS_NOT_EMPTY()),
Field('case_file_code', 'integer', label=T("Case Code"), requires=
IS_NOT_EMPTY()),
Field('case_file_letter', 'string', label=T("Case Letter"), requires=
IS_NOT_EMPTY()),
Field('case_file_year', 'date', label=T("Case Year"), requires=
IS_NOT_EMPTY()),
Field('case_file_subject', 'string', label=T("Case Subject"), requires=
IS_NOT_EMPTY()),
)


db.define_table('case_file_history',
Field('case_file_id', db.case_file),
Field('created_by', 'string', label=T("Created By"), requires=
IS_NOT_EMPTY()),
Field('case_file_ingress', 'date', label=T("Case Ingress"), requires=
IS_NOT_EMPTY()),
Field('case_file_egress', 'date', label=T("Case Egress"), requires=
IS_NOT_EMPTY()),
Field('case_file_to', 'string', label=T("Case To"), requires=
IS_NOT_EMPTY()),
Field('case_file_status', 'string', label=T("Case Status"), requires=
IS_NOT_EMPTY()),
)


To recreate this issue, create a new project, use my code and set your 
browser to spanish. It won't store any field of date type on database, but 
if browser is set up in english language, it will.

I'm using web2py 2.14.6-stable+timestamp.2016.05.10.00.21.47 on Mac OS X El 
Capitan and sqlite or mysql(issue repeats on both databases).

Any help will be appreciated. Thanks!

-- 
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] Bug Web2py and MongoDb datetime and default="request.now".

2016-06-07 Thread arihant daga
I think there is this bug in web2py. 

I had this in my code for users table.

Field('created_on', 'datetime', 
default=request.utcnow,update=request.utcnow) 

but on submitting signup form it always threw an error saying 
combine() argument 1 must be datetime.date, not str
i checked arguments and found this- 
*web2py\gluon\packages\dal\pydal\adapters\mongo.py in insert at line 938* 
{'created_on': None, 'email': u'arih...@jj.com', 'first_name': u'', 
'gender': u'', 'mobile': u'', 'password': 
u'pbkdf2(1000,20,sha512)$b743ac142d5867d0$ef23b7b5dd784d951572bdb6d8b944b8b1b9f40d',
 
'registration_id': u'', 'reset_password_key': u'', 'user_type': False}

web2py is sending None for created_on. field. So i removed Field type from 
created_on and replace my code with this
Field('created_on',default=request.utcnow,update=request.utcnow). 
And it worked fine. I think there is some issue with datetime validator 
itself. 


Thanks. 

-- 
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] bug web2py ticket json

2016-05-30 Thread Alessio Varalta
Hi, I notice a big problem with the ticket report when you use json.

I have a controller where i take from the body the json with simple json 
and after parsing the body.

The problem is that if there is an error the ticket reporting an error of 
decoding json in any cases...For example in my case the error was the wrong 
name of table or in another case a null pointer exception but web2py 
reporting alway the error on json 

-- 
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] Bug? autocomplete widget kills the bootstrapiness of the associated smartgrid form control

2016-04-02 Thread Valdeck Rowe
I've noticed that adding autocomplete widget to a field definition (only 
appears to work programmatically) removes the form-control class attribute 
from the smartgrid input fields.

Adding this: 
db.person.status.widget = SQLFORM.widgets.autocomplete(request, 
db.person.status, limitby = (0,15), min_length=1)

changes this:
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] bug? menu v2.14.3

2016-03-29 Thread lucas
hello one and all,

so i upgraded from v2.12.3 to v2.14.3.  i had trouble with the menu going 
deeper then the level past the first drop down.

so i started a new app and only added the bold below under menu.py:

response.menu += [
(T('My Sites'), False, URL('admin', 'default', 'site')),
  (T('This App'), False, '#', [
  *(T('test1'), False, '', [('test12', False, URL(f='test12')), 
('test13', False, URL(f='test13'))]),*
  (T('Design'), False, URL('admin', 'default', 'design/%s' % 
app)),
  LI(_class="divider"),
...

when i run this app, it does show that test1 is further branched with the 
little arrow and test12 and test13 don't show in its submenu.

now in my main app, the branching is fine.  so i don't think it is a 
problem on the server/web2py part, but probably in the static/css or 
static/js files probably.  i'm not exactly sure how those menu work, but i 
love when they do.

so, just informing, let me know.  thanx in advance, lucas

-- 
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.


Re: [web2py] bug in IS_NOT_EMPTY() ?

2016-03-10 Thread Richard Vézina
It turns out that the issue wasn't even related to IS_NOT_EMPTY()... Since
the field wasn't include it couldn't block the form to submit... Though I
may have the issue in other form where it is included..

What was the root cause of my issue was in fact (as far as I can
understand) that the id field of the record wasn't include in custom form
which prevent form.process() to process correctly the form...

Could it be cause of _enable_record_versioning() that I active over
auth_user table somewhat recently... Issue run out without me noticing it...

I am glad that I finally resolve this one...

Richard

On Wed, Mar 9, 2016 at 1:58 PM, Richard Vézina 
wrote:

> Damn it, there is surely something else wrong also... Even with the
> removal I seems to have difficulty with other fields not included in the
> custom form which are removed with readable and writable False...
>
> I start to be clue less about the root cause of this issue... This form
> has worked properly for year now and it seems now completly broken...
>
> Richard
>
> On Wed, Mar 9, 2016 at 12:19 PM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>> Hello Anthony,
>>
>> Last suggestion seems the way to go... I do understand and I realise by
>> trying to hack IS_NOT_EMPTY() that it makes no sens to refactoring it in
>> anyway to make it support bool null since it never going to allow null
>> value to be input in the DB. Though it certainly shouldn't prevent a form
>> to submit properly when used with a bool type field. I may have use it by
>> mistake with bool field... But I think, base on this post which is not mine
>> in the first place, that I am not alone thinking that it usage in
>> conjonction of a bool type field will prevent the form to allow null bool
>> type field input (which is wrong thought since html checkbox can't return
>> null value)...
>>
>> So, you idea if apply, is a really good way to fix the situation...
>>
>>
>> *How I come here:*
>> I have hunted so much the reason for a bug that I had with a custom form
>> which only appears recently which I am still not sure why... Stange enough
>> even if the form wasn't submit and the system was throwing ticket, computed
>> _thumbnail_ files from compute upload fields related to an main upload
>> field of user profile picture were deleted. The form was returning error,
>> but the field wasn't include in the form so error can't be seen on form
>> submission. I guess what was really happen was that the insert process was
>> falling kind of too late and the _before_update callback was already
>> triggered... False positive ticket related to the actual issue :
>> https://github.com/web2py/pydal/issues/330
>>
>> So thumbnails get delete and then the insert fails...
>>
>> For now I think that as a workaround I can just remove the IS_NOT_EMPTY()
>> from field definition that was causing the issue.
>>
>> Thanks for your help Anthony
>>
>> Richard
>>
>> On Tue, Mar 8, 2016 at 4:41 PM, Anthony  wrote:
>>
>>> On Tuesday, March 8, 2016 at 3:01:48 PM UTC-5, Richard wrote:

 For instance how someone can acheive the same than NullBooleanField of
 Django :


 https://docs.djangoproject.com/en/1.9/ref/models/fields/#django.db.models.NullBooleanField
 

>>>
>>> In web2py, a regular boolean field allows NULLs, so I don't think we
>>> need a special field type. In Django, the NullBooleanField is intended to
>>> be used with the NullBooleanSelect widget, which actually includes three
>>> options (with "uknown" being equivalent to a NULL). I suppose in web2py,
>>> you could achieve this with a standard select widget (with a None option),
>>> and then use an IS_IN_SET or IS_NOT_EMPTY validator.
>>>
>>>
 One part of the problem with IS_NOT_EMPTY() is that it seems to be
 intent to work only with string field type, from the book :

>>>
>>> It does work with other types of values, but there isn't much point to
>>> it when working with boolean form fields, as they cannot be empty by
>>> definition (though I suppose the distinction could be made when using the
>>> .validate_and_insert method).
>>>
>>>
 Or we can just fix IS_NOT_EMPTY() so it works with boolean type field
 so that it returns false when the checkbox is leave blank as it should...

>>>
>>> There's nothing to fix with IS_NOT_EMPTY() -- it doesn't know what type
>>> of field produces the value it is passed, so it cannot behave differently
>>> depending on the type of field. We could instead change the behavior of
>>> SQLFORM so it automatically converts empty checkboxes to False values,
>>> which would then pass validation with IS_NOT_EMPTY.
>>>
>>> Anthony
>>>
>>> --
>>> Resources:
>>> - http://web2py.com
>>> - http://web2py.com/book (Documentation)
>>> - 

Re: [web2py] bug in IS_NOT_EMPTY() ?

2016-03-09 Thread Richard Vézina
Damn it, there is surely something else wrong also... Even with the removal
I seems to have difficulty with other fields not included in the custom
form which are removed with readable and writable False...

I start to be clue less about the root cause of this issue... This form has
worked properly for year now and it seems now completly broken...

Richard

On Wed, Mar 9, 2016 at 12:19 PM, Richard Vézina  wrote:

> Hello Anthony,
>
> Last suggestion seems the way to go... I do understand and I realise by
> trying to hack IS_NOT_EMPTY() that it makes no sens to refactoring it in
> anyway to make it support bool null since it never going to allow null
> value to be input in the DB. Though it certainly shouldn't prevent a form
> to submit properly when used with a bool type field. I may have use it by
> mistake with bool field... But I think, base on this post which is not mine
> in the first place, that I am not alone thinking that it usage in
> conjonction of a bool type field will prevent the form to allow null bool
> type field input (which is wrong thought since html checkbox can't return
> null value)...
>
> So, you idea if apply, is a really good way to fix the situation...
>
>
> *How I come here:*
> I have hunted so much the reason for a bug that I had with a custom form
> which only appears recently which I am still not sure why... Stange enough
> even if the form wasn't submit and the system was throwing ticket, computed
> _thumbnail_ files from compute upload fields related to an main upload
> field of user profile picture were deleted. The form was returning error,
> but the field wasn't include in the form so error can't be seen on form
> submission. I guess what was really happen was that the insert process was
> falling kind of too late and the _before_update callback was already
> triggered... False positive ticket related to the actual issue :
> https://github.com/web2py/pydal/issues/330
>
> So thumbnails get delete and then the insert fails...
>
> For now I think that as a workaround I can just remove the IS_NOT_EMPTY()
> from field definition that was causing the issue.
>
> Thanks for your help Anthony
>
> Richard
>
> On Tue, Mar 8, 2016 at 4:41 PM, Anthony  wrote:
>
>> On Tuesday, March 8, 2016 at 3:01:48 PM UTC-5, Richard wrote:
>>>
>>> For instance how someone can acheive the same than NullBooleanField of
>>> Django :
>>>
>>>
>>> https://docs.djangoproject.com/en/1.9/ref/models/fields/#django.db.models.NullBooleanField
>>> 
>>>
>>
>> In web2py, a regular boolean field allows NULLs, so I don't think we need
>> a special field type. In Django, the NullBooleanField is intended to be
>> used with the NullBooleanSelect widget, which actually includes three
>> options (with "uknown" being equivalent to a NULL). I suppose in web2py,
>> you could achieve this with a standard select widget (with a None option),
>> and then use an IS_IN_SET or IS_NOT_EMPTY validator.
>>
>>
>>> One part of the problem with IS_NOT_EMPTY() is that it seems to be
>>> intent to work only with string field type, from the book :
>>>
>>
>> It does work with other types of values, but there isn't much point to it
>> when working with boolean form fields, as they cannot be empty by
>> definition (though I suppose the distinction could be made when using the
>> .validate_and_insert method).
>>
>>
>>> Or we can just fix IS_NOT_EMPTY() so it works with boolean type field so
>>> that it returns false when the checkbox is leave blank as it should...
>>>
>>
>> There's nothing to fix with IS_NOT_EMPTY() -- it doesn't know what type
>> of field produces the value it is passed, so it cannot behave differently
>> depending on the type of field. We could instead change the behavior of
>> SQLFORM so it automatically converts empty checkboxes to False values,
>> which would then pass validation with IS_NOT_EMPTY.
>>
>> Anthony
>>
>> --
>> 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.
>>
>
>

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

Re: [web2py] bug in IS_NOT_EMPTY() ?

2016-03-09 Thread Richard Vézina
Hello Anthony,

Last suggestion seems the way to go... I do understand and I realise by
trying to hack IS_NOT_EMPTY() that it makes no sens to refactoring it in
anyway to make it support bool null since it never going to allow null
value to be input in the DB. Though it certainly shouldn't prevent a form
to submit properly when used with a bool type field. I may have use it by
mistake with bool field... But I think, base on this post which is not mine
in the first place, that I am not alone thinking that it usage in
conjonction of a bool type field will prevent the form to allow null bool
type field input (which is wrong thought since html checkbox can't return
null value)...

So, you idea if apply, is a really good way to fix the situation...


*How I come here:*
I have hunted so much the reason for a bug that I had with a custom form
which only appears recently which I am still not sure why... Stange enough
even if the form wasn't submit and the system was throwing ticket, computed
_thumbnail_ files from compute upload fields related to an main upload
field of user profile picture were deleted. The form was returning error,
but the field wasn't include in the form so error can't be seen on form
submission. I guess what was really happen was that the insert process was
falling kind of too late and the _before_update callback was already
triggered... False positive ticket related to the actual issue :
https://github.com/web2py/pydal/issues/330

So thumbnails get delete and then the insert fails...

For now I think that as a workaround I can just remove the IS_NOT_EMPTY()
from field definition that was causing the issue.

Thanks for your help Anthony

Richard

On Tue, Mar 8, 2016 at 4:41 PM, Anthony  wrote:

> On Tuesday, March 8, 2016 at 3:01:48 PM UTC-5, Richard wrote:
>>
>> For instance how someone can acheive the same than NullBooleanField of
>> Django :
>>
>>
>> https://docs.djangoproject.com/en/1.9/ref/models/fields/#django.db.models.NullBooleanField
>> 
>>
>
> In web2py, a regular boolean field allows NULLs, so I don't think we need
> a special field type. In Django, the NullBooleanField is intended to be
> used with the NullBooleanSelect widget, which actually includes three
> options (with "uknown" being equivalent to a NULL). I suppose in web2py,
> you could achieve this with a standard select widget (with a None option),
> and then use an IS_IN_SET or IS_NOT_EMPTY validator.
>
>
>> One part of the problem with IS_NOT_EMPTY() is that it seems to be intent
>> to work only with string field type, from the book :
>>
>
> It does work with other types of values, but there isn't much point to it
> when working with boolean form fields, as they cannot be empty by
> definition (though I suppose the distinction could be made when using the
> .validate_and_insert method).
>
>
>> Or we can just fix IS_NOT_EMPTY() so it works with boolean type field so
>> that it returns false when the checkbox is leave blank as it should...
>>
>
> There's nothing to fix with IS_NOT_EMPTY() -- it doesn't know what type of
> field produces the value it is passed, so it cannot behave differently
> depending on the type of field. We could instead change the behavior of
> SQLFORM so it automatically converts empty checkboxes to False values,
> which would then pass validation with IS_NOT_EMPTY.
>
> Anthony
>
> --
> 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.
>

-- 
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.


Re: [web2py] bug in IS_NOT_EMPTY() ?

2016-03-08 Thread Anthony
On Tuesday, March 8, 2016 at 3:01:48 PM UTC-5, Richard wrote:
>
> For instance how someone can acheive the same than NullBooleanField of 
> Django :
>
>
> https://docs.djangoproject.com/en/1.9/ref/models/fields/#django.db.models.NullBooleanField
>  
> 
>

In web2py, a regular boolean field allows NULLs, so I don't think we need a 
special field type. In Django, the NullBooleanField is intended to be used 
with the NullBooleanSelect widget, which actually includes three options 
(with "uknown" being equivalent to a NULL). I suppose in web2py, you could 
achieve this with a standard select widget (with a None option), and then 
use an IS_IN_SET or IS_NOT_EMPTY validator.
 

> One part of the problem with IS_NOT_EMPTY() is that it seems to be intent 
> to work only with string field type, from the book : 
>

It does work with other types of values, but there isn't much point to it 
when working with boolean form fields, as they cannot be empty by 
definition (though I suppose the distinction could be made when using the 
.validate_and_insert method).
 

> Or we can just fix IS_NOT_EMPTY() so it works with boolean type field so 
> that it returns false when the checkbox is leave blank as it should...
>

There's nothing to fix with IS_NOT_EMPTY() -- it doesn't know what type of 
field produces the value it is passed, so it cannot behave differently 
depending on the type of field. We could instead change the behavior of 
SQLFORM so it automatically converts empty checkboxes to False values, 
which would then pass validation with IS_NOT_EMPTY.

Anthony

-- 
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.


Re: [web2py] bug in IS_NOT_EMPTY() ?

2016-03-08 Thread Richard Vézina
For instance how someone can acheive the same than NullBooleanField of
Django :

https://docs.djangoproject.com/en/1.9/ref/models/fields/#django.db.models.NullBooleanField

http://stackoverflow.com/questions/10440937/what-is-wrong-with-the-django-forms-booleanfield-unit-test-case

One part of the problem with IS_NOT_EMPTY() is that it seems to be intent
to work only with string field type, from the book :

IS_NOT_EMPTY

This validator checks that the content of the field value is not an empty
string.

requires = IS_NOT_EMPTY(error_message='cannot be empty!')


Gluon code here :

https://github.com/web2py/web2py/blob/b6db31461266fa7539636e77f548cd6f69e8063e/gluon/validators.py#L1008

I am not sure what the best way to solve this and how to distinguish
between empty checkbox and false checkbox... As in html it could only be
checked or not checked... Maybe we can wrapp checkbox into a widget that
check if the checkbox was checked before been unchecked... But it would be
counter intuitive that someone has to check a checkbox before uncheck it to
signify that he want that the database input of a boolean field is really
false and not NULL...

Or we can just fix IS_NOT_EMPTY() so it works with boolean type field so
that it returns false when the checkbox is leave blank as it should...

Or even mention in the book that IS_NOT_EMPTY() doesn't apply and shouldn't
be use with boolean type field, which seems the simplest solution...

Richard





On Tue, Mar 8, 2016 at 2:00 PM, Richard Vézina 
wrote:

> To me, Francisco is rigth...
>
> In boolean case, I assume that IS_NOT_EMPTY() would make sure that field
> don't get a NULL value, so the database get hit with True or False value
> when you set IS_NOT_EMPTY() and default=False...
>
> Richard
>
> On Thu, Dec 4, 2014 at 6:27 AM, Kiran Subbaraman <
> subbaraman.ki...@gmail.com> wrote:
>
>> I see this as IS_NOT_EMPTY() working correctly.
>> And why would you attach this validator to a checkbox/boolean field? Did
>> you also assign a default value of False?
>> Or you would need to check request.args for this field, and assign a
>> false if it is empty, before passing it along to the validator (again, not
>> sure what purpose the validator serves for this field).
>>
>> 
>> Kiran Subbaramanhttp://subbaraman.wordpress.com/about/
>>
>> On Thu, 04-12-2014 4:46 PM, Francisco Ribeiro wrote:
>>
>> hi there,
>> I noticed that when I use the IS_NOT_EMPTY() validator on a boolean field
>> (i.e. a form checkbox) that it will not allow me to submit the form with
>> this field as "not checked" / "unticked".  In my opinion, this is a wrong
>> interpretation of what is an empty value, since a checkbox can only
>> represent True or False and therefore it's never empty. The consequence of
>> using this behaviour for the IS_NOT_EMPTY*() validator is that we are
>> forcing users to choose True on a widget that is meant to provide a boolean
>> choice between True OR False, so the whole purpose of this user interface
>> widget, is lost. I only tested this with SQLFORM.factory() though.
>>
>> Am I missing something?
>>
>> Francisco
>> --
>> 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.
>>
>>
>> --
>> 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.
>>
>
>

-- 
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.


Re: [web2py] bug in IS_NOT_EMPTY() ?

2016-03-08 Thread Richard Vézina
To me, Francisco is rigth...

In boolean case, I assume that IS_NOT_EMPTY() would make sure that field
don't get a NULL value, so the database get hit with True or False value
when you set IS_NOT_EMPTY() and default=False...

Richard

On Thu, Dec 4, 2014 at 6:27 AM, Kiran Subbaraman  wrote:

> I see this as IS_NOT_EMPTY() working correctly.
> And why would you attach this validator to a checkbox/boolean field? Did
> you also assign a default value of False?
> Or you would need to check request.args for this field, and assign a false
> if it is empty, before passing it along to the validator (again, not sure
> what purpose the validator serves for this field).
>
> 
> Kiran Subbaramanhttp://subbaraman.wordpress.com/about/
>
> On Thu, 04-12-2014 4:46 PM, Francisco Ribeiro wrote:
>
> hi there,
> I noticed that when I use the IS_NOT_EMPTY() validator on a boolean field
> (i.e. a form checkbox) that it will not allow me to submit the form with
> this field as "not checked" / "unticked".  In my opinion, this is a wrong
> interpretation of what is an empty value, since a checkbox can only
> represent True or False and therefore it's never empty. The consequence of
> using this behaviour for the IS_NOT_EMPTY*() validator is that we are
> forcing users to choose True on a widget that is meant to provide a boolean
> choice between True OR False, so the whole purpose of this user interface
> widget, is lost. I only tested this with SQLFORM.factory() though.
>
> Am I missing something?
>
> Francisco
> --
> 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.
>
>
> --
> 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.
>

-- 
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] Bug migrating polyline

2016-03-07 Thread Leonel Câmara
I don't know why it's doing a migration since I didn't change this table at 
all but it is and I'm getting this error.


 column "polyline__tmp" is of type json 
but expression is of type text LINE 1: UPDATE tour SET 
polyline__tmp=polyline; ^ HINT: You will need to rewrite or cast the 
expression.


-- 
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] Bug: _before_* callbacks ignores file deletion

2015-12-29 Thread MAbeeTT
Hello everyone,
I found am issue with the _before_*  callbacks

https://github.com/web2py/web2py/issues/1147

I tested the problem with 2.13.4-stable+timestamp.2015.12.26.04.59.39


I need disabling file deletions, while I do a backup. The uploads/
directory has a millions of files, so after the dump of the database,
and before finishing the tarball of uploads there could be hours of
spending time.

Maybe the issue is not a bug, just a feature. So I write here.

Thanks in advance,

-- 
 .::MAbeeTT::.

 mabeett [at] gmail [ dot] com

-- 
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] Bug on checkboxes

2015-12-13 Thread Alfonso Serra
Hey i was creating a custom widget for a checkbox and i wanted to keep the 
value when the form doesnt validate.

This is the declaration for the input:

chk = request.post_vars[field.name] != None

if chk:
_input = INPUT(_type="checkbox", _name=field.name, _class="checkbox", 
_checked="on")
else:
_input = INPUT(_type="checkbox", _name=field.name, _class="checkbox")
return _input

The resulting html after a postback is:


The property "checked" is mapped to the "value" property, and the checkbox 
is not checked in return.
This test was on Firefox v.42

Ive tried to workaround this behaviour but im not able to fix this.

-- 
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] Bug / Dumb Question a = b= []

2015-12-08 Thread Mark Billion
in python 2.6, I can run a = b = [] and get the expected result.  In W2P, 
when I do it, it throws an exception as the list does not propagate to both 
a & b.  It would make my code cleaner, but otherwise not a problem.  Just 
wanted to give a shout in case anyone gave a 

Thanks again for all of your help!  

-- 
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.


Re: [web2py] Bug / Dumb Question a = b= []

2015-12-08 Thread Richard Vézina
idiomatic is not : a, b = [], []

?

Richard

On Tue, Dec 8, 2015 at 10:01 AM, Mark Billion  wrote:

> in python 2.6, I can run a = b = [] and get the expected result.  In W2P,
> when I do it, it throws an exception as the list does not propagate to both
> a & b.  It would make my code cleaner, but otherwise not a problem.  Just
> wanted to give a shout in case anyone gave a 
>
> Thanks again for all of your help!
>
> --
> 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.
>

-- 
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] Bug on DAL OracleAdapter

2015-08-05 Thread Boris Aramis Aguilar Rodríguez
Steps to reproduce:

db.define_table('atable', Field('longtext', 'text'))#this makes longtext to 
be a clob in oracle database
for i in range(1, 100):
  db.atable.insert(longtext=str(i))

rows = db(db.atable.id0).select()
for r in rows:
  print r.longtext #this fails with the following exception

Traceback (most recent call last):
  File console, line 1, in module
ProgrammingError: LOB variable no longer valid after subsequent fetch

As I was trying to fix the error I found that LOB variables if not called 
.read() they can't be accessed afterwards, so this only happened when you 
selected something that returned more than 1 row. I finally found the issue 
in 

*OracleAdapter method _fetchall*
def _fetchall(self):
if any(x[1]==cx_Oracle.LOB for x in self.cursor.description):
return [tuple([(c.read() if type(c) == cx_Oracle.LOB else c) \
   for c in r]) for r in self.cursor]
else:
return self.cursor.fetchall()

So this method calls the read() method when it detects that the data is 
cx_Oracle.LOB data type... but as long as the latest version of cx_Oracle 
CLOB is not the same as LOB so this code fails for CLOB data (text fields 
in web2py dal and Oracle backend).

So, finally the bugfix is to detect for CLOB and LOB data types and call 
the read() method

The BugFix
def _fetchall(self):
if any(x[1]==cx_Oracle.LOB or x[1]==cx_Oracle.CLOB for x in self.
cursor.description):
return [tuple([(c.read() if type(c) == cx_Oracle.LOB else c) \
   for c in r]) for r in self.cursor]
else:
return self.cursor.fetchall()



-- 
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] Bug in XML(...,sanitize=True) ?

2015-06-26 Thread Brian M
I'm working on upgrading to the latest web2py version and may have 
uncovered a bug in the sanitizer. If you use XML(form.var.something, 
sanitize=True) and form.var.something is just a plain string without any 
tags then what you end up getting returned is an empty string rather than 
the original string.  I don't think this is the intended behavior and 
certainly wasn't the behavior in earlier versions.  Have I been using XML() 
wrong all this time or is this a bug?

-- 
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] Bug in code for email Queue example.

2015-06-17 Thread Jason (spot) Brower
I was copy pasting the code and noticed that message which you use in the
email queue example is not valid as it is a reserved word in the Fields.
Just thought I would mention it.
BR,
Jason Brower

-- 
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] Bug with Blocks

2015-06-09 Thread Jason (spot) Brower
I think I found a bug with blocks.
In my base_layout.html
li{{block page_title}}{{end}}/li
And this in my view file...
{{block page_title}}
Dashboard
{{end}}
This will print the replacement block in the correct location.  BUT it will
also print it where ever I put it in the html.
Am I understanding the purpose of blocks wrong or is this a bug?
So if I put the block with the Dashboard in it at the bottom of the page
I will get it in the li tags there but also in the bottom of the page.
BR,
Jason Brower

-- 
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.


Re: [web2py] Bug with Blocks

2015-06-09 Thread Richard Vézina
Hello Jason,

There is this issue open : https://github.com/web2py/web2py/issues/772

Though, I am not sure I understand you issue...

Richard



On Tue, Jun 9, 2015 at 3:07 AM, Jason (spot) Brower encomp...@gmail.com
wrote:

 I think I found a bug with blocks.
 In my base_layout.html
 li{{block page_title}}{{end}}/li
 And this in my view file...
 {{block page_title}}
 Dashboard
 {{end}}
 This will print the replacement block in the correct location.  BUT it
 will also print it where ever I put it in the html.
 Am I understanding the purpose of blocks wrong or is this a bug?
 So if I put the block with the Dashboard in it at the bottom of the page
 I will get it in the li tags there but also in the bottom of the page.
 BR,
 Jason Brower

  --
 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.


-- 
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.


Re: [web2py] Bug with Blocks

2015-06-09 Thread Jason (spot) Brower
confused with the post, it will have to be at a different day. :)
I solved my issue by putting the block with the new content before the
extend on the page.
Weird as it is, when you do that it won't print the content in the place it
was but only in the block locations defined.
I suppose that was the intended result, am I right?
BR,
Jason Brower


On Tue, Jun 9, 2015 at 9:56 PM Richard Vézina ml.richard.vez...@gmail.com
wrote:

 Hello Jason,

 There is this issue open : https://github.com/web2py/web2py/issues/772

 Though, I am not sure I understand you issue...

 Richard



 On Tue, Jun 9, 2015 at 3:07 AM, Jason (spot) Brower encomp...@gmail.com
 wrote:

 I think I found a bug with blocks.
 In my base_layout.html
 li{{block page_title}}{{end}}/li
 And this in my view file...
 {{block page_title}}
 Dashboard
 {{end}}
 This will print the replacement block in the correct location.  BUT it
 will also print it where ever I put it in the html.
 Am I understanding the purpose of blocks wrong or is this a bug?
 So if I put the block with the Dashboard in it at the bottom of the
 page I will get it in the li tags there but also in the bottom of the page.
 BR,
 Jason Brower

  --
 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.


  --
 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.


-- 
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] Bug in scheduler.py ?

2015-05-27 Thread Meessen Christophe

Hello,

I recently encounter a problem when trying to serialize the model 
including the scheduler tables.


The default value of the uuid field in the scheduler_task table is set 
to the function web2py_uuid.

Shouldn't it be the value returned by web2py_uuid and thus web2py_uuid() ?

--
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] Bug in SQLFORM.factory bootstrap3 formstyles ?

2015-04-12 Thread Gary Cowell
Hi

Running with:


2.10.3-stable+timestamp.2015.04.02.21.42.07

(Running on Rocket 1.2.6, Python 2.7.5) 


I find that this code:

xadb = DAL('sqlite:memory:')
xadb.define_table('regiontable', Field('region', length=20,label=
'Region'))

form = SQLFORM.factory(SQLField('Region', label='Select a region', 
length=20,
   requires=IS_IN_DB(xadb,'regiontable.region',orderby=xadb.regiontable.
region)),
   formstyle='bootstrap3_inline'
)

Produces a drop-down that is the entire width of the page when viewed in 
Firefox.  Same for bootstrap3_stacked

The 'classic' formstyles, of table2cols, table3cols etc. don't look as 
nice, don't have the bootstrap button, but they produce fields of the 
correct width.

Is this a bug in the bootstrap3 , or did I need to do more to my 
SQLFORM.factory to get the correct width?

Thanks

-- 
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] Bug: SQLFORM.accepts() breaks formstyle when widgets are defined

2015-02-19 Thread tim . nyborg
I'm using a custom formstyle to apply bootstrap3 to my forms (a modified 
copy of the built-in bootstrap3_inline).  Importantly, it adds the 
form-control class to each input.

This works fine, until you define a widget for a field, and have it fail 
validation.

db.define_table('test',
Field('one', 'string', requires=IS_MATCH('STUFF')),
Field('two', 'string', requires=IS_MATCH('STUFF'), 
widget=SQLFORM.widgets.string.widget),
)

def index():
# Set variables for the default view

form = SQLFORM(db.test, formstyle='bootstrap3_inline')  
form.process()

return dict(form=form)

Despite being identical fields, with identical widgets, field two loses its 
formatting.  Why?  Because of the following code at the bottom of 
SQLFORM.accepts()

elif (not ret) and (not auch):
# auch is true when user tries to delete a record
# that does not pass validation, yet it should be deleted
for fieldname in self.fields:

field = (self.table[fieldname]
 if fieldname in self.table.fields
 else self.extra_fields[fieldname])
### this is a workaround! widgets should always have default not 
None!
if not field.widget and field.type.startswith('list:') and \
not OptionsWidget.has_options(field):
field.widget = self.widgets.list.widget
if field.widget and fieldname in request_vars:
if fieldname in self.request_vars:
value = self.request_vars[fieldname]
elif self.record:
value = self.record[fieldname]
else:
value = field.default
row_id = '%s_%s%s' % (
self.table, fieldname, SQLFORM.ID_ROW_SUFFIX)
widget = field.widget(field, value)
parent = self.field_parent[row_id]
if parent:
parent.components = [widget]
if self.errors.get(fieldname):
parent._traverse(False, hideerror)
self.custom.widget[fieldname] = widget


If a field's widget is defined, it overwrites it, for reasons mysterious to 
me.  This occurs *after* the formstyle is applied.

If I remove that source code, or remove the widget between form setup and 
validation:


def index():
# Set variables for the default view

form = SQLFORM(db.test, formstyle='bootstrap3_inline')  
db.test.two.widget=None  
form.process()

return dict(form=form)


Then everything works fine.  

What is the point of that code at the end of accepts(), and is this working 
as designed?

-- 
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] Bug? IS_IN_SET used with items removed does not show existing DB value

2015-01-19 Thread americandewd
I have a dropdown list of categories I have created for users to select 
from, when I remove formcontrol.category.requires = 
IS_IN_SET(catwanted,zero=None) it shows the existing data the user has 
already chosen, when I put back the formcontrol.category.requires = 
IS_IN_SET(catwanted,zero=None) it does not show the data existing in the 
field.  The existing data was chosen from initial creation of the data in 
the same manner however if the user wants to go back and change this it is 
not showing what they had existing, instead the dropdown select has the 
first sorted item of the list as though they never had any data there (yet 
this record exists).

I tried several things mentioned here and in the book, none of them showed 
the existing data.  The only thing that would show it is if I took out the 
IS_IN_SET with my list created from the actual category list in the DB.

In my model I am creating a category list (Massimo helped with this awhile 
back):

db.define_table('category', 
Field('title'),
Field('slug',requires=IS_SLUG(),compute=lambda row: IS_SLUG.urlify(row.
title)),
Field('parent_id','reference category', default=None))



In that list I have main categories that I do not want before I make a call 
to edit the form like so:
catwanted = []
notwanted = ['Dontwant1','Dontwant2','Dontwant3']
for row in db(db.category).select():
if row.title in notwanted:
pass
else:
catwanted.append(row.title)
catwanted.sort()

When I call the form I put that list as a requirement:
formcontrol.category.requires = IS_IN_SET(catwanted,zero=None)

The list shows up fine, the problem is that it does not show the existing 
data for that field, it shows the first sorted item.

When I remove the 
formcontrol.category.requires = IS_IN_SET(catwanted,zero=None)
from the call it shows me the existing data in the field, however at this 
point I am not obviously removing the categories from the available options.

Since the only way I can get it to show the existing value is by removing 
formcontrol.category.requires = IS_IN_SET(catwanted,zero=None) I am 
posting here to see if maybe this is just a weird bug because the data that 
exists in the field is not in the excluded list and I have other parts in 
which I do this except the only difference is that I do not exclude 
anything and it shows the existing value in the field.  This does not seem 
right to me for it to not want to show existing data that matches the data 
in the wanted list of items.

-- 
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] bug issue in query serialization

2014-12-19 Thread Manuele Pesenti
https://code.google.com/p/web2py/issues/detail?id=2027thanks=2027ts=1418994994

-- 
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] bug in IS_NOT_EMPTY() ?

2014-12-04 Thread Francisco Ribeiro
hi there,
I noticed that when I use the IS_NOT_EMPTY() validator on a boolean field 
(i.e. a form checkbox) that it will not allow me to submit the form with 
this field as not checked / unticked.  In my opinion, this is a wrong 
interpretation of what is an empty value, since a checkbox can only 
represent True or False and therefore it's never empty. The consequence of 
using this behaviour for the IS_NOT_EMPTY*() validator is that we are 
forcing users to choose True on a widget that is meant to provide a boolean 
choice between True OR False, so the whole purpose of this user interface 
widget, is lost. I only tested this with SQLFORM.factory() though.

Am I missing something?

Francisco

-- 
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.


Re: [web2py] bug in IS_NOT_EMPTY() ?

2014-12-04 Thread Kiran Subbaraman

I see this as IS_NOT_EMPTY() working correctly.
And why would you attach this validator to a checkbox/boolean field? Did 
you also assign a default value of False?
Or you would need to check request.args for this field, and assign a 
false if it is empty, before passing it along to the validator (again, 
not sure what purpose the validator serves for this field).



Kiran Subbaraman
http://subbaraman.wordpress.com/about/

On Thu, 04-12-2014 4:46 PM, Francisco Ribeiro wrote:

hi there,
I noticed that when I use the IS_NOT_EMPTY() validator on a boolean 
field (i.e. a form checkbox) that it will not allow me to submit the 
form with this field as not checked / unticked.  In my opinion, 
this is a wrong interpretation of what is an empty value, since a 
checkbox can only represent True or False and therefore it's never 
empty. The consequence of using this behaviour for the IS_NOT_EMPTY*() 
validator is that we are forcing users to choose True on a widget that 
is meant to provide a boolean choice between True OR False, so the 
whole purpose of this user interface widget, is lost. I only tested 
this with SQLFORM.factory() though.


Am I missing something?

Francisco
--
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 
mailto:web2py+unsubscr...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.


--
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] bug in IS_NOT_EMPTY() validator?

2014-12-04 Thread Anthony
If a boolean widget can only be true or false and never empty, then there is no 
need for this validator to begin with, so just remove it. Are you suggesting 
that the validator itself should be changed to always return success for 
booleans? If so, what would be the point?

Anthony

-- 
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] Bug with submit button?

2014-11-19 Thread LoveWeb2py
This only seems to happen when I run a local copy of my appliance, but here 
it goes. 

First the code:
   
controller:
def submit_answer():
session.incorrect = False
points = 0
responsejs=False
tabTracker = False
sound = None
answer=FORM('Answer: ',
  INPUT(_name='answer', requires=IS_NOT_EMPTY()),
  INPUT(_type='submit', _class='btn btn-primary', 
_id=sub_button,_value=submit))
if answer.process(message_onsuccess='').accepted:
answer_comp = 
db(db.questions.id==int(request.vars['chal'])).select(db.questions.ALL).first()
if answer.vars['answer'] == answer_comp['answer']:
response.flash = 'Correct!'
redirect( 
request.env.http_web2py_component_location,client_side=True)
else:
session.incorrect = True
redirect( 
request.env.http_web2py_component_location,client_side=True)
response.flash = 'Incorrect answer'
elif answer.errors:
response.flash = ''
else:
response.flash = ''
return dict(answer=answer)

view:
 {{=LOAD('board','submit_answer.load', 
vars={'chal':question['id']},ajax=True)}}

-end code

When I click submit while using the appliance locally the button does a 
quick flash/glitch and my input vanishes, but when I click on submit again 
the input is submitted properly. In other words, I have to click submit 
twice for my button to work.

The version I have posted on the web works fine (submits on the first try).

Could this have something to do with accessing the server through a local 
ip? (127.0.0.1) That is the only difference I can spot out

-- 
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] Bug? request.vars not set by routes_in query string.

2014-09-25 Thread Jim Karsten
I am setting a query string in routes_in but the request.vars is not 
getting set. To replicate:

   

In routes.py
routes_in = (
(BASE + '/$anything', '/welcome/default/index?aaa=111bbb=222'),
... 
)

  

Then in 
applications/welcome/views/default/index.html   
   

   

div
vars: {{=request.vars}}br
env: {{=request.env.query_string}}
/div

  

When I visit the welcome app, request.vars displays empty but 
request.env.query_string is set to 
'aaa=111bbb=222'
Is this expected or a bug?

Tested with: Version 2.9.11-stable+timestamp.2014.09.15.23.35.11

Thanks,
Jim

-- 
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] Bug with upload widget when using digitally signed URL's?

2014-06-15 Thread Michael Beller
I'm trying to secure file downloads.  I use user_signature=True for an 
action that generates an edit form that includes an upload field.  The 
upload widget generates a download link but the link appends the file name 
arg after the signature var.

I'm using:
crud.settings.download_url = URL('dcoument', 'download', 
args=document.customer, user_signature=True)

I'm then using:
form = crud.update(...)

This creates a download link like
/document/download/51?_signature=signature/filename
instead of
/document/download/51/filename?_signature=signature

On a related topic, I'm using that extra arg above to create separate 
folders for each customer (useful for multi tenant) but this breaks 
appadmin uploads and download links.  It would be great to use a lambda for 
the upload folder, something like ...

db.define_table('document',
Field('customer', 'reference customer'),
Field('document', 'upload', autodelete=True, 
uploadfolder=lambda r: (request.folder + 'document/download/' + 
row.customer)),
)

-- 
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] Bug in deflate of json fields

2014-04-21 Thread Sebastian Ortiz Vasquez
Hi, i discovered a bug, but don't have enoght time to solve this.

The problem is this, i'm using psycopg2==2.5.2 to get this working, because 
pg8000 still in web2py distribution does not work.

I defined a field of type 'json', (postgresql supports it), when web2py 
inflates the json field as a dict, thats good, but if i do change the json 
field, and i do a row.update_record() it fails as follows, becuse DAL is 
not able to deflate the field as json, a work arround i used is to set the 
field using row[field] = gluon.contrib.simplejson.dumps(dict) and it works, 
but is really annoying if i do change any other field in this way 
row[any_field] = 'some data', and the call the row.update_record() it fails 
becuase the same problem with the json field.


Thank you,


File applications/pyforms/modules/pyform_forms.py, line 339, in 
_edit_grid_data
if row.update_record():
  File /home/sebas/dev/orfeo_pyforms/web2py/gluon/dal.py, line 10640, in 
__call__
table._db(table._id==id,ignore_common_filters=True).update(**newfields)
  File /home/sebas/dev/orfeo_pyforms/web2py/gluon/dal.py, line 10549, in 
update
ret = db._adapter.update(%s % table._tablename,self.query,fields)
  File /home/sebas/dev/orfeo_pyforms/web2py/gluon/dal.py, line 1620, in update
raise e
DataError: invalid input syntax for type json
LINE 1: ...topografica=NULL,reviso=NULL,estructura_ecologica='{u''1'': ...


-- 
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] bug when starting external cron job in web2py 2.9.5

2014-04-08 Thread Alex


since I have serious problems with internal cron I want to switch to 
external cron. 

I created a test controller function which I can call like this:

python web2py.py -J -M -S myapp/dev/test_cron


in previous web2py versions (2.4.6 to be precise) this call works, but with 
2.9.5 I get this error message:

 IOError: [Errno 2] No such file or directory: 
'applications/myapp/compiled/controllers_dev_test_cron.pyc' 

this file is not found because the compiled file is saved as  
controllers.dev.test_cron.pyc (instead of controller_dev_test_cron.pyc in 
previous versions).


So I assume this is a bug in web2py when directly calling a controller 
function from the command line.


regards,

Alex

-- 
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] bug in dal.py _select geoexpand: convert geography as well

2014-03-19 Thread sunny
geoexpand should expand geography as well.
otherwise geography fields will not be converted to text.

the fix for me was to change the if part in geoexpand (dal.py:1713)

-if isinstance(field.type,str) and 
field.type.startswith('geometry') and isinstance(field, Field):

+if isinstance(field.type,str) and field.type.startswith('geo') 
and isinstance(field, Field):



-- 
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] Bug in request_reset_password

2014-03-01 Thread pepper_bg
Not sure how to report this so posting here, please let me know if there is 
a separate bug tracking system.

Just upgraded an existing web2py installation to 
2.8.2-stable+timestamp.2013.11.28.13.54.07 using the 'Check for upgrades' 
button in Admin. Works fine so far except request_reset_password kept 
saying 'Invalid username'. I had to do this in gluon/tools.py to fix it:

2918c2918
 user = table_user(**{userfield:form.vars.email})
---
 user = table_user(**{userfield:form.vars[userfield]})

-- 
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 on version 2.8.2

2014-02-25 Thread Paulo Ramos
Well, this isn't a question, but a bug report (I'm new to the list).


I was following online book, chapter 3, with a small difference. Instead of 
using singular on tables names I use plural, so I give to the image table 
the name 'images'. However I made a mistake when referencing images in 
posts, i.e., I used Field('image_id', 'reference image'), instead of 
Field('image_id', 'reference images'). Of course, when I tried to post a 
comment an error message came up. After spending several minutes to figure 
where the error was (well in this case the ticket system was not so helpful 
because always pointed to the controller and not the model, where the 
mistake was), I fix it, but the error message continue. I went to the 
sql.log file, and table name still was in singular, so I change that in 
sql.log. No changes, the error continue, albeit the multiple success word 
in the end of sql.log.

The solution I found was delete the storage.sqlite. After that everything 
went smooth.


I'm almost sure that this is a bug in DAL module.


HTH,


Paulo



-- 
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:
class 'sqlite3.IntegrityError' 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] bug in rewrite.py ? (wasRe: admin disabled... or why is parameters_80.py needed)

2013-10-05 Thread Gour
On Sat, 5 Oct 2013 05:05:26 -0700 (PDT)
Niphlod niph...@gmail.com wrote:

 and see where web2py is told to listen on :D

I belive it's bug in web2py, iow. how it handles working behind reverse
proxy.

See the env:

HTTP_ACCEPT :   
text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
HTTP_ACCEPT_ENCODING:   
gzip, deflate
HTTP_ACCEPT_LANGUAGE:   
en,hr;q=0.5
HTTP_CONNECTION :   
close
HTTP_COOKIE :   
session_id_welcome=93.139.171.186-2c523139-4c5c-4ba9-bc62-ec11a313a6b9; 
session_id_admin=93.139.171.186-9833e092-1503-4d0d-88b7-df46550d652b
HTTP_HOST   :   
atmarama.sites.djangohosting.ch
HTTP_REFERER:   
https://atmarama.sites.djangohosting.ch/admin/default/site
HTTP_SCHEME :   
https
HTTP_USER_AGENT :   
Mozilla/5.0 (X11; Linux x86_64; rv:23.0) Gecko/20100101 Firefox/23.0 
Iceweasel/23.0 FirePHP/0.7.4
HTTP_X_FORWARDED_FOR:   
93.139.171.186
HTTP_X_FORWARDED_HOST   :   
atmarama.sites.djangohosting.ch
HTTP_X_FORWARDED_PORT   :   
443
HTTP_X_FORWARDED_PROTO  :   
https
HTTP_X_FORWARDED_PROTOCOL   :   
https
HTTP_X_INSIGHT  :   
activate
HTTP_X_REAL_IP  :   
93.139.171.186
HTTP_X_REAL_PORT:   
93.139.171.186
PATH_INFO   :   
/welcome/default/index
QUERY_STRING:   
RAW_URI :   
/welcome/default/index
REMOTE_ADDR :   
93.139.171.186
REMOTE_PORT :   
80
REQUEST_METHOD  :   
GET
SCRIPT_NAME :   
SERVER_NAME :   
atmarama.sites.djangohosting.ch
SERVER_PORT :   
80
SERVER_PROTOCOL :   
HTTP/1.0
SERVER_SOFTWARE :   
gunicorn/18.0
db_sessions :   
set([])
debugging   :   
False
http_accept :   
text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
http_accept_encoding:   
gzip, deflate
http_accept_language:   
en,hr;q=0.5
http_connection :   
close
http_cookie :   
session_id_welcome=93.139.171.186-2c523139-4c5c-4ba9-bc62-ec11a313a6b9; 
session_id_admin=93.139.171.186-9833e092-1503-4d0d-88b7-df46550d652b
http_host   :   
atmarama.sites.djangohosting.ch
http_referer:   
https://atmarama.sites.djangohosting.ch/admin/default/site
http_scheme :   
https
http_user_agent :   
Mozilla/5.0 (X11; Linux x86_64; rv:23.0) Gecko/20100101 Firefox/23.0 
Iceweasel/23.0 FirePHP/0.7.4
http_x_forwarded_for:   
93.139.171.186
http_x_forwarded_host   :   
atmarama.sites.djangohosting.ch
http_x_forwarded_port   :   
443
http_x_forwarded_proto  :   
https
http_x_forwarded_protocol   :   
https
http_x_insight  :   
activate
http_x_real_ip  :   
93.139.171.186
http_x_real_port:   
93.139.171.186
is_jython   :   
False
is_pypy :   
False
is_source   :   
True
local_hosts :   
atmarama.sites.djangohosting.ch
:::127.0.0.1
::1
s9.wservices.ch
78.46.120.231
127.0.0.1
path_info   :   
/welcome/default/index
query_string:   
raw_uri :   
/welcome/default/index
remote_addr :   
93.139.171.186
remote_port :   
80
request_method  :   
GET
request_uri :   
/welcome/default/index
script_name :   
server_name :   
atmarama.sites.djangohosting.ch
server_port :   
80
server_protocol :   
HTTP/1.0
server_software :   
gunicorn/18.0
web2py_version  :   
2.6.4-stable+timestamp.2013.10.01.15.24.15
local_hosts :   
atmarama.sites.djangohosting.ch
:::127.0.0.1
::1
s9.wservices.ch
78.46.120.231
127.0.0.1
web2py_version  :   
2.6.4-stable+timestamp.2013.10.01.15.24.15
is_https:   
True
is_local:   
False
is_restful  :   
False
now :   
datetime.datetime(2013, 10, 5, 14, 49, 22, 784103)
post_vars   :   
raw_args:   
raw_extension   :   
None
url :   
/welcome/default/index
utcnow  :   
datetime.datetime(2013, 10, 5, 12, 49, 22, 784108)
uuid:   
welcome/93.139.171.186.2013-10-05.14-49-22.05a7d131-0ecb-48a5-a062-08d32f14644d
vars:   

It shows that is_https: True and sets: remote_port to 80 ??

I believe that rewriting code in rewrite.py does not handle properly
working behind reverse proxy when wsgi is listening on non-standard
port and it wouldn't be the first piece of software having such bug - I
met several PHP projects with the same problem.


Sincerely,
Gour

-- 
From anger, complete delusion arises, and from delusion 
bewilderment of memory. When memory is bewildered, 
intelligence is lost, and when intelligence is lost 
one falls down again into the material pool.

http://www.atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810


-- 
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.

[web2py] bug in trunk with request.vars being turned into a list with a duplicated value???

2013-08-20 Thread Tim Richardson
I have this URL:
http:
//127.0.0.1:8050/patient_form/enter_form/enter_form?login_id=T19566_signature=609f2082e4d219a48ae44e2448ab0e01a9a05e55


and the controller does this:

login_id = request.vars.login_id

...
valid_code = cache.disk(login_id,lambda: None,time_expire=SESSION_MINUTES*60
)


The use of cache is failing with an error: 

Via the debugger, I see that oddly 
login_id = ['T19566', 'T19566']


This code is in production of 2.5.4 without any errors. I see this 
behaviour on trunk Version 2.6.0-development+timestamp.2013.08.20.11.14.41
This is a multi-step form which calls itself, saving the step as a 
request var (although there is no step var initially, which is why it is 
missing from the URL)
This bug happens after the user leaves the first step of the form.
Until now I would have expected login_id to be taken from the URL string. I 
don't know why I now get a list duplicating the value.


-- 

--- 
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 SQLFORM.grid - interference between two grids openned in two browser tabs ...

2013-07-26 Thread David Marko
I accidentlly found a strange thing / bug when I open two browser tabs of 
the same app with two different pages having different grids. 

Scenario:
a) open page01 with grid (first browser tab)
b) open page02 with another grid (another browser tab) 
c) go back to first tab and refresh/reload the page01
d) go to second tab with page02 and click on 'edit' on any row. Now the 
edit page 'back' button points to page01 and not to page02, from which the 
edit page came from

Hopefully its not too messy. I tested many times, still the same ...

-- 

--- 
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 report: username as space inside is incorrectly accepted

2013-06-29 Thread Ray (a.k.a. Iceberg)
Hi folks,

First of all, I think white space is generally not acceptable as part of 
username. But right now web2py accepts username such as space inside.

Actually, web2py defines the username validator like this:

[IS_MATCH('[\w\.\-]+'), ...]

so space is presumably not an intention.


The fix is:

[IS_MATCH('[\w\.\-]+', strict=True, error_message='Only allow 
a-zA-Z0-9_-.'), ...]


Do I need to write an issue to google code issue tracker?

-- 

--- 
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: doc-text for requires_signature() is wrong

2013-06-24 Thread Holger Schurig
The doc-text for requires_signature() speaks about group id and role. Seems 
to be a cut-and-paste error.

-- 

--- 
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: git commit 714fcc52 wreaked german umlaut characters

2013-06-18 Thread Holger Schurig
Hi, I'm exploring web2py from GIT together with a chrome browser.

When I open the admin, I get the presentation in the german language, 
because this is configured as one of the languages in Chromium (the 
non-google-branded version of Google Chrome). That's ok so far. 
Unfortunately, umlaut characters are show as ?, e.g. not Über, but 
?ber. Using Right-Mouse-Click - Inspect Element, I can see that web2py 
incorrectly sends a href=/admin/default/about/examples?ber/a. 
Further investigation revealed that the ? characters are already in 
applications/admin/languages/de.py.

git blame told me that it was commit 714fcc52, git show 714fcc52 | grep 
About will show you an example.

-- 

--- 
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 JSON parsing in main.py

2013-05-23 Thread Matt
Hi there,

I'm using Version 2.4.6-stable+timestamp.2013.05.17.14.52.19, Running on 
mac, Python 2.7.2, no external JSON library installed.

Sending the following data via PUT, application/json; charset=UTF-8:

{id: 3}

results in a JSON parser error occurring at main.py:

if is_json:
try:
logging.info('before') --- my addition
json_vars = sj.load(body)
logging.info('after') --- my addition
body.seek(0)
except Exception, e: --- my addition
logging.exception(e) --- my addition
# incoherent request bodies can still be parsed ad-hoc
json_vars = {}
pass
# update vars and get_vars with what was posted as json
request.get_vars.update(json_vars)
request.vars.update(json_vars)

INFO 2013-05-24 00:07:21,100 main.py:337] before
INFO 2013-05-24 00:07:21,100 main.py:338] module 'json' from 
'/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py'
ERROR2013-05-24 00:07:21,100 main.py:346] No JSON object could be 
decoded
Traceback (most recent call last):
  File /Projects/www/app/gluon/main.py, line 340, in parse_get_post_vars
json_vars = sj.load(body)
  File 
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py,
 
line 278, in load
**kw)
  File 
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py,
 
line 326, in loads
return _default_decoder.decode(s)
  File 
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py,
 
line 366, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File 
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py,
 
line 384, in raw_decode
raise ValueError(No JSON object could be decoded)

Appears to be related to the id() function for some reason, as changing the 
attribute name to anything other than id works fine. 

Help on built-in function id in module __builtin__:

id(...)

id(object) - integer

Return the identity of an object.  This is guaranteed to be unique among
simultaneously existing objects.  (Hint: it's the object's memory
address.)

If I explicitly force it to use contrib.simplejson. i.e. change the top of 
main.py

try:
import simplejson as sj #external installed library
except:
try:
import contrib.simplejson as sj #pure python library --- Pasted.
except:
import contrib.simplejson as sj #pure python library

I get the same result.

Any ideas?

Thanks in advance,
Matt

-- 

--- 
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.




Re: [web2py] BUG in JSON parsing in main.py

2013-05-23 Thread Jonathan Lundell
On 23 May 2013, at 5:35 PM, Matt mjwat...@gmail.com wrote:
 Hi there,
 
 I'm using Version 2.4.6-stable+timestamp.2013.05.17.14.52.19, Running on mac, 
 Python 2.7.2, no external JSON library installed.
 
 Sending the following data via PUT, application/json; charset=UTF-8:
 
 {id: 3}
 
 results in a JSON parser error occurring at main.py:
 
 if is_json:
 try:
 logging.info('before')--- my addition
 json_vars = sj.load(body)
 logging.info('after') --- my addition
 body.seek(0)
 except Exception, e:  --- my addition
 logging.exception(e)  --- my addition
 # incoherent request bodies can still be parsed ad-hoc
 json_vars = {}
 pass
 # update vars and get_vars with what was posted as json
 request.get_vars.update(json_vars)
 request.vars.update(json_vars)
 
 INFO 2013-05-24 00:07:21,100 main.py:337] before
 INFO 2013-05-24 00:07:21,100 main.py:338] module 'json' from 
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py'
 ERROR2013-05-24 00:07:21,100 main.py:346] No JSON object could be decoded
 Traceback (most recent call last):
   File /Projects/www/app/gluon/main.py, line 340, in parse_get_post_vars
 json_vars = sj.load(body)
   File 
 /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py,
  line 278, in load
 **kw)
   File 
 /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py,
  line 326, in loads
 return _default_decoder.decode(s)
   File 
 /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py,
  line 366, in decode
 obj, end = self.raw_decode(s, idx=_w(s, 0).end())
   File 
 /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py,
  line 384, in raw_decode
 raise ValueError(No JSON object could be decoded)
 
 Appears to be related to the id() function for some reason, as changing the 
 attribute name to anything other than id works fine. 
 
 Help on built-in function id in module __builtin__:
 
 id(...)
 
 id(object) - integer
 
 Return the identity of an object.  This is guaranteed to be unique among
 simultaneously existing objects.  (Hint: it's the object's memory
 address.)
 
 If I explicitly force it to use contrib.simplejson. i.e. change the top of 
 main.py
 
 try:
 import simplejson as sj #external installed library
 except:
 try:
 import contrib.simplejson as sj #pure python library  --- Pasted.
 except:
 import contrib.simplejson as sj #pure python library
 
 I get the same result.
 
 Any ideas?
 

FWIW, json.loads('{id: 3}') works fine.

I'd try logging body.read() before the json.load call, and see what json is 
actually getting. You could follow that with body.seek(0) if you want, but 
since it's going to crash anyway...

-- 

--- 
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.




Re: [web2py] BUG in JSON parsing in main.py

2013-05-23 Thread Matt
Thanks for your response.

Unfortunately that example isn't quite the same as how json is processed 
from the body in main.py. I.e. it's using cStringIO I think. 

I can put together an example that highlights this I guess.

On Friday, May 24, 2013 12:53:14 PM UTC+12, Jonathan Lundell wrote:

 On 23 May 2013, at 5:35 PM, Matt mjwa...@gmail.com javascript: wrote:

 Hi there,

 I'm using Version 2.4.6-stable+timestamp.2013.05.17.14.52.19, Running on 
 mac, Python 2.7.2, no external JSON library installed.

 Sending the following data via PUT, application/json; charset=UTF-8:

 {id: 3}

 results in a JSON parser error occurring at main.py:

 if is_json:
 try:
 logging.info('before') --- my addition
 json_vars = sj.load(body)
 logging.info('after') --- my addition
 body.seek(0)
 except Exception, e: --- my addition
 logging.exception(e) --- my addition
 # incoherent request bodies can still be parsed ad-hoc
 json_vars = {}
 pass
 # update vars and get_vars with what was posted as json
 request.get_vars.update(json_vars)
 request.vars.update(json_vars)

 INFO 2013-05-24 00:07:21,100 main.py:337] before
 INFO 2013-05-24 00:07:21,100 main.py:338] module 'json' from 
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py'
 ERROR2013-05-24 00:07:21,100 main.py:346] No JSON object could be 
 decoded
 Traceback (most recent call last):
   File /Projects/www/app/gluon/main.py, line 340, in parse_get_post_vars
 json_vars = sj.load(body)
   File 
 /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py,
  
 line 278, in load
 **kw)
   File 
 /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py,
  
 line 326, in loads
 return _default_decoder.decode(s)
   File 
 /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py,
  
 line 366, in decode
 obj, end = self.raw_decode(s, idx=_w(s, 0).end())
   File 
 /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py,
  
 line 384, in raw_decode
 raise ValueError(No JSON object could be decoded)

 Appears to be related to the id() function for some reason, as changing 
 the attribute name to anything other than id works fine. 

 Help on built-in function id in module __builtin__:

 id(...)

 id(object) - integer

 Return the identity of an object.  This is guaranteed to be unique 
 among
 simultaneously existing objects.  (Hint: it's the object's memory
 address.)

 If I explicitly force it to use contrib.simplejson. i.e. change the top of 
 main.py

 try:
 import simplejson as sj #external installed library
 except:
 try:
 import contrib.simplejson as sj #pure python library --- Pasted.
 except:
 import contrib.simplejson as sj #pure python library

 I get the same result.

 Any ideas?


 FWIW, json.loads('{id: 3}') works fine.

 I'd try logging body.read() before the json.load call, and see what json 
 is actually getting. You could follow that with body.seek(0) if you want, 
 but since it's going to crash anyway...


-- 

--- 
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.




Re: [web2py] BUG in JSON parsing in main.py

2013-05-23 Thread Jonathan Lundell
On 23 May 2013, at 7:52 PM, Matt mjwat...@gmail.com wrote:
 Thanks for your response.
 
 Unfortunately that example isn't quite the same as how json is processed from 
 the body in main.py. I.e. it's using cStringIO I think. 

Right. That's why I think it'd be useful to see what body.read()  returns 
(reading the cStringIO stream).

 
 I can put together an example that highlights this I guess.
 
 On Friday, May 24, 2013 12:53:14 PM UTC+12, Jonathan Lundell wrote:
 On 23 May 2013, at 5:35 PM, Matt mjwa...@gmail.com wrote:
 Hi there,
 
 I'm using Version 2.4.6-stable+timestamp.2013.05.17.14.52.19, Running on 
 mac, Python 2.7.2, no external JSON library installed.
 
 Sending the following data via PUT, application/json; charset=UTF-8:
 
 {id: 3}
 
 results in a JSON parser error occurring at main.py:
 
 if is_json:
 try:
 logging.info('before')   --- my addition
 json_vars = sj.load(body)
 logging.info('after')--- my addition
 body.seek(0)
 except Exception, e: --- my addition
 logging.exception(e) --- my addition
 # incoherent request bodies can still be parsed ad-hoc
 json_vars = {}
 pass
 # update vars and get_vars with what was posted as json
 request.get_vars.update(json_vars)
 request.vars.update(json_vars)
 
 INFO 2013-05-24 00:07:21,100 main.py:337] before
 INFO 2013-05-24 00:07:21,100 main.py:338] module 'json' from 
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py'
 ERROR2013-05-24 00:07:21,100 main.py:346] No JSON object could be decoded
 Traceback (most recent call last):
   File /Projects/www/app/gluon/main.py, line 340, in parse_get_post_vars
 json_vars = sj.load(body)
   File 
 /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py,
  line 278, in load
 **kw)
   File 
 /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py,
  line 326, in loads
 return _default_decoder.decode(s)
   File 
 /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py,
  line 366, in decode
 obj, end = self.raw_decode(s, idx=_w(s, 0).end())
   File 
 /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py,
  line 384, in raw_decode
 raise ValueError(No JSON object could be decoded)
 
 Appears to be related to the id() function for some reason, as changing the 
 attribute name to anything other than id works fine. 
 
 Help on built-in function id in module __builtin__:
 
 id(...)
 
 id(object) - integer
 
 Return the identity of an object.  This is guaranteed to be unique among
 simultaneously existing objects.  (Hint: it's the object's memory
 address.)
 
 If I explicitly force it to use contrib.simplejson. i.e. change the top of 
 main.py
 
 try:
 import simplejson as sj #external installed library
 except:
 try:
 import contrib.simplejson as sj #pure python library --- Pasted.
 except:
 import contrib.simplejson as sj #pure python library
 
 I get the same result.
 
 Any ideas?
 
 
 FWIW, json.loads('{id: 3}') works fine.
 
 I'd try logging body.read() before the json.load call, and see what json is 
 actually getting. You could follow that with body.seek(0) if you want, but 
 since it's going to crash anyway...
 
 -- 
  



-- 

--- 
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] Possible web2py bug sending emails

2013-04-23 Thread Leonel Câmara
Hey,

I have recently battled with not being able to send emails using the smtp 
server provided by the client.


I narrowed down the problem to emails being sent using TLS doing this

if self.settings.tls and not self.settings.ssl:
server.ehlo()
server.starttls()
server.ehlo()

Turns out smtplib.ehlo() doesn't always give an acceptable hostname for 
what ESMTP servers want, like the domain you're actually using and the 
server will deny you if it's not accepting relays.

http://docs.python.org/2/library/smtplib.html#smtplib.SMTP.ehlo

Can we change this to something like this:

if self.settings.tls and not self.settings.ssl:
server.ehlo(self.settings.hostname)
server.starttls()
server.ehlo(self.settings.hostname)

Putting the hostname there, finally solved my problem but it wasn't a fun 
night.

-- 

--- 
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: Possible web2py bug sending emails

2013-04-23 Thread Massimo Di Pierro
aha! Thanks This solves my problem too. It is in trunk.

On Tuesday, 23 April 2013 22:15:11 UTC-5, Leonel Câmara wrote:

 Hey,

 I have recently battled with not being able to send emails using the smtp 
 server provided by the client.


 I narrowed down the problem to emails being sent using TLS doing this

 if self.settings.tls and not self.settings.ssl:
 server.ehlo()
 server.starttls()
 server.ehlo()

 Turns out smtplib.ehlo() doesn't always give an acceptable hostname for 
 what ESMTP servers want, like the domain you're actually using and the 
 server will deny you if it's not accepting relays.

 http://docs.python.org/2/library/smtplib.html#smtplib.SMTP.ehlo

 Can we change this to something like this:

 if self.settings.tls and not self.settings.ssl:
 server.ehlo(self.settings.hostname)
 server.starttls()
 server.ehlo(self.settings.hostname)

 Putting the hostname there, finally solved my problem but it wasn't a fun 
 night.


-- 

--- 
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.




Re: [web2py] Re: Possible web2py bug sending emails

2013-04-23 Thread Leonel Câmara
Awesome! I was afraid I would have to maintain a different web2py codebase
for this client.


On Wed, Apr 24, 2013 at 5:20 AM, Massimo Di Pierro 
massimo.dipie...@gmail.com wrote:

 aha! Thanks This solves my problem too. It is in trunk.


 On Tuesday, 23 April 2013 22:15:11 UTC-5, Leonel Câmara wrote:

 Hey,

 I have recently battled with not being able to send emails using the smtp
 server provided by the client.


 I narrowed down the problem to emails being sent using TLS doing this

 if self.settings.tls and not self.settings.ssl:
 server.ehlo()
 server.starttls()
 server.ehlo()

 Turns out smtplib.ehlo() doesn't always give an acceptable hostname for
 what ESMTP servers want, like the domain you're actually using and the
 server will deny you if it's not accepting relays.

 http://docs.python.org/2/**library/smtplib.html#smtplib.**SMTP.ehlohttp://docs.python.org/2/library/smtplib.html#smtplib.SMTP.ehlo

 Can we change this to something like this:

 if self.settings.tls and not self.settings.ssl:
 server.ehlo(self.settings.**hostname)
 server.starttls()
 server.ehlo(self.settings.**hostname)

 Putting the hostname there, finally solved my problem but it wasn't a fun
 night.

  --

 ---
 You received this message because you are subscribed to a topic in the
 Google Groups web2py-users group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/web2py/eY82X5I9XG8/unsubscribe?hl=en.
 To unsubscribe from this group and all its topics, send an email to
 web2py+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.




-- 

--- 
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 web2py admin

2013-03-19 Thread frasse
Hi 
It is a bug in web2py 2.4.4 admin page. when you create a file using 
create/uploade for modules it create file under static not under modules.

/F 

-- 

--- 
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 with onvalidation argument in form.accepts

2013-03-10 Thread Alex
I'm using the onvalidation argument as a dict to pass a function for 
onsuccess and onfailure. e.g.
if form.accepts(request.vars, formname='client_form', onvalidation=dict(
onsuccess=validateClientForm, onfailure=validateClientForm)):

The problem is that if onfailure is given as an argument and the url 
contains a request parameter the form is always validated and not just when 
it is submitted. 

I currently use this workaround:
request_vars = Storage()
if request.vars._formname:
  request_vars = request.vars

 if form.accepts(request_vars, formname='client_form', onvalidation=dict(
onsuccess=validateClientForm, onfailure=validateClientForm)): 



If there are no request parameters the method works fine. I assume the bug 
is in html.py line 2012 (although I don't think I fully understood the 
code):
if onfailure and request_vars and not status:

I think it should not only check if there are request parameters but also 
if the form was actually submitted (this is automatically done for 
onsuccess because status is only True if the form was submitted). I assume 
this should work:
if onfailure and request_vars and  formname == request_vars._formname and 
not status:

This bug already exists for a long time (at least since 1.99.2). Is there 
any chance it gets fixed?

thanks,
Alex

-- 

--- 
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 database administration

2013-02-07 Thread Calycé
Hi all,

I have an error in the database administration when using the following 
code in db.py:

db.define_table('cgc_service_categories',  
Field('category', 'string', required=True),
Field('description', 'text', required=True),
Field('image', 'upload', required=True),
Field('display_order', 'integer'),
Field('link', 'string'),
format='%(category)s')

db.define_table('cgc_trainings',
Field('category', db.cgc_service_categories),
Field('disporder', 'integer'),
Field('title', 'string', required=True),
Field('short_title', 'string', required=True),
Field('duration', 'string', required=True),
Field('planning', 'text', required=True),
Field('typical', 'text'),
Field('price', 'integer'),
Field('training_checks', 'boolean'),
Field('image', 'upload'),
format='%(short_title)s')

db.define_table('cgc_schedule',
Field('training', db.cgc_trainings),
Field('location', 'string'),
Field('training_date', 'date'),
Field('vacancies', 'integer'),
format='%(training.short_title)s (%(training_date)s)')

db.define_table('cgc_booking',
Field('training_date', db.cgc_schedule),
Field('company', 'string'),
Field('first_name', 'string'),
Field('last_name', 'string'),
Field('phone', 'string'),
Field('email', 'string'),
Field('seats', 'integer'))

It works when I browse the existing records, but if I try to edit a record 
or insert a new one with the database administration in the cgc_booking 
table, I receive the following error:
type 'exceptions.AttributeError' 'Table' object has no attribute 
'training.short_title'
If I change the format for the cgc_schedule table to %(training)s 
(%(training_date)s) it works but having only the id is useless in this 
case.

Is it a bug in the database administration or am I doing something wrong ?

BTW, I'm using 2.3.2.

Thanks for your help.


Calycé

-- 

--- 
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: Query with Expression that contains space within

2013-01-20 Thread Ignacio Ocampo
When I use custom expression, that contains comma within, it fails if I use 
an space after comma.

*Example 1*
--- WORKS ---
query = ac(tickets.id0).select(tickets.name, tickets.created_on, 
DATEDIFF(tickets.created_*on,N*OW()))
colnames=['tickets.name', 'tickets.created_on', 'DATEDIFF(tickets.created_o*
n,N*OW())']

--- DON'T WORKS ---
query = ac(tickets.id0).select(tickets.name, tickets.created_on, 
DATEDIFF(tickets.created_*on, N*OW()))
colnames=['tickets.name', 'tickets.created_on', 'DATEDIFF(tickets.created_on
*', '*NOW())']

*Example 2*
--- WORKS ---
query = ac(tickets.id0).select(tickets.name, tickets.created_on, 
SUBSTRING(tickets.nam*e,5*))
colnames=['tickets.name', 'tickets.created_on', 'SUBSTRING(tickets.nam*e,5*
)']
--- DON'T WORKS ---
query = ac(tickets.id0).select(tickets.name, tickets.created_on, 
SUBSTRING(tickets.nam*e, 5*))
colnames=['tickets.name', 'tickets.created_on', 'SUBSTRING(tickets.name*', '
*5)']

-- 





[web2py] bug in smartgrid groupby

2013-01-18 Thread Mark
For web2py 2.2.1.

When I use groupby in smartgrid, the number of records found usually 
displays a wrong number.  Often displays 1 records found even there are 
many records in the grid. Sometime, for examples, displays 11 when there 
are 9 records in grid, displays 2 when there are 4 records. The number will 
be displayed correctly if I remove the groupby from grid.  

Thanks,
Mark

-- 





[web2py] Bug when rendering nested dictionaries as JSON? -- depends on specific values of keys

2012-12-01 Thread Chris
I've found a strange behavior in 1.99.7 (which is the same in 2.2.1 except 
for a code cleanup issue).  This is either a bug or I'm confused (don't 
rule that out).  This is a long message -- I thought it was important to 
include a detailed demo of the phenomenon.

The idea of generic views is wonderful -- a controller function can return 
a dict; and based on the extension used to request the page, data is 
returned using the formatting logic of the generic view of that type.  This 
works well and is demonstrated clearly in section 10.1.1 of the book.  A 
simple example:


In default.py 

def test():
return dict(status='200 OK')


Then from a unix command line 

$ curl -L 'http://localhost:8000/default/test.load'
200 OK

$ curl -L 'http://localhost:8000/default/test.xml'
?xml version=1.0 encoding=UTF-8?documentstatus200 OK/status/
document

$ curl -L 'http://localhost:8000/default/test.json'
{
status: 200 OK
}


## note in JSON, I made a change in gluon / serializers.py to add indents

So far so good.  But something bad happens when the dictionary is nested:


In updated default.py 

def test():
return dict(response=dict(status='200 OK'))


requesting ...test.json creates an error file in my app/err folder 


Traceback (most recent call last):
  File /Users/chris/dev/hsmaster/web2py_v1.99.7/gluon/main.py, line 508, 
in wsgibase
serve_controller(request, response, session)
  File /Users/chris/dev/hsmaster/web2py_v1.99.7/gluon/main.py, line 207, 
in serve_controller
run_view_in(response._view_environment)
  File /Users/chris/dev/hsmaster/web2py_v1.99.7/gluon/compileapp.py, line 
596, in run_view_in
badv = \'invalid view (%s)\' % response.view
AttributeError: \'dict\' object has no attribute \'view\'


Observations 

The book says Any dictionary can be rendered in HTML, XML and JSON as long 
as it only contains python primitive types (int, float, string, list, 
tuple, dictionary). so this seems in-bounds.  json.dumps (serializer 
users) has no problem with nested dicts.

This may be a clue -- if we service-enable the same function and call 
differently ...

@service.json
def test():
return dict(response=dict(status='200 OK'))


...  the result is fine ...

$ curl -L 'http://localhost:8000/default/call/json/test'
{
response: {
status: 200 OK
}
}


or if we don't service-enable it, call like we did the first time, but 
change the name of the top-level key like this:

def test():
return dict(blahblah=dict(status='200 OK'))


... the result is fine too ...

$ curl -L 'http://localhost:8000/default/test.json'
{
blahblah: {
status: 200 OK
}
}


Conclusion 

After a long Wingare debugging session, I think this code is the proximate 
cause of the problem:

in gluon / main.py / serve_controller():

...
page = run_controller_in(request.controller, request.function,environment
)
if isinstance(page, dict):
response._vars = page
for key in page:
response._view_environment[key] = page[key]   ### AAA
run_view_in(response._view_environment)
page = response.body.getvalue()
...


Basically it appears that the line marked AAA overwrites data in the 
response._view_environment structure with data from the dict the test() 
function returns.  The problem only happens when a key in the top level 
(not nested) of the dict matches an existing key in 
response._view_environment.  response._view_environment has 129 keys: A B 
BEAUTIFY ... auth cache crud ... response request service etc.) and when 
one of these is in common with the dict being rendered, the value of 
dict[key] overwrites it.

The traceback above was from gluon / compileapp.py /  run_view_in() -- that 
relies on response._view_environment['response'] to have a key 'view', 
which is present before line AAA; but gone after 
-- response._view_environment['response'] has been clobbered.


Remediation 

In my debugging, I changed line AAA to be a pass statement and nothing bad 
happened.  I don't know if that is the right approach or not.  The same 
little block of code I showed above (from main.py) also occurs twice in 
compileapp.py.  I don't know enough to judge whether eliminating line AAA 
as I did is a good idea or not; or if it should be done in some or all of 
the three location.


Request 

Can someone say if my solution is on the right track; and why the dict is 
being merged with the response?  Maybe the right approach for a different 
payload -- but dicts can't avoid using these keys.  view, title, status, db 
-- these are pretty common keys.


Best regards and thanks --

-- 





[web2py] Bug? Invalid url puts python into a tight loop - 100% CPU

2012-11-13 Thread jc
Hi,

I have a simple system running ok except when google's web crawlers start 
trying to find some old, long url's which used to be on the site. I have 
just migrated an old basically static website to web2py, to provide a base 
for some more interesting features in the future. However google knows the 
old url's and tries to crawl them, at which point the system dies by going 
into a tight loop.

It is quite repeatable on my development machine, now I know which url's 
trigger it. An example is:

http://localhost:63123/aa/A%20Lccc%20-%20Pddd%20GA%20Dee%20(%20%20A).pdf

If I remove the two brackets in the final part of the url (the pdf file 
name) so the url becomes 

http://localhost:63123/aa/A%20Lccc%20-%20Pddd%20GA%20Dee%20%20%20A.pdf

then I get invalid function (default/aa) as I would expect.

I know the brackets are invalid characters and should not be in the uri (or 
should be encoded), but the system should be robust against invalid 
characters being sent to the server.

I am running on web2py 2.2.1. I am wondering how to debug this further. If 
I turn on DEBUG logging for root, rewrite, web2py and rocket I get this 
output:


2012-11-13 13:05:57,934 - Rocket.Errors.ThreadPool - DEBUG - Examining 
ThreadPool. 10 threads and 0 Q'd conxions
2012-11-13 13:05:58,936 - Rocket.Errors.ThreadPool - DEBUG - Examining 
ThreadPool. 10 threads and 0 Q'd conxions
2012-11-13 13:05:59,600 - Rocket.Errors.Thread-3 - DEBUG - Received a 
connection.
2012-11-13 13:05:59,600 - Rocket.Errors.Thread-3 - DEBUG - Serving a request
2012-11-13 13:05:59,601 - Rocket.Errors.Thread-3 - DEBUG - Getting sock_file
select application=tgaa
route: controller=default
route: function.ext=aa.html

and now the system is in its tight loop with no more logging output.

routes.py contains just

logging = 'print'
routers = dict(
BASE  = dict(
default_application = 'tgaa',
map_hyphen = 'True',
),
)

Thanks for any assistance.

-- 





[web2py] BUG: jQueryUI interferes with login/session.auth?

2012-10-28 Thread lyn2py
For: *Version 2.2.1 (2012-10-22 18:50:13) stable*

When I uncomment the jQueryUI code in *layout.html*, login / session.auth 
fails to work. By fail, I mean that I login successfully but session.auth 
is empty.
  !-- uncomment here to load jquery-ui --
   link rel=stylesheet 
href=http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/themes/base/jquery-ui.css;
 
type=text/css media=all /
   script 
src=http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js; 
type=text/javascript/script
   !-- uncomment to load jquery-ui //-- 

I am using this on a new app.


-- 





[web2py] BUG: appadmin cannot save to db

2012-10-25 Thread lyn2py
I'm on Version 2.2.1 (2012-10-22 18:50:13) stable

This is specific to *database admin *in *appadmin.*
I needed to change some data, but appadmin will not save the items, 
although on response.flash / session.flash it says done!


-- 





Re: [web2py] BUG: appadmin cannot save to db

2012-10-25 Thread Richard Vézina
Did you use appdamin with a new app or you use the appadmin of your own app?

If you use your own app appadmin did you think to replace it with the
appadmin of the welcome?

Richard

On Thu, Oct 25, 2012 at 11:01 AM, lyn2py lyn...@gmail.com wrote:

 I'm on Version 2.2.1 (2012-10-22 18:50:13) stable

 This is specific to *database admin *in *appadmin.*
 I needed to change some data, but appadmin will not save the items,
 although on response.flash / session.flash it says done!


  --





-- 





Re: [web2py] BUG: appadmin cannot save to db

2012-10-25 Thread lyn2py
Good point. I will update and try it later. I need to replace appadmin.py only?

Thanks Richard. 

-- 





Re: [web2py] BUG: appadmin cannot save to db

2012-10-25 Thread Richard Vézina
appadmin.html to

And by the way you should update :

All files from static/

all generic files form views/

Make sure you backup you app before, so you can revert if you brake
something.

If you have modify layout.html you will have to compare what change in the
new layout.html and replace the element in your own layout.html

Richard

On Thu, Oct 25, 2012 at 12:25 PM, lyn2py lyn...@gmail.com wrote:

 Good point. I will update and try it later. I need to replace appadmin.py
 only?

 Thanks Richard.

 --





-- 





Re: [web2py] BUG: appadmin cannot save to db

2012-10-25 Thread Richard Vézina
view/

appadmin.html
generic.ics
generic.load
generic.rss
layout.html
generic.json
generic.map
generic.xml
web2py_ajax.html
generic.html
generic.jsonp
generic.pdf

controller/
appadmin.py

static/
css/*
images/*
js/*

You can do this like that :

From web2py/applications

cp -R welcome/static/* YOURAPP/static/
cp welcome/controllers/appadmin.py  YOURAPP/controllers/
cp welcome/views/* test_copy_file/views/

Watch out the last command will override the layout.html...

Richard



On Thu, Oct 25, 2012 at 12:33 PM, Richard Vézina 
ml.richard.vez...@gmail.com wrote:

 appadmin.html to

 And by the way you should update :

 All files from static/

 all generic files form views/

 Make sure you backup you app before, so you can revert if you brake
 something.

 If you have modify layout.html you will have to compare what change in the
 new layout.html and replace the element in your own layout.html

 Richard

 On Thu, Oct 25, 2012 at 12:25 PM, lyn2py lyn...@gmail.com wrote:

 Good point. I will update and try it later. I need to replace appadmin.py
 only?

 Thanks Richard.

 --






-- 





[web2py] bug in admin

2012-10-24 Thread Jose
Hi,

the admin of the trunk version has a bug.

File /usr/home/jose/web2py/gluon/languages.py, line 161, in read_dict_aux
e = sys.exc_info()[1]
NameError: global name 'sys' is not defined


Jose

-- 





Re: [web2py] Bug With CSV Export and import

2012-10-12 Thread Hassan Alnatour
Dear Massimo , 

i want to upgrade , but i have that problem with the login i told you about 
, that we didnt solve yet !! Please Help me 

https://groups.google.com/forum/?hl=enfromgroups=#!search/Login$20error$20in$20the$20new$20web2py/web2py/mfbktvZp9jQ/f4fvRke5NAAJ

Best Regards, 


On Wednesday, October 10, 2012 3:18:07 PM UTC+3, Massimo Di Pierro wrote:

 There are bugs in the export/import functions in 1.99.4. It is almost one 
 year old. You should upgrade before we can help you.

 On Wednesday, 10 October 2012 01:58:26 UTC-5, Hassan Alnatour wrote:

 Dear Massimo, 

 i have web2py 
 Version 1.99.4 (2011-12-14 14:46:14) stable

 i opend the dal.py and this is what i have in there : 

  def import_from_csv_file(self, ifile, id_map=None, null='NULL',
  unique='uuid', *args, **kwargs):
 if id_map is None: id_map={}
 for line in ifile:
 line = line.strip()
 if not line:
 continue
 elif line == 'END':
 return
 elif not line.startswith('TABLE ') or not line[6:] in 
 self.tables:
 raise SyntaxError, 'invalid file format'
 else:
 tablename = line[6:]
 self[tablename].import_from_csv_file(ifile, id_map, null,
  unique, *args, 
 **kwargs)



 Regards, 


 --






-- 





Re: [web2py] Bug With CSV Export and import

2012-10-12 Thread Massimo Di Pierro
Any chance I see your application? It could be a bug in web2py but it could 
a bug in your app. I cannot say.

On Friday, 12 October 2012 01:59:49 UTC-5, Hassan Alnatour wrote:

 Dear Massimo , 

 i want to upgrade , but i have that problem with the login i told you 
 about , that we didnt solve yet !! Please Help me 


 https://groups.google.com/forum/?hl=enfromgroups=#!search/Login$20error$20in$20the$20new$20web2py/web2py/mfbktvZp9jQ/f4fvRke5NAAJ

 Best Regards, 


 On Wednesday, October 10, 2012 3:18:07 PM UTC+3, Massimo Di Pierro wrote:

 There are bugs in the export/import functions in 1.99.4. It is almost one 
 year old. You should upgrade before we can help you.

 On Wednesday, 10 October 2012 01:58:26 UTC-5, Hassan Alnatour wrote:

 Dear Massimo, 

 i have web2py 
 Version 1.99.4 (2011-12-14 14:46:14) stable

 i opend the dal.py and this is what i have in there : 

  def import_from_csv_file(self, ifile, id_map=None, null='NULL',
  unique='uuid', *args, **kwargs):
 if id_map is None: id_map={}
 for line in ifile:
 line = line.strip()
 if not line:
 continue
 elif line == 'END':
 return
 elif not line.startswith('TABLE ') or not line[6:] in 
 self.tables:
 raise SyntaxError, 'invalid file format'
 else:
 tablename = line[6:]
 self[tablename].import_from_csv_file(ifile, id_map, null,
  unique, *args, 
 **kwargs)



 Regards, 


 --






-- 





Re: [web2py] Bug With CSV Export and import

2012-10-12 Thread Hassan Alnatour
Dear Massimo , 

The error is happening to all my applications ,  after i use the new web2py 
the login in all my websites start giving me the error massage i showed you 
, but when i use web2py 1.99.2 everything is working fine , so from where 
do you want me to start the search  ,  now for the csv problem i cant just 
use the new import / export function and add the, to the dal of the old 
web2py ? 

Regards,

On Friday, October 12, 2012 4:46:50 PM UTC+3, Massimo Di Pierro wrote:

 Any chance I see your application? It could be a bug in web2py but it 
 could a bug in your app. I cannot say.

 On Friday, 12 October 2012 01:59:49 UTC-5, Hassan Alnatour wrote:

 Dear Massimo , 

 i want to upgrade , but i have that problem with the login i told you 
 about , that we didnt solve yet !! Please Help me 


 https://groups.google.com/forum/?hl=enfromgroups=#!search/Login$20error$20in$20the$20new$20web2py/web2py/mfbktvZp9jQ/f4fvRke5NAAJ

 Best Regards, 


 On Wednesday, October 10, 2012 3:18:07 PM UTC+3, Massimo Di Pierro wrote:

 There are bugs in the export/import functions in 1.99.4. It is almost 
 one year old. You should upgrade before we can help you.

 On Wednesday, 10 October 2012 01:58:26 UTC-5, Hassan Alnatour wrote:

 Dear Massimo, 

 i have web2py 
 Version 1.99.4 (2011-12-14 14:46:14) stable

 i opend the dal.py and this is what i have in there : 

  def import_from_csv_file(self, ifile, id_map=None, null='NULL',
  unique='uuid', *args, **kwargs):
 if id_map is None: id_map={}
 for line in ifile:
 line = line.strip()
 if not line:
 continue
 elif line == 'END':
 return
 elif not line.startswith('TABLE ') or not line[6:] in 
 self.tables:
 raise SyntaxError, 'invalid file format'
 else:
 tablename = line[6:]
 self[tablename].import_from_csv_file(ifile, id_map, 
 null,
  unique, *args, 
 **kwargs)



 Regards, 


 --






-- 





Re: [web2py] Bug With CSV Export and import

2012-10-12 Thread Richard Vézina
Depending of your backend, for example with postgres :

pg_dump --attribute-inserts
--file=/whereYouWantToPutTheFile/dbName_with_inserts_commands_and_blobs_dump_`date
+%Y-%m-%d_%H-%M-%S`.gz --compress=9 --role=roleName --username=postgres
dbName

From the command line.

Or you may also use pgAdmin.

Once you have the file you can just open it (depend how big is you
database) or pg_restore it (if to big to open it in a editor).


Richard

On Wed, Oct 10, 2012 at 3:00 AM, hasan alnator
halna...@gardeniatelco.comwrote:

 Dear Simon,

 What i use the ids in my tables  so the ids changed , who can i export and
 import data in backup/restore mechanism as you said above ?

 can you give me an example ?

 regards,

 On Wed, Oct 10, 2012 at 1:58 AM, hasan alnator halna...@gardeniatelco.com
  wrote:

 Dear Massimo,

 i have web2py
 Version 1.99.4 (2011-12-14 14:46:14) stable

 i opend the dal.py and this is what i have in there :

  def import_from_csv_file(self, ifile, id_map=None, null='NULL',
  unique='uuid', *args, **kwargs):
 if id_map is None: id_map={}
 for line in ifile:
 line = line.strip()
 if not line:
 continue
 elif line == 'END':
 return
 elif not line.startswith('TABLE ') or not line[6:] in
 self.tables:
 raise SyntaxError, 'invalid file format'
 else:
 tablename = line[6:]
 self[tablename].import_from_csv_file(ifile, id_map, null,
  unique, *args,
 **kwargs)



 Regards,


 --





  --





-- 





Re: [web2py] Bug With CSV Export and import

2012-10-12 Thread Hassan Alnatour
Dear Richerd ,

am moving my database from sqlite to mysql, what is the best way ? and 
keeping the ids the same 

regards,



On Friday, October 12, 2012 9:44:59 PM UTC+3, Richard wrote:

 Depending of your backend, for example with postgres :

 pg_dump --attribute-inserts 
 --file=/whereYouWantToPutTheFile/dbName_with_inserts_commands_and_blobs_dump_`date
  
 +%Y-%m-%d_%H-%M-%S`.gz --compress=9 --role=roleName --username=postgres 
 dbName

 From the command line.

 Or you may also use pgAdmin.

 Once you have the file you can just open it (depend how big is you 
 database) or pg_restore it (if to big to open it in a editor).


 Richard

 On Wed, Oct 10, 2012 at 3:00 AM, hasan alnator 
 haln...@gardeniatelco.comjavascript:
  wrote:

 Dear Simon,

 What i use the ids in my tables  so the ids changed , who can i export 
 and import data in backup/restore mechanism as you said above ? 

 can you give me an example ? 

 regards,

 On Wed, Oct 10, 2012 at 1:58 AM, hasan alnator 
 haln...@gardeniatelco.comjavascript:
  wrote:

 Dear Massimo, 

 i have web2py 
 Version 1.99.4 (2011-12-14 14:46:14) stable

 i opend the dal.py and this is what i have in there : 

  def import_from_csv_file(self, ifile, id_map=None, null='NULL',
  unique='uuid', *args, **kwargs):
 if id_map is None: id_map={}
 for line in ifile:
 line = line.strip()
 if not line:
 continue
 elif line == 'END':
 return
 elif not line.startswith('TABLE ') or not line[6:] in 
 self.tables:
 raise SyntaxError, 'invalid file format'
 else:
 tablename = line[6:]
 self[tablename].import_from_csv_file(ifile, id_map, null,
  unique, *args, 
 **kwargs)



 Regards, 


 --





  -- 
  
  
  




-- 





Re: [web2py] Bug With CSV Export and import

2012-10-12 Thread Richard Vézina
This could help you :

If you want to do it manually (if you dataset is not so big and you can
rapidly check the data integrity) :
http://sqlite.phxsoftware.com/forums/p/941/4725.aspx
Not recommended

Or automatically first answer:
http://stackoverflow.com/questions/18671/quick-easy-way-to-migrate-sqlite3-to-mysql
The DAL should help you doing just that.

Also, I remember having seen mail about UUID on the group that were talking
about this problem. Can't find the thread back and my memory may tricks me
:)

Hope it helps

Richard


On Fri, Oct 12, 2012 at 3:14 PM, Hassan Alnatour halna...@gardeniatelco.com
 wrote:

 Dear Richerd ,

 am moving my database from sqlite to mysql, what is the best way ? and
 keeping the ids the same

 regards,



 On Friday, October 12, 2012 9:44:59 PM UTC+3, Richard wrote:

 Depending of your backend, for example with postgres :

 pg_dump --attribute-inserts --file=/**whereYouWantToPutTheFile/**
 dbName_with_inserts_commands_**and_blobs_dump_`date
 +%Y-%m-%d_%H-%M-%S`.gz --compress=9 --role=roleName --username=postgres
 dbName

 From the command line.

 Or you may also use pgAdmin.

 Once you have the file you can just open it (depend how big is you
 database) or pg_restore it (if to big to open it in a editor).


 Richard

 On Wed, Oct 10, 2012 at 3:00 AM, hasan alnator haln...@gardeniatelco.com
  wrote:

 Dear Simon,

 What i use the ids in my tables  so the ids changed , who can i export
 and import data in backup/restore mechanism as you said above ?

 can you give me an example ?

 regards,

 On Wed, Oct 10, 2012 at 1:58 AM, hasan alnator 
 haln...@gardeniatelco.com wrote:

 Dear Massimo,

 i have web2py
 Version 1.99.4 (2011-12-14 14:46:14) stable

 i opend the dal.py and this is what i have in there :

  def import_from_csv_file(self, ifile, id_map=None, null='NULL',
  unique='uuid', *args, **kwargs):
 if id_map is None: id_map={}
 for line in ifile:
 line = line.strip()
 if not line:
 continue
 elif line == 'END':
 return
 elif not line.startswith('TABLE ') or not line[6:] in
 self.tables:
 raise SyntaxError, 'invalid file format'
 else:
 tablename = line[6:]
 self[tablename].import_from_**csv_file(ifile, id_map,
 null,
  unique, *args,
 **kwargs)



 Regards,


 --





  --





  --





-- 





Re: [web2py] Bug With CSV Export and import

2012-10-10 Thread hasan alnator
Dear Massimo,

i have web2py
Version 1.99.4 (2011-12-14 14:46:14) stable

i opend the dal.py and this is what i have in there :

 def import_from_csv_file(self, ifile, id_map=None, null='NULL',
 unique='uuid', *args, **kwargs):
if id_map is None: id_map={}
for line in ifile:
line = line.strip()
if not line:
continue
elif line == 'END':
return
elif not line.startswith('TABLE ') or not line[6:] in
self.tables:
raise SyntaxError, 'invalid file format'
else:
tablename = line[6:]
self[tablename].import_from_csv_file(ifile, id_map, null,
 unique, *args,
**kwargs)



Regards,


 --





-- 





Re: [web2py] Bug With CSV Export and import

2012-10-10 Thread hasan alnator
Dear Simon,

What i use the ids in my tables  so the ids changed , who can i export and
import data in backup/restore mechanism as you said above ?

can you give me an example ?

regards,

On Wed, Oct 10, 2012 at 1:58 AM, hasan alnator
halna...@gardeniatelco.comwrote:

 Dear Massimo,

 i have web2py
 Version 1.99.4 (2011-12-14 14:46:14) stable

 i opend the dal.py and this is what i have in there :

  def import_from_csv_file(self, ifile, id_map=None, null='NULL',
  unique='uuid', *args, **kwargs):
 if id_map is None: id_map={}
 for line in ifile:
 line = line.strip()
 if not line:
 continue
 elif line == 'END':
 return
 elif not line.startswith('TABLE ') or not line[6:] in
 self.tables:
 raise SyntaxError, 'invalid file format'
 else:
 tablename = line[6:]
 self[tablename].import_from_csv_file(ifile, id_map, null,
  unique, *args,
 **kwargs)



 Regards,


 --






-- 





Re: [web2py] Bug With CSV Export and import

2012-10-10 Thread Massimo Di Pierro
There are bugs in the export/import functions in 1.99.4. It is almost one 
year old. You should upgrade before we can help you.

On Wednesday, 10 October 2012 01:58:26 UTC-5, Hassan Alnatour wrote:

 Dear Massimo, 

 i have web2py 
 Version 1.99.4 (2011-12-14 14:46:14) stable

 i opend the dal.py and this is what i have in there : 

  def import_from_csv_file(self, ifile, id_map=None, null='NULL',
  unique='uuid', *args, **kwargs):
 if id_map is None: id_map={}
 for line in ifile:
 line = line.strip()
 if not line:
 continue
 elif line == 'END':
 return
 elif not line.startswith('TABLE ') or not line[6:] in 
 self.tables:
 raise SyntaxError, 'invalid file format'
 else:
 tablename = line[6:]
 self[tablename].import_from_csv_file(ifile, id_map, null,
  unique, *args, 
 **kwargs)



 Regards, 


 --






-- 





[web2py] Bug With CSV Export and import

2012-10-09 Thread Hassan Alnatour
Dear ALL , 

when exporting all the tables as CSV , the csv changes the ids to the order 
of the recorders , this is now right , what can i do to fix this , i want 
to move the data with the same ids 

regards,

-- 





Re: [web2py] Bug With CSV Export and import

2012-10-09 Thread hasan alnator
Dear ALL ,

i reviewed the CSV files the exports seems fine but when importing the data
the ids are the order of the data inserted  , how can we fix this ?

Best Regards,
Hasan alnatour

On Tue, Oct 9, 2012 at 6:12 PM, Hassan Alnatour
halna...@gardeniatelco.comwrote:

 Dear ALL ,

 when exporting all the tables as CSV , the csv changes the ids to the
 order of the recorders , this is now right , what can i do to fix this , i
 want to move the data with the same ids

 regards,

 --





-- 





Re: [web2py] Bug With CSV Export and import

2012-10-09 Thread Massimo Di Pierro
Not sure I understand the problem. How would you like it to work?

On Tuesday, 9 October 2012 10:17:50 UTC-5, Hassan Alnatour wrote:

 Dear ALL , 

 i reviewed the CSV files the exports seems fine but when importing the 
 data the ids are the order of the data inserted  , how can we fix this ?

 Best Regards,
 Hasan alnatour

 On Tue, Oct 9, 2012 at 6:12 PM, Hassan Alnatour 
 haln...@gardeniatelco.comjavascript:
  wrote:

 Dear ALL , 

 when exporting all the tables as CSV , the csv changes the ids to the 
 order of the recorders , this is now right , what can i do to fix this , i 
 want to move the data with the same ids 

 regards,

 -- 
  
  
  




-- 





Re: [web2py] Bug With CSV Export and import

2012-10-09 Thread hasan alnator
Dear Massimo ,

what i want to do is , i have am moving a database using CSV and when i do
that the Ids change  , cuz its auto generated  i think , what can i do to
solve this problem  , when i move my database the ids changes witch means
that everything will change  , how  can i fix this problem ? and why is not
copying the data as is ?

Thank you massimo ..

Regards,

On Tue, Oct 9, 2012 at 6:55 PM, Massimo Di Pierro 
massimo.dipie...@gmail.com wrote:

 Not sure I understand the problem. How would you like it to work?


 On Tuesday, 9 October 2012 10:17:50 UTC-5, Hassan Alnatour wrote:

 Dear ALL ,

 i reviewed the CSV files the exports seems fine but when importing the
 data the ids are the order of the data inserted  , how can we fix this ?

 Best Regards,
 Hasan alnatour


 On Tue, Oct 9, 2012 at 6:12 PM, Hassan Alnatour 
 haln...@gardeniatelco.com wrote:

 Dear ALL ,

 when exporting all the tables as CSV , the csv changes the ids to the
 order of the recorders , this is now right , what can i do to fix this , i
 want to move the data with the same ids

 regards,

 --





  --





-- 





Re: [web2py] Bug With CSV Export and import

2012-10-09 Thread Massimo Di Pierro
I understand. It can be done but how depends on details.
Do you use appadmin for import export or the API? Do you do it one table at 
the time or do you export import the whole db?

On Tuesday, 9 October 2012 12:01:45 UTC-5, Hassan Alnatour wrote:

 Dear Massimo , 

 what i want to do is , i have am moving a database using CSV and when i do 
 that the Ids change  , cuz its auto generated  i think , what can i do to 
 solve this problem  , when i move my database the ids changes witch means 
 that everything will change  , how  can i fix this problem ? and why is not 
 copying the data as is ?

 Thank you massimo ..

 Regards, 

 On Tue, Oct 9, 2012 at 6:55 PM, Massimo Di Pierro 
 massimo@gmail.comjavascript:
  wrote:

 Not sure I understand the problem. How would you like it to work?


 On Tuesday, 9 October 2012 10:17:50 UTC-5, Hassan Alnatour wrote:

 Dear ALL , 

 i reviewed the CSV files the exports seems fine but when importing the 
 data the ids are the order of the data inserted  , how can we fix this ?

 Best Regards,
 Hasan alnatour


 On Tue, Oct 9, 2012 at 6:12 PM, Hassan Alnatour 
 haln...@gardeniatelco.com wrote:

 Dear ALL , 

 when exporting all the tables as CSV , the csv changes the ids to the 
 order of the recorders , this is now right , what can i do to fix this , i 
 want to move the data with the same ids 

 regards,

 -- 
  
  
  


  -- 
  
  
  




-- 





Re: [web2py] Bug With CSV Export and import

2012-10-09 Thread hasan alnator
Dear Massimo,

*i used this to export from the first application : *

def export():
db.export_to_csv_file(open('all10082012.csv', 'wb'))
return locals()



*and to import to the other application i use this :*

def importcsv():
db.import_from_csv_file(open('all10082012.csv', 'rb'))
return locals()


Best Regards,
Hassan alnatour



On Tue, Oct 9, 2012 at 10:18 PM, Massimo Di Pierro 
massimo.dipie...@gmail.com wrote:

 I understand. It can be done but how depends on details.
 Do you use appadmin for import export or the API? Do you do it one table
 at the time or do you export import the whole db?


 On Tuesday, 9 October 2012 12:01:45 UTC-5, Hassan Alnatour wrote:

 Dear Massimo ,

 what i want to do is , i have am moving a database using CSV and when i
 do that the Ids change  , cuz its auto generated  i think , what can i do
 to solve this problem  , when i move my database the ids changes witch
 means that everything will change  , how  can i fix this problem ? and why
 is not copying the data as is ?

 Thank you massimo ..

 Regards,


 On Tue, Oct 9, 2012 at 6:55 PM, Massimo Di Pierro 
 massimo@gmail.comwrote:

 Not sure I understand the problem. How would you like it to work?


 On Tuesday, 9 October 2012 10:17:50 UTC-5, Hassan Alnatour wrote:

 Dear ALL ,

 i reviewed the CSV files the exports seems fine but when importing the
 data the ids are the order of the data inserted  , how can we fix this ?

 Best Regards,
 Hasan alnatour


 On Tue, Oct 9, 2012 at 6:12 PM, Hassan Alnatour 
 haln...@gardeniatelco.com wrote:

 Dear ALL ,

 when exporting all the tables as CSV , the csv changes the ids to the
 order of the recorders , this is now right , what can i do to fix this , i
 want to move the data with the same ids

 regards,

 --





  --





  --





-- 





  1   2   3   >