Re: [web2py] Re: how to disable "register" item from the default upper right-hand side dropdown

2015-12-24 Thread Alex Glaros
now I want to return to default registration

When I disable this:

##auth.settings.actions_disabled = ['register'] ## auto-register disabled; 
forces users to go through my custom registration

I get error after clicking on "Sign up" link

 'password' is not in listVersionweb2py™Version 
2.12.2-stable+timestamp.2015.08.09.14.29.44PythonPython 2.7.9: 
C:\alex\alt_web2py\web2py\web2py.exe (prefix: C:\Python27)Traceback

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.

Traceback (most recent call last):
  File "C:\alex\alt_web2py\web2py\gluon\restricted.py", line 227, in restricted
exec ccode in environment
  File "C:/alex/alt_web2py/web2py/applications/ES1/controllers/default.py" 
, line 
7519, in 
  File "C:\alex\alt_web2py\web2py\gluon\globals.py", line 412, in 
self._caller = lambda f: f()
  File "C:/alex/alt_web2py/web2py/applications/ES1/controllers/default.py" 
, line 
401, in user
return dict(form=auth())
  File "C:\alex\alt_web2py\web2py\gluon\tools.py", line 1614, in __call__
return getattr(self, args[0])()
  File "C:\alex\alt_web2py\web2py\gluon\tools.py", line 2900, in register
k = self.settings.register_fields.index("password")
ValueError: 'password' is not in list

Error snapshot [image: help] 


('password' is not in list)

inspect attributes
Frames
   
   - 
   
   *File C:\alex\alt_web2py\web2py\gluon\restricted.py in restricted at 
   line 227* code arguments variables
   - 
   
   *File C:\alex\alt_web2py\web2py\applications\ES1\controllers\default.py 
   in  at line 7519* code arguments variables
   - 
   
   *File C:\alex\alt_web2py\web2py\gluon\globals.py in  at line 412*
code arguments variables
   - 
   
   *File C:\alex\alt_web2py\web2py\applications\ES1\controllers\default.py 
   in user at line 401* code arguments variables
   Code listing
   
   396.
   397.
   398.
   399.
   400.
   401.
   
   402.
   403.
   404.
   405.
   
   use @auth.requires_login()
   @auth.requires_membership('group name')
   @auth.requires_permission('read','table name',record_id)
   to decorate functions that need access control
   """
   return dict(form=auth())
   
   
   
   
   - 
   
   *File C:\alex\alt_web2py\web2py\gluon\tools.py in __call__ at line 1614* 
   code arguments variables
   - 
   
   *File C:\alex\alt_web2py\web2py\gluon\tools.py in register at line 2900* 
   code arguments variables
   Function argument list
   
   (self=, next='/ES1/default/index', 
   onvalidation=[], onaccept=[], log='User %(id)s Registered')
   Code listing
   
   2895.
   2896.
   2897.
   2898.
   2899.
   2900.
   
   2901.
   2902.
   2903.
   2904.
   
   passfield = self.settings.password_field
   formstyle = self.settings.formstyle
   if self.settings.register_verify_password:
   if self.settings.register_fields == None:
   self.settings.register_fields = [f.name for f in table_user 
if f.writable]
   k = self.settings.register_fields.index("password")
   
   self.settings.register_fields.insert(k+1, "password_two")
   extra_fields = [
   Field("password_two", "password", requires=IS_EQUAL_TO(
   request.post_vars.get(passfield, None),
   
   Variablesself.settings.register_fields['first_name', 'last_name', 
   'email', 'personMiddleName', 'currentPosition', 'pastPosition', 
   'education', 'summarySelfDescription', 'keyWords', 'thumbnail', 
   'timeZonePreference', 'publicContactInfo', 'motto', 'favoriteLandingPage']
   kundefinedselfself.settingsself.settings.register_fields.index
   


thanks

Alex Glaros

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


[web2py] Re: web2py 2.13.3 is OUT

2015-12-24 Thread greenpoise
I get this error upon restarting web2py after update:

Traceback (most recent call last):
  File "Applications/web2py/web2py.py", line 6, in 
import gluon.widget
  File "/home/danel/Applications/web2py/gluon/widget.py", line 26, in 

import gluon.main as main
  File "/home/danel/Applications/web2py/gluon/main.py", line 121, in 

raise RuntimeError("Cannot determine web2py version")
RuntimeError: Cannot determine web2py version




On Thursday, December 24, 2015 at 7:21:42 AM UTC-8, Massimo Di Pierro wrote:
>
> web2py 2.13.3 is out. MERRY CHRISTMAS EVERYBODY!!!
>
> It contains some bug fixes for bugs introduced in 2.13.1-2 and most 
> importantly it contains experimental support for JWT. Here is how it works:
>
> 1) instantiate auth with
>
> auth = Auth(db, jwt = {'secret_key':'secret'})
>
> where 'secret' is your own secret string. 
>
> 2) Secorate functions that require login but should accept the JWT 
> token credentials:
>
> @auth.allows_jwt()
> @auth.requires_login()
> def myapi(): return 'hello %s' % auth.user.email
> 
> Notice jwt is allowed but not required. if user is logged in, 
> myapi is accessible.
>
> 3) Use it!
> Now API users can obtain a token with
>
> http://.../app/default/user/jwt?username=...=
>
> (returns json object with a token attribute)
> API users can refresh an existing token with
>
> http://.../app/default/user/jwt?token=...
>
> they can authenticate themselves when calling http:/.../myapi by 
> injecting a header
>
> Authorization: Bearer 
>
> Any additional attributes in the jwt argument of Auth() below:
>
>auth = Auth(db, jwt = {...})
>
> are passed to the constructor of class AuthJWT. Look there for 
> documentation.
>
> Thanks Niphlod again for implementing this. 
> Please help us check it so we will declare it stable in the next release.
>
> Massimo
>
>
>

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


[web2py] Re: web2py 2.13.3 is OUT

2015-12-24 Thread Seth J
Definitely something has gone awry there. I replaced "ldap_auth.py" and 
"ldap_auth.pyc" from the 2.12.3 version and it works again.


On Thursday, December 24, 2015 at 12:11:27 PM UTC-5, Seth J wrote:
>
> Hi Massimo,
>
> I just upgraded from 2.9.5 and it seemed to kill my LDAP authorization:
>
>  invalid syntax (ldap_auth.py, line 435)
> Versionweb2py™Version 2.13.3-stable+timestamp.2015.12.24.15.09.20PythonPython 
> 2.6.6: /usr/bin/python (prefix: /usr)Traceback
>
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
> 10.
> 11.
> 12.
>
> Traceback (most recent call last):
>   File "/opt/web-apps/web2py/gluon/restricted.py", line 227, in restricted
> exec ccode in environment
>   File "/opt/web-apps/web2py/applications/CongressionalFoxPro/models/db.py" 
> ,
>  line 81, in 
> from gluon.contrib.login_methods.ldap_auth import ldap_auth
>   File "/opt/web-apps/web2py/gluon/custom_import.py", line 108, in 
> custom_importer
> return NATIVE_IMPORTER(name, globals, locals, fromlist, level)
>   File "/opt/web-apps/web2py/gluon/contrib/login_methods/ldap_auth.py", line 
> 435
> update_or_insert_values = {f: update_or_insert_values[f] for f in fields}
>^
> SyntaxError: invalid syntax
>
> Error snapshot [image: help] 
> 
>
> (invalid syntax (ldap_auth.py, line 435))
>
> On Thursday, December 24, 2015 at 10:21:42 AM UTC-5, Massimo Di Pierro 
> wrote:
>>
>> web2py 2.13.3 is out. MERRY CHRISTMAS EVERYBODY!!!
>>
>> It contains some bug fixes for bugs introduced in 2.13.1-2 and most 
>> importantly it contains experimental support for JWT. Here is how it works:
>>
>> 1) instantiate auth with
>>
>> auth = Auth(db, jwt = {'secret_key':'secret'})
>>
>> where 'secret' is your own secret string. 
>>
>> 2) Secorate functions that require login but should accept the 
>> JWT token credentials:
>>
>> @auth.allows_jwt()
>> @auth.requires_login()
>> def myapi(): return 'hello %s' % auth.user.email
>> 
>> Notice jwt is allowed but not required. if user is logged in, 
>> myapi is accessible.
>>
>> 3) Use it!
>> Now API users can obtain a token with
>>
>> http://.../app/default/user/jwt?username=...=
>>
>> (returns json object with a token attribute)
>> API users can refresh an existing token with
>>
>> http://.../app/default/user/jwt?token=...
>>
>> they can authenticate themselves when calling http:/.../myapi by 
>> injecting a header
>>
>> Authorization: Bearer 
>>
>> Any additional attributes in the jwt argument of Auth() below:
>>
>>auth = Auth(db, jwt = {...})
>>
>> are passed to the constructor of class AuthJWT. Look there for 
>> documentation.
>>
>> Thanks Niphlod again for implementing this. 
>> Please help us check it so we will declare it stable in the next release.
>>
>> Massimo
>>
>>
>>

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


[web2py] Re: Adding item in Google Drive installed apps collection

2015-12-24 Thread Anthony
Is this related to web2py somehow?

On Thursday, December 24, 2015 at 3:36:42 PM UTC-5, Ramkrishan Bhatt wrote:
>
> Hi Every One, 
>  I need help in Google Drive API:-
>  http://stackoverflow.com/q/34457604/2390012?stw=2
>
> I have an app in Google market place which is tool to make multiple 
> customized application for consumer by him self.
>
> My question is, can we add item in installed app list by coding ? For 
> example: one admin user installed my app called *MyBiz*, Now through 
> *MyBiz* he has created apps like *MyApp1* ,*MyApp2*. Now i have to add 
> both app in Installed app list like in below pic.
>
> Adding Item in installed apps list 
>
> Can anyone tell me the solution asap ?
>

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


[web2py] Re: Adding item in Google Drive installed apps collection

2015-12-24 Thread Anthony
No problem, just wondering of there's anything web2py can do specifically in 
this case.

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


[web2py] Re: Oracle drivers.

2015-12-24 Thread Michael Messmer
I think it is too.  Just made some progress.  And a bunch of VM's later:

Error ticket for "test"
Ticket ID
172.21.140.228.2015-12-24.14-29-42.af6f82d8-d7b2-4a69-8409-1cf04d67c994

 Failure to connect, tried 5 times: 
Traceback (most recent call last): File 
"/opt/www-data/web2py/gluon/packages/dal/pydal/base.py", line 446, in 
__init__ self._adapter = ADAPTERS[self._dbname](**kwargs) File 
"/opt/www-data/web2py/gluon/packages/dal/pydal/adapters/base.py", line 60, 
in __call__ obj = super(AdapterMeta, cls).__call__(*args, **kwargs) File 
"/opt/www-data/web2py/gluon/packages/dal/pydal/adapters/oracle.py", line 
118, in __init__ if do_connect: self.reconnect() File 
"/opt/www-data/web2py/gluon/packages/dal/pydal/connection.py", line 125, in 
reconnect self.connection = f() File 
"/opt/www-data/web2py/gluon/packages/dal/pydal/adapters/oracle.py", line 
116, in connector return self.driver.connect(uri,**driver_args) 
DatabaseError: ORA-12514: TNS:listener does not currently know of service 
requested in connect descriptor

Version
web2py™ Version 2.13.2-stable+timestamp.2015.12.18.11.00.46
Traceback (most recent call last):
  File "/opt/www-data/web2py/gluon/restricted.py", line 227, in restricted
exec ccode in environment
  File "/opt/www-data/web2py/applications/test/models/db.py", line 20, in 

db = DAL(myconf.take('db.uri'), pool_size=myconf.take('db.pool_size', 
cast=int), check_reserved=['all'])
  File "/opt/www-data/web2py/gluon/packages/dal/pydal/base.py", line 174, 
in __call__
obj = super(MetaDAL, cls).__call__(*args, **kwargs)
  File "/opt/www-data/web2py/gluon/packages/dal/pydal/base.py", line 473, 
in __init__
"Failure to connect, tried %d times:\n%s" % (attempts, tb)
RuntimeError: Failure to connect, tried 5 times:
Traceback (most recent call last):
  File "/opt/www-data/web2py/gluon/packages/dal/pydal/base.py", line 446, 
in __init__
self._adapter = ADAPTERS[self._dbname](**kwargs)
  File "/opt/www-data/web2py/gluon/packages/dal/pydal/adapters/base.py", 
line 60, in __call__
obj = super(AdapterMeta, cls).__call__(*args, **kwargs)
  File "/opt/www-data/web2py/gluon/packages/dal/pydal/adapters/oracle.py", 
line 118, in __init__
if do_connect: self.reconnect()
  File "/opt/www-data/web2py/gluon/packages/dal/pydal/connection.py", line 
125, in reconnect
self.connection = f()
  File "/opt/www-data/web2py/gluon/packages/dal/pydal/adapters/oracle.py", 
line 116, in connector
return self.driver.connect(uri,**driver_args)
DatabaseError: ORA-12514: TNS:listener does not currently know of service 
requested in connect descriptor




On Friday, December 4, 2015 at 11:03:12 PM UTC-8, Rakesh Singh wrote:
>
> My guess is that this is a permission issue.
> cx_Oracle may be accessible to Web2Py, but the Oracle libraries may be 
> readable by your nginx user
>
> What are the permissions your ORACLE_HOME directory and files within it?
>
> /usr/include/oracle/11.1
>
>
> On Wednesday, 7 October 2015 00:37:10 UTC+2, Michael M wrote:
>>
>> 2.12.3-stable+timestamp.2015.08.19.00.18.03
>> (Running on Apache/2.4.16 (Fedora) OpenSSL/1.0.1k-fips mod_wsgi/4.4.8 
>> Python/2.7.10, Python 2.7.10)
>>
>> So "import cx_Oracle" works in python console but when I tried using it 
>> in web2py it errors out.  (Cannot import 
>> module 'applications.test2.modules.cx_Oracle')
>>
>> the only thing i have found is that the file structure looks different 
>> from cx_Oracle to another import i use.
>>
>> pysnmp works in web2py and straight python:
>> >>> import pysnmp
>> >>> pysnmp.__file__
>> '/usr/lib/python2.7/site-packages/pysnmp/__init__.pyc'
>>
>> cx_Oracle doesnt work in web2py but works in py files.
>> >>> import cx_Oracle
>> >>> cx_Oracle.__file__
>> '/usr/lib/python2.7/site-packages/cx_Oracle.so'
>>
>>
>> the only difference I saw was that its a .so file instead of __init__.pyc
>>
>> Any thoughts.  Trying to get this to work in Fedora 22.  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] Re: Adding item in Google Drive installed apps collection

2015-12-24 Thread Ramkrishan Bhatt
Not Exatly but application developed in web2py appengine need to put in 
Marketplace. Since many user use google apps so i asked, forgive me if i did 
something wrong.

-- 
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] Re: how to disable "register" item from the default upper right-hand side dropdown

2015-12-24 Thread Alex Glaros
never mind ... it works now

I had password readable = False

##db.auth_user.password.readable = db.auth_user.password.writable = False


-- 
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] Re: web2py 2.13.3 is OUT

2015-12-24 Thread Ovidio Marinho
+1 testing





   [image: http://itjp.net.br] 
 http://itjp.net.b r
  *Ovidio Marinho Falcao Neto*
 ovidio...@gmail.com
Brasil


2015-12-24 15:11 GMT-02:00 Seth J :

> Hi Massimo,
>
> I just upgraded and it seemed to kill my LDAP authorization:
>
>  invalid syntax (ldap_auth.py, line 435)
> Versionweb2py™Version 2.13.3-stable+timestamp.2015.12.24.15.09.20PythonPython
> 2.6.6: /usr/bin/python (prefix: /usr)Traceback
>
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
> 10.
> 11.
> 12.
>
> Traceback (most recent call last):
>   File "/opt/web-apps/web2py/gluon/restricted.py", line 227, in restricted
> exec ccode in environment
>   File "/opt/web-apps/web2py/applications/CongressionalFoxPro/models/db.py" 
> ,
>  line 81, in 
> from gluon.contrib.login_methods.ldap_auth import ldap_auth
>   File "/opt/web-apps/web2py/gluon/custom_import.py", line 108, in 
> custom_importer
> return NATIVE_IMPORTER(name, globals, locals, fromlist, level)
>   File "/opt/web-apps/web2py/gluon/contrib/login_methods/ldap_auth.py", line 
> 435
> update_or_insert_values = {f: update_or_insert_values[f] for f in fields}
>^
> SyntaxError: invalid syntax
>
> Error snapshot [image: help]
> 
>
> (invalid syntax (ldap_auth.py, line 435))
>
> On Thursday, December 24, 2015 at 10:21:42 AM UTC-5, Massimo Di Pierro
> wrote:
>>
>> web2py 2.13.3 is out. MERRY CHRISTMAS EVERYBODY!!!
>>
>> It contains some bug fixes for bugs introduced in 2.13.1-2 and most
>> importantly it contains experimental support for JWT. Here is how it works:
>>
>> 1) instantiate auth with
>>
>> auth = Auth(db, jwt = {'secret_key':'secret'})
>>
>> where 'secret' is your own secret string.
>>
>> 2) Secorate functions that require login but should accept the
>> JWT token credentials:
>>
>> @auth.allows_jwt()
>> @auth.requires_login()
>> def myapi(): return 'hello %s' % auth.user.email
>>
>> Notice jwt is allowed but not required. if user is logged in,
>> myapi is accessible.
>>
>> 3) Use it!
>> Now API users can obtain a token with
>>
>> http://.../app/default/user/jwt?username=...=
>>
>> (returns json object with a token attribute)
>> API users can refresh an existing token with
>>
>> http://.../app/default/user/jwt?token=...
>>
>> they can authenticate themselves when calling http:/.../myapi by
>> injecting a header
>>
>> Authorization: Bearer 
>>
>> Any additional attributes in the jwt argument of Auth() below:
>>
>>auth = Auth(db, jwt = {...})
>>
>> are passed to the constructor of class AuthJWT. Look there for
>> documentation.
>>
>> Thanks Niphlod again for implementing this.
>> Please help us check it so we will declare it stable in the next release.
>>
>> Massimo
>>
>>
>> --
> 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] Adding item in Google Drive installed apps collection

2015-12-24 Thread Ramkrishan Bhatt
Hi Every One, 
 I need help in Google Drive API:-
 http://stackoverflow.com/q/34457604/2390012?stw=2

I have an app in Google market place which is tool to make multiple 
customized application for consumer by him self.

My question is, can we add item in installed app list by coding ? For 
example: one admin user installed my app called *MyBiz*, Now through *MyBiz* he 
has created apps like *MyApp1* ,*MyApp2*. Now i have to add both app in 
Installed app list like in below pic.

Adding Item in installed apps list 

Can anyone tell me the solution asap ?

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


[web2py] Re: form works, but i am unable to view database due to type error?

2015-12-24 Thread Anthony
I don't think this has anything to do with the wizard. Looks like all of 
your numeric fields are defined as "string" types (which is the default 
when you don't specify the "type" argument); yet your "formatter" method is 
expecting float values to be coming from the database.

Anthony

On Thursday, December 24, 2015 at 11:05:41 AM UTC-5, aetagot...@gmail.com 
wrote:
>
> Using the form wizard, user inputs values into fields and upon completion 
> of form is redirected to sqlform.grid page, where the uploaded file can be 
> viewed, this all works. The problem is when I try to view the database I 
> get this error:
>
>
>
> *def formatter(self,value): return '%.2f' % valueTypeError: float 
> argument required, not str*
>
> This was not a problem until I implemented the form wizard, I can't figure 
> out what is causing it. 
>
>
> *Models:*from decimal import *
>
> class IS_MYDECIMAL(IS_DECIMAL_IN_RANGE):
>  def formatter(self,value): return '%.2f' % value
>
> db.define_table('tablecosts',
> Field('yourname', 'string', requires=IS_NOT_EMPTY(), label='Your 
> name:'),
> Field('thedate', 'date', requires=IS_DATE(format='%m-%d-%Y', 
> error_message=T('Enter date in the format: mm-dd-')), label='Report 
> date:'),
> Field('num1', requires=IS_MYDECIMAL(None,None),
>  label='first:'),
> Field('num2', requires=IS_MYDECIMAL(None,None),
>  label='second:'),
> Field('num3', requires=IS_MYDECIMAL(None,None),
>  label='third:'),
> Field('num4', requires=IS_MYDECIMAL(None,None),
>  label='fourth:'),
> ##there are a lot more fields but this is the gist of it, to keep the post 
> short
> Field('costs_file', 'upload', compute=costs_calc),
> Field('created_by', 'reference auth_user',
>   default=auth.user_id, readable=False, writable=False))
>
>
>
>
> *Controller:*
>
>
> @auth.requires_login()
> def tablecosts():
> STEPS = {0: ('yourname', 'thedate'), # fields for 1st page
>  1: ('num1', 'num2', 'num3'), # fields for 2nd page
>  2: ('num4'), #fields for 3rd
>  ##this goes on for a few pages with more fields
>  6: URL('costslist')} # url when wizard completed
> step = int(request.args(0) or 0)
> if not step in STEPS: redirect(URL(args=0))
> fields = STEPS[step]
> print "Fields: " + str(fields) + " Step " + str(step)
> if step==0: 
> session.tablecosts = {}
> if isinstance(fields,tuple):
> form = SQLFORM.factory(*[f for f in db.tablecosts if f.name in 
> fields])
> if form.accepts(request,session):
> session.tablecosts.update(form.vars)
> redirect(URL(args=step+1))
> else:
> db.tablecosts.insert(**session.tablecosts)
> session.flash = T('form completed')
> redirect(fields)
> ...

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


[web2py] Re: web2py 2.13.3 is OUT

2015-12-24 Thread Seth J
Hi Massimo,

I just upgraded and it seemed to kill my LDAP authorization:

 invalid syntax (ldap_auth.py, line 435)
Versionweb2py™Version 2.13.3-stable+timestamp.2015.12.24.15.09.20PythonPython 
2.6.6: /usr/bin/python (prefix: /usr)Traceback

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.

Traceback (most recent call last):
  File "/opt/web-apps/web2py/gluon/restricted.py", line 227, in restricted
exec ccode in environment
  File "/opt/web-apps/web2py/applications/CongressionalFoxPro/models/db.py" 
,
 line 81, in 
from gluon.contrib.login_methods.ldap_auth import ldap_auth
  File "/opt/web-apps/web2py/gluon/custom_import.py", line 108, in 
custom_importer
return NATIVE_IMPORTER(name, globals, locals, fromlist, level)
  File "/opt/web-apps/web2py/gluon/contrib/login_methods/ldap_auth.py", line 435
update_or_insert_values = {f: update_or_insert_values[f] for f in fields}
   ^
SyntaxError: invalid syntax

Error snapshot [image: help] 


(invalid syntax (ldap_auth.py, line 435))

On Thursday, December 24, 2015 at 10:21:42 AM UTC-5, Massimo Di Pierro 
wrote:
>
> web2py 2.13.3 is out. MERRY CHRISTMAS EVERYBODY!!!
>
> It contains some bug fixes for bugs introduced in 2.13.1-2 and most 
> importantly it contains experimental support for JWT. Here is how it works:
>
> 1) instantiate auth with
>
> auth = Auth(db, jwt = {'secret_key':'secret'})
>
> where 'secret' is your own secret string. 
>
> 2) Secorate functions that require login but should accept the JWT 
> token credentials:
>
> @auth.allows_jwt()
> @auth.requires_login()
> def myapi(): return 'hello %s' % auth.user.email
> 
> Notice jwt is allowed but not required. if user is logged in, 
> myapi is accessible.
>
> 3) Use it!
> Now API users can obtain a token with
>
> http://.../app/default/user/jwt?username=...=
>
> (returns json object with a token attribute)
> API users can refresh an existing token with
>
> http://.../app/default/user/jwt?token=...
>
> they can authenticate themselves when calling http:/.../myapi by 
> injecting a header
>
> Authorization: Bearer 
>
> Any additional attributes in the jwt argument of Auth() below:
>
>auth = Auth(db, jwt = {...})
>
> are passed to the constructor of class AuthJWT. Look there for 
> documentation.
>
> Thanks Niphlod again for implementing this. 
> Please help us check it so we will declare it stable in the next release.
>
> Massimo
>
>
>

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


[web2py] Re: conditional fields with jquery and form fields

2015-12-24 Thread Anthony
It's JavaScript, so put it with your JS files and be sure to load it on the 
page. You'll need to refer to the relevant documentation regarding how to use 
it.

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] Re: Problems with user_signature=True in URL( )

2015-12-24 Thread Anthony
I cannot reproduce the problem with the code you have shown (works fine for 
me). The problem probably lies elsewhere. Maybe attach a minimal app that 
demonstrates the problem (along with the login credentials of a dummy user 
for testing purposes).

Anthony

On Thursday, December 24, 2015 at 6:04:11 AM UTC-5, Jes M wrote:
>
> Hi:
>
> I've been browsing google but I can't manage the code to works with other 
> solutions I've found. Here it goes the issue:
>
> controller:
>
> btn_edit = lambda row: A(T("Editar"), _href=URL('manage_user', args=[
> row.id],user_signature=True))
> links = [ btn_edit ]
> ..
> ..
> adminusers_grid = SQLFORM.grid(query = adminusers_query,
>fields = fields,
>links = links,
>field_id = db.auth_user.id,
>orderby = (db.auth_user.last_name),
>create=False,
>deletable=False,
>editable=False,
>details=False,
>searchable=True,
>showbuttontext=False,
>user_signature=True,
>csv=False,
>formstyle="div",
>args=request.args[:1],
>paginate=10
>)
> 
> 
>
> @auth.requires_signature()
> @auth.requires_membership("admin")
> def manage_user():
> user_id = request.args(0) or 
> redirect(URL('useradministration',user_signature=True))
> ...
> ...
>
>
>
> I always get "Not Authozied" when I click in the URL passed as link to the 
> SQLFORM.grid. I've tested:
>
> with and without "args=request.args[:1],"  (same behaviour)
> with and without "hash_vars=True" in @auth.requires_signature() (same 
> result, not authorized)
>
>
> But if I build the URL without args, for example:
>
> btn_edit = lambda row: A(T("Editar"), _href=URL('manage_user', 
> user_signature=True))
>
> Then the URL works and it goes to 'manage_user'.
>
> I can't figure out how to modify the code in order I can pass an argument 
> to manage_user() usign digital signatures.
>
> Any idea?
>
> Thanks in advance,
>
> Jes
>

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


[web2py] Re: Problems with user_signature=True in URL( )

2015-12-24 Thread Anthony
On Thursday, December 24, 2015 at 9:24:48 AM UTC-5, Massimo Di Pierro wrote:
>
> I am sorry, I cannot figure out exactly  what you are doing but I see a 
> possible problem. You cannot use @auth.requires_signature() and 
> SQLFORM.grid(user_signature=True) at the same time because the grid would 
> use its own URL signature and that is not the same expected by the 
> decorator.
>

Note, he is not decorating the grid action with @auth.requires_signature -- 
he is creating signed links to a completely different action, which is 
decorated (and should work fine).

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] Re: form works, but i am unable to view database due to type error?

2015-12-24 Thread aetagothno
I added field type as double for those fields and that fixed, it's just 
strange that it didn't catch that error before.

Thank you

On Thursday, December 24, 2015 at 9:07:12 AM UTC-8, Anthony wrote:
>
> I don't think this has anything to do with the wizard. Looks like all of 
> your numeric fields are defined as "string" types (which is the default 
> when you don't specify the "type" argument); yet your "formatter" method is 
> expecting float values to be coming from the database.
>
> Anthony
>
> On Thursday, December 24, 2015 at 11:05:41 AM UTC-5, aetag...@gmail.com 
>  wrote:
>>
>> Using the form wizard, user inputs values into fields and upon completion 
>> of form is redirected to sqlform.grid page, where the uploaded file can be 
>> viewed, this all works. The problem is when I try to view the database I 
>> get this error:
>>
>>
>>
>> *def formatter(self,value): return '%.2f' % valueTypeError: float 
>> argument required, not str*
>>
>> This was not a problem until I implemented the form wizard, I can't 
>> figure out what is causing it. 
>>
>>
>> *Models:*from decimal import *
>>
>> class IS_MYDECIMAL(IS_DECIMAL_IN_RANGE):
>>  def formatter(self,value): return '%.2f' % value
>>
>> db.define_table('tablecosts',
>> Field('yourname', 'string', requires=IS_NOT_EMPTY(), label='Your 
>> name:'),
>> Field('thedate', 'date', requires=IS_DATE(format='%m-%d-%Y', 
>> error_message=T('Enter date in the format: mm-dd-')), label='Report 
>> date:'),
>> Field('num1', requires=IS_MYDECIMAL(None,None),
>>  label='first:'),
>> Field('num2', requires=IS_MYDECIMAL(None,None),
>>  label='second:'),
>> Field('num3', requires=IS_MYDECIMAL(None,None),
>>  label='third:'),
>> Field('num4', requires=IS_MYDECIMAL(None,None),
>>  label='fourth:'),
>> ##there are a lot more fields but this is the gist of it, to keep the 
>> post short
>> Field('costs_file', 'upload', compute=costs_calc),
>> Field('created_by', 'reference auth_user',
>>   default=auth.user_id, readable=False, writable=False))
>>
>>
>>
>>
>> *Controller:*
>>
>>
>> @auth.requires_login()
>> def tablecosts():
>> STEPS = {0: ('yourname', 'thedate'), # fields for 1st page
>>  1: ('num1', 'num2', 'num3'), # fields for 2nd page
>>  2: ('num4'), #fields for 3rd
>>  ##this goes on for a few pages with more fields
>>  6: URL('costslist')} # url when wizard completed
>> step = int(request.args(0) or 0)
>> if not step in STEPS: redirect(URL(args=0))
>> fields = STEPS[step]
>> print "Fields: " + str(fields) + " Step " + str(step)
>> if step==0: 
>> session.tablecosts = {}
>> if isinstance(fields,tuple):
>> form = SQLFORM.factory(*[f for f in db.tablecosts if f.name in 
>> fields])
>> if form.accepts(request,session):
>> session.tablecosts.update(form.vars)
>> redirect(URL(args=step+1))
>> else:
>> db.tablecosts.insert(**session.tablecosts)
>> session.flash = T('form completed')
>> redirect(fields)
>> ...
>
>

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


[web2py] Re: conditional fields with jquery and form fields

2015-12-24 Thread aetagothno
How do I use that jquery form wizard plugin? I extracted it into my modules 
folder but it does not work, I also tried extracting it in my static/js 

-- 
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] form works, but i am unable to view database due to type error?

2015-12-24 Thread aetagothno
Using the form wizard, user inputs values into fields and upon completion 
of form is redirected to sqlform.grid page, where the uploaded file can be 
viewed, this all works. The problem is when I try to view the database I 
get this error:



*def formatter(self,value): return '%.2f' % valueTypeError: float 
argument required, not str*

This was not a problem until I implemented the form wizard, I can't figure 
out what is causing it. 


*Models:*from decimal import *

class IS_MYDECIMAL(IS_DECIMAL_IN_RANGE):
 def formatter(self,value): return '%.2f' % value

db.define_table('tablecosts',
Field('yourname', 'string', requires=IS_NOT_EMPTY(), label='Your 
name:'),
Field('thedate', 'date', requires=IS_DATE(format='%m-%d-%Y', 
error_message=T('Enter date in the format: mm-dd-')), label='Report 
date:'),
Field('num1', requires=IS_MYDECIMAL(None,None),
 label='first:'),
Field('num2', requires=IS_MYDECIMAL(None,None),
 label='second:'),
Field('num3', requires=IS_MYDECIMAL(None,None),
 label='third:'),
Field('num4', requires=IS_MYDECIMAL(None,None),
 label='fourth:'),
##there are a lot more fields but this is the gist of it, to keep the post 
short
Field('costs_file', 'upload', compute=costs_calc),
Field('created_by', 'reference auth_user',
  default=auth.user_id, readable=False, writable=False))




*Controller:*


@auth.requires_login()
def tablecosts():
STEPS = {0: ('yourname', 'thedate'), # fields for 1st page
 1: ('num1', 'num2', 'num3'), # fields for 2nd page
 2: ('num4'), #fields for 3rd
 ##this goes on for a few pages with more fields
 6: URL('costslist')} # url when wizard completed
step = int(request.args(0) or 0)
if not step in STEPS: redirect(URL(args=0))
fields = STEPS[step]
print "Fields: " + str(fields) + " Step " + str(step)
if step==0: 
session.tablecosts = {}
if isinstance(fields,tuple):
form = SQLFORM.factory(*[f for f in db.tablecosts if f.name in 
fields])
if form.accepts(request,session):
session.tablecosts.update(form.vars)
redirect(URL(args=step+1))
else:
db.tablecosts.insert(**session.tablecosts)
session.flash = T('form completed')
redirect(fields)
return dict(form=form,step=step)

def done():
return dict(message="End of form", back=A("New form", 
_href=URL("costslist")))

@auth.requires_login()
def costslist():
grid = SQLFORM.grid(db.tablecosts.created_by == auth.user_id,
fields=[db.tablecosts.yourname, 
db.tablecosts.thedate, db.tablecosts.costs_file])
return locals()




If the user enters 10, it becomes 10.00 and if they enter 5.00 it stays 
5.00. When I open the uploaded file,  it works and shows this. However, 
since implementing form wizard it does not allow me to view db because of 
it, I am confused because it worked fine before.

-- 
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] Problems with user_signature=True in URL( )

2015-12-24 Thread Jes M
Hi:

I've been browsing google but I can't manage the code to works with other 
solutions I've found. Here it goes the issue:

controller:

btn_edit = lambda row: A(T("Editar"), _href=URL('manage_user', 
args=[row.id],user_signature=True))
links = [ btn_edit ]
..
..
adminusers_grid = SQLFORM.grid(query = adminusers_query,
   fields = fields,
   links = links,
   field_id = db.auth_user.id,
   orderby = (db.auth_user.last_name),
   create=False,
   deletable=False,
   editable=False,
   details=False,
   searchable=True,
   showbuttontext=False,
   user_signature=True,
   csv=False,
   formstyle="div",
   args=request.args[:1],
   paginate=10
   )



@auth.requires_signature()
@auth.requires_membership("admin")
def manage_user():
user_id = request.args(0) or 
redirect(URL('useradministration',user_signature=True))
...
...



I always get "Not Authozied" when I click in the URL passed as link to the 
SQLFORM.grid. I've tested:

with and without "args=request.args[:1],"  (same behaviour)
with and without "hash_vars=True" in @auth.requires_signature() (same 
result, not authorized)


But if I build the URL without args, for example:

btn_edit = lambda row: A(T("Editar"), _href=URL('manage_user', 
user_signature=True))

Then the URL works and it goes to 'manage_user'.

I can't figure out how to modify the code in order I can pass an argument 
to manage_user() usign digital signatures.

Any idea?

Thanks in advance,

Jes

-- 
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] Possibilità di interazione tra Applicazione Mobile e applicazione principale e viste grafiche miglio

2015-12-24 Thread Alessandro Leonetti
Buongiorno, 
sto sviluppando un sito web dinamico ai fini di portare a termine il mio 
stage universitario.
Ho 2 domande, le ultime due cose che mi mancano per completare il tutto 
diciamo!

1) Web2py mi consente in qualche modo di far comunicare la mia applicazione 
principale con un'altra mobile sviluppata solo per migliorare l'interfaccia 
grafica su dispositivi mobili?
(ES. Se inserisco un oggetto tramite un form dall'applicazione mobile, 
quell'oggetto mi viene salvato automaticamente nel database centrale?) Se 
esiste un meccanismo del genere potreste inviarmi link o spiegazioni varie?

2) Vorrei migliorare le viste degli oggetti restituiti dalle query nelle 
pagine web del sito in modo che non si vedano male con tutto il codice 
python a seguire.
C'è un modo o una vista comune diciamo, per migliorare la visualizzazione 
degli oggetti del database?
Ho trovato alcune videoguide ma sembra una cosa lunga e vorrei impiegare 
meno tempo per sistemare la grafica se possibile.

Ringrazio tutti coloro che risponderanno,
ed auguro Buon Natale e Buone Feste a tutti gli utenti del forum.

Saluti,
Alessandro

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


[web2py] Re: Possibilità di interazione tra Applicazione Mobile e applicazione principale e viste grafiche miglio

2015-12-24 Thread Massimo Di Pierro


On Thursday, 24 December 2015 08:17:41 UTC-6, Alessandro Leonetti wrote:
>
> Buongiorno, 
> sto sviluppando un sito web dinamico ai fini di portare a termine il mio 
> stage universitario.
> Ho 2 domande, le ultime due cose che mi mancano per completare il tutto 
> diciamo!
>
> 1) Web2py mi consente in qualche modo di far comunicare la mia 
> applicazione principale con un'altra mobile sviluppata solo per migliorare 
> l'interfaccia grafica su dispositivi mobili?
> (ES. Se inserisco un oggetto tramite un form dall'applicazione mobile, 
> quell'oggetto mi viene salvato automaticamente nel database centrale?) Se 
> esiste un meccanismo del genere potreste inviarmi link o spiegazioni varie?
>

Ti serve una API. SQLFORM e' solo per generate forms HTML, ma puoi usare

@request.restful()
def api():
 def GET(id=None):
  if not a: return db(db.yourtable).select().as_json()
  else:  return db(db.yourtableid.id==id).select().as_json()
 def POST(a,b,c):
  id = db.table.insert(a=a,b=b,c=c)
  return json.dumps({'id':id})
 return locals()



> 2) Vorrei migliorare le viste degli oggetti restituiti dalle query nelle 
> pagine web del sito in modo che non si vedano male con tutto il codice 
> python a seguire.
> C'è un modo o una vista comune diciamo, per migliorare la visualizzazione 
> degli oggetti del database?
>

A cosa ti riferisci. Puoi fare un esempio?
 

> Ho trovato alcune videoguide ma sembra una cosa lunga e vorrei impiegare 
> meno tempo per sistemare la grafica se possibile.
>
> Ringrazio tutti coloro che risponderanno,
> ed auguro Buon Natale e Buone Feste a tutti gli utenti del forum.
>
> Saluti,
> Alessandro
>

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


[web2py] Re: Problems with user_signature=True in URL( )

2015-12-24 Thread Massimo Di Pierro
I am sorry, I cannot figure out exactly  what you are doing but I see a 
possible problem. You cannot use @auth.requires_signature() and 
SQLFORM.grid(user_signature=True) at the same time because the grid would 
use its own URL signature and that is not the same expected by the 
decorator.

On Thursday, 24 December 2015 05:04:11 UTC-6, Jes M wrote:
>
> Hi:
>
> I've been browsing google but I can't manage the code to works with other 
> solutions I've found. Here it goes the issue:
>
> controller:
>
> btn_edit = lambda row: A(T("Editar"), _href=URL('manage_user', args=[
> row.id],user_signature=True))
> links = [ btn_edit ]
> ..
> ..
> adminusers_grid = SQLFORM.grid(query = adminusers_query,
>fields = fields,
>links = links,
>field_id = db.auth_user.id,
>orderby = (db.auth_user.last_name),
>create=False,
>deletable=False,
>editable=False,
>details=False,
>searchable=True,
>showbuttontext=False,
>user_signature=True,
>csv=False,
>formstyle="div",
>args=request.args[:1],
>paginate=10
>)
> 
> 
>
> @auth.requires_signature()
> @auth.requires_membership("admin")
> def manage_user():
> user_id = request.args(0) or 
> redirect(URL('useradministration',user_signature=True))
> ...
> ...
>
>
>
> I always get "Not Authozied" when I click in the URL passed as link to the 
> SQLFORM.grid. I've tested:
>
> with and without "args=request.args[:1],"  (same behaviour)
> with and without "hash_vars=True" in @auth.requires_signature() (same 
> result, not authorized)
>
>
> But if I build the URL without args, for example:
>
> btn_edit = lambda row: A(T("Editar"), _href=URL('manage_user', 
> user_signature=True))
>
> Then the URL works and it goes to 'manage_user'.
>
> I can't figure out how to modify the code in order I can pass an argument 
> to manage_user() usign digital signatures.
>
> Any idea?
>
> Thanks in advance,
>
> Jes
>

-- 
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] web2py 2.13.3 is OUT

2015-12-24 Thread Massimo Di Pierro
web2py 2.13.3 is out. MERRY CHRISTMAS EVERYBODY!!!

It contains some bug fixes for bugs introduced in 2.13.1-2 and most 
importantly it contains experimental support for JWT. Here is how it works:

1) instantiate auth with

auth = Auth(db, jwt = {'secret_key':'secret'})

where 'secret' is your own secret string. 

2) Secorate functions that require login but should accept the JWT 
token credentials:

@auth.allows_jwt()
@auth.requires_login()
def myapi(): return 'hello %s' % auth.user.email

Notice jwt is allowed but not required. if user is logged in, myapi 
is accessible.

3) Use it!
Now API users can obtain a token with

http://.../app/default/user/jwt?username=...=

(returns json object with a token attribute)
API users can refresh an existing token with

http://.../app/default/user/jwt?token=...

they can authenticate themselves when calling http:/.../myapi by 
injecting a header

Authorization: Bearer 

Any additional attributes in the jwt argument of Auth() below:

   auth = Auth(db, jwt = {...})

are passed to the constructor of class AuthJWT. Look there for 
documentation.

Thanks Niphlod again for implementing this. 
Please help us check it so we will declare it stable in the next release.

Massimo


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


[web2py] Re: Possibilità di interazione tra Applicazione Mobile e applicazione principale e viste grafiche miglio

2015-12-24 Thread Massimo Di Pierro


On Thursday, 24 December 2015 08:52:56 UTC-6, Alessandro Leonetti wrote:
>
> Ciao Massimo e grazie per la risposta e soprattutto per aver messo a 
> disposizione degli utenti Web2py, è davvero utilissima ed immediata
>
> Dunque la prima richiesta vorrei chiederti dove va messo il pezzo di 
> codice che mi hai allegato, andrà inserito nel codice dell'applicazione 
> mobile immagino giusto? In modo che vada a comunicare col database centrale?
>

It codice dell'esempio e' una action quindi va in un controller, esempio 
default.py.
 

>
> Per la seconda richiesta ti allego un paio di screen d'esempio:
> La query mi restituisce i risultati della prima figura, e mi va benissimo 
> così, ma quando clicco su una delle voci restituite, la vista per il 
> singolo oggetto è quella del secondo screen. Volevo chiederti se c'è una 
> vista generica magari solo da importare per visualizzare in modo ordinato 
> le informazioni dell'oggetto.
>

In assenza di view, usa views/generic.html e quindi tu puoi editare questo 
file, ma non lo raccomando. E' meglio che crei la tua view per l'action per 
cui ti serve.
 

>
> Intanto ti auguro Buone Feste!!! Grazie di tutto!
>
>
> Il giorno giovedì 24 dicembre 2015 15:28:45 UTC+1, Massimo Di Pierro ha 
> scritto:
>>
>>
>>
>> On Thursday, 24 December 2015 08:17:41 UTC-6, Alessandro Leonetti wrote:
>>>
>>> Buongiorno, 
>>> sto sviluppando un sito web dinamico ai fini di portare a termine il mio 
>>> stage universitario.
>>> Ho 2 domande, le ultime due cose che mi mancano per completare il tutto 
>>> diciamo!
>>>
>>> 1) Web2py mi consente in qualche modo di far comunicare la mia 
>>> applicazione principale con un'altra mobile sviluppata solo per migliorare 
>>> l'interfaccia grafica su dispositivi mobili?
>>> (ES. Se inserisco un oggetto tramite un form dall'applicazione mobile, 
>>> quell'oggetto mi viene salvato automaticamente nel database centrale?) Se 
>>> esiste un meccanismo del genere potreste inviarmi link o spiegazioni varie?
>>>
>>
>> Ti serve una API. SQLFORM e' solo per generate forms HTML, ma puoi usare
>>
>> @request.restful()
>> def api():
>>  def GET(id=None):
>>   if not a: return db(db.yourtable).select().as_json()
>>   else:  return db(db.yourtableid.id==id).select().as_json()
>>  def POST(a,b,c):
>>   id = db.table.insert(a=a,b=b,c=c)
>>   return json.dumps({'id':id})
>>  return locals()
>>
>>
>>
>>> 2) Vorrei migliorare le viste degli oggetti restituiti dalle query nelle 
>>> pagine web del sito in modo che non si vedano male con tutto il codice 
>>> python a seguire.
>>> C'è un modo o una vista comune diciamo, per migliorare la 
>>> visualizzazione degli oggetti del database?
>>>
>>
>> A cosa ti riferisci. Puoi fare un esempio?
>>  
>>
>>> Ho trovato alcune videoguide ma sembra una cosa lunga e vorrei impiegare 
>>> meno tempo per sistemare la grafica se possibile.
>>>
>>> Ringrazio tutti coloro che risponderanno,
>>> ed auguro Buon Natale e Buone Feste a tutti gli utenti del forum.
>>>
>>> Saluti,
>>> Alessandro
>>>
>>

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


[web2py] Re: conditional fields with jquery and form fields

2015-12-24 Thread aetagothno
I looked into the form wizard, and this worked great for what I was trying 
to do. Thank you!

On Wednesday, December 23, 2015 at 12:54:01 PM UTC-8, aetag...@gmail.com 
wrote:
>
> I have a form that is rather long, therefore I want to split it into 
> sections.
> I am doing this with jQuery conditional fields in forms. 
>
> The first 5 fields appear, once the user enters input for the fields and 
> then they click on a checkbox, the filled fields are then hidden and the 
> next 5 questions are unhidden, and this is repeated every 5 questions. 
>
> I was wondering if there is a way to show the fields again that were 
> hidden after clicking the checkbox, in case the user unchecks the box in an 
> attempt to view the previous 5 questions again. Because what happens now 
> when the box is unchecked is that it hides the fields that it revealed but 
> doesn't show the previous 5 fields unless you uncheck and recheck the box.
>
>
> Also, I am basically repeating the following code from the book:
>
> {{extend 'layout.html'}}
> {{=form}}
> 
> jQuery(document).ready(function(){
>if(jQuery('#taxpayer_married').prop('checked'))
> jQuery('#taxpayer_spouse_name__row').show();
>else jQuery('#taxpayer_spouse_name__row').hide();
>jQuery('#taxpayer_married').change(function(){
> if(jQuery('#taxpayer_married').prop('checked'))
> jQuery('#taxpayer_spouse_name__row').show();
> else jQuery('#taxpayer_spouse_name__row').hide();});
> });
> 
>
>
> I have 3 seperate sections of the form, each section has it's own script, 
> showing and hiding 5 form fields within each. I don't understand jQuery all 
> that well, is there a way to make it less repetitive? I'm over 160 lines of 
> code for just showing and hiding fields, I'm hoping there is a better way.
>
>
>
>

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


[web2py] Re: Possibilità di interazione tra Applicazione Mobile e applicazione principale e viste grafiche miglio

2015-12-24 Thread Alessandro Leonetti
Ciao Massimo e grazie per la risposta e soprattutto per aver messo a 
disposizione degli utenti Web2py, è davvero utilissima ed immediata

Dunque la prima richiesta vorrei chiederti dove va messo il pezzo di codice 
che mi hai allegato, andrà inserito nel codice dell'applicazione mobile 
immagino giusto? In modo che vada a comunicare col database centrale?

Per la seconda richiesta ti allego un paio di screen d'esempio:
La query mi restituisce i risultati della prima figura, e mi va benissimo 
così, ma quando clicco su una delle voci restituite, la vista per il 
singolo oggetto è quella del secondo screen. Volevo chiederti se c'è una 
vista generica magari solo da importare per visualizzare in modo ordinato 
le informazioni dell'oggetto.

Intanto ti auguro Buone Feste!!! Grazie di tutto!


Il giorno giovedì 24 dicembre 2015 15:28:45 UTC+1, Massimo Di Pierro ha 
scritto:
>
>
>
> On Thursday, 24 December 2015 08:17:41 UTC-6, Alessandro Leonetti wrote:
>>
>> Buongiorno, 
>> sto sviluppando un sito web dinamico ai fini di portare a termine il mio 
>> stage universitario.
>> Ho 2 domande, le ultime due cose che mi mancano per completare il tutto 
>> diciamo!
>>
>> 1) Web2py mi consente in qualche modo di far comunicare la mia 
>> applicazione principale con un'altra mobile sviluppata solo per migliorare 
>> l'interfaccia grafica su dispositivi mobili?
>> (ES. Se inserisco un oggetto tramite un form dall'applicazione mobile, 
>> quell'oggetto mi viene salvato automaticamente nel database centrale?) Se 
>> esiste un meccanismo del genere potreste inviarmi link o spiegazioni varie?
>>
>
> Ti serve una API. SQLFORM e' solo per generate forms HTML, ma puoi usare
>
> @request.restful()
> def api():
>  def GET(id=None):
>   if not a: return db(db.yourtable).select().as_json()
>   else:  return db(db.yourtableid.id==id).select().as_json()
>  def POST(a,b,c):
>   id = db.table.insert(a=a,b=b,c=c)
>   return json.dumps({'id':id})
>  return locals()
>
>
>
>> 2) Vorrei migliorare le viste degli oggetti restituiti dalle query nelle 
>> pagine web del sito in modo che non si vedano male con tutto il codice 
>> python a seguire.
>> C'è un modo o una vista comune diciamo, per migliorare la visualizzazione 
>> degli oggetti del database?
>>
>
> A cosa ti riferisci. Puoi fare un esempio?
>  
>
>> Ho trovato alcune videoguide ma sembra una cosa lunga e vorrei impiegare 
>> meno tempo per sistemare la grafica se possibile.
>>
>> Ringrazio tutti coloro che risponderanno,
>> ed auguro Buon Natale e Buone Feste a tutti gli utenti del forum.
>>
>> Saluti,
>> Alessandro
>>
>

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