[web2py] Pydal validator IS_NOT_IN_DB fails in auth.user table

2021-05-06 Thread Jacinto Parga
Hello, 

This is an old issue not solved yet.

I think it is an issue that comes from previous version. It has to do with 
IS_NOT_IN_DB validator and auth. It worked in 2.17.2 version with no problem

Traceback (most recent call last): 
 File 
"/base/data/home/apps/e~x-/218.431301544681755891/gluon/restricted.py",
 
line 219, in restricted exec(ccode, environment) 
 File 
"/base/data/home/apps/e-myapp-dir/218.431301544681755891/applications/myapp/controllers/mycontroller.py",
 
line 199, in  
 File 
"/base/data/home/apps/e-myapp-dir/218.431301544681755891/gluon/globals.py", 
line 430, in  self._caller = lambda f: f() 
 File 
"/base/data/home/apps/e-myapp-dir/218.431301544681755891/gluon/tools.py", 
line 3875, in f return action(*a, **b) 
 File 
"/base/data/home/apps/e-myapp-dir/218.431301544681755891/applications/myapp/controllers/mycrontroller.py",
 
line 110, in crear_usuario if form.accepts(request.vars, session): 
 File 
"/base/data/home/apps/e-myapp-dir/218.431301544681755891/gluon/sqlhtml.py", 
line 1790, in accepts **kwargs 
 File 
"/base/data/home/apps/e-myapp-dir/218.431301544681755891/gluon/html.py", 
line 2162, in accepts status = self._traverse(status, hideerror) 
 File 
"/base/data/home/apps/e-myapp-dir/218.431301544681755891/gluon/html.py", 
line 921, in _traverse newstatus = c._traverse(status, hideerror) and 
newstatus 
  File 
"/base/data/home/apps/e-myapp-dir/218.431301544681755891/gluon/html.py", 
line 921, in _traverse newstatus = c._traverse(status, hideerror) and 
newstatus 
 File 
"/base/data/home/apps/e-myapp-dir/218.431301544681755891/gluon/html.py", 
line 921, in _traverse newstatus = c._traverse(status, hideerror) and 
newstatus 
 File 
"/base/data/home/apps/e-myapp-dir/218.431301544681755891/gluon/html.py", 
line 921, in _traverse newstatus = c._traverse(status, hideerror) and 
newstatus 
 File 
"/base/data/home/apps/e-myapp-dir/218.431301544681755891/gluon/html.py", 
line 928, in _traverse newstatus = self._validate() 
 File 
"/base/data/home/apps/e-myapp-dir/218.431301544681755891/gluon/html.py", 
line 1908, in _validate raise Exception(msg) 
Exception: Validation error, field:email 

This is the code of the controller where it breaks


form = SQLFORM(db.auth_user)
if form.accepts(request.vars, session):

It also fails in appadmin db.auth_user new record


-- 
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/763637e8-6e3f-4e64-b42b-338005c84505n%40googlegroups.com.


Re: [web2py] Re: Programatically create Row

2021-02-15 Thread Jacinto Parga
So, do you want to storage a dummy row to be proccessed in the same 
controler or to be passed to another controller or function?. I mean, if 
you want to use it in the same controller why not a local variable to 
storage it.. 

If you have used a SQLFORM. factory to get the values they are storaged in 
form.vars object.

What do you mean with a dummy row? Is it like a structure of a db row? 

El sábado, 13 de febrero de 2021 a las 17:45:09 UTC+1, david...@gmail.com 
escribió:

> Thanks for the suggestion. I don't need to create the form 
> programmatically - the factory is great for that. I've already got code to 
> create the form but want to create a dummy row on the server side to 
> populate a display example form. 
>
> Cheers, 
> David
>
> On Sat, 13 Feb 2021, 08:37 Jacinto Parga,  wrote:
>
>>
>> http://www.web2py.com/books/default/chapter/29/07/forms-and-validators#SQLFORM-factory
>>
>> El viernes, 12 de febrero de 2021 a las 18:26:42 UTC+1, 
>> david...@gmail.com escribió:
>>
>>> I have a controller that displays confidential data from a table but 
>>> want to be able to show the form publicly with some dummy data. The 
>>> controller makes use of field representation and references so I basically 
>>> need a Row.
>>>
>>> I can create the object I need using the table.insert() methods and then 
>>> db.rollback() to avoid committing the dummy data but is there a better 
>>> method. I've had a look at the internals of Row and suspect that trying to 
>>> create a Row object by hand would be pretty fraught, but is there a better 
>>> way than just using insert() and rollback()? It feels like using a 
>>> sledgehammer to crack a nut.
>>>
>>> Cheers,
>>> David
>>>
>> -- 
>> 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 a topic in the 
>> Google Groups "web2py-users" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/web2py/FSHPxYTxr24/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to 
>> web2py+un...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/web2py/5ce7ca44-d5d7-4854-96c9-99b78b14fcdcn%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/web2py/5ce7ca44-d5d7-4854-96c9-99b78b14fcdcn%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>

-- 
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/85137da9-e4a0-4fb0-9c7b-291fbb3c40a1n%40googlegroups.com.


[web2py] Re: Programatically create Row

2021-02-13 Thread Jacinto Parga
http://www.web2py.com/books/default/chapter/29/07/forms-and-validators#SQLFORM-factory

El viernes, 12 de febrero de 2021 a las 18:26:42 UTC+1, david...@gmail.com 
escribió:

> I have a controller that displays confidential data from a table but want 
> to be able to show the form publicly with some dummy data. The controller 
> makes use of field representation and references so I basically need a Row.
>
> I can create the object I need using the table.insert() methods and then 
> db.rollback() to avoid committing the dummy data but is there a better 
> method. I've had a look at the internals of Row and suspect that trying to 
> create a Row object by hand would be pretty fraught, but is there a better 
> way than just using insert() and rollback()? It feels like using a 
> sledgehammer to crack a nut.
>
> Cheers,
> David
>

-- 
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/5ce7ca44-d5d7-4854-96c9-99b78b14fcdcn%40googlegroups.com.


[web2py] Warning rdbms deprecation notice in GAE

2021-02-04 Thread Jacinto Parga
Hi, 

There is this warning in GAE deployment:

Please remove any imports of google.appengine.api.rdbms. First Generation 
Cloud SQL instances have been shut down, and rdbms.py will be removed in a 
future release. See: 
https://cloud.google.com/sql/docs/mysql/deprecation-notice

If you deploy using Datastore you don't need rdbms at all so I took this 
workaround:

In pydal _gae.py, line 15:

from google.appengine.api import namespace_manager #, rdbms

In pydal google.py lines 15, 16:
if gae:
from .._gae import ndb, namespace_manager, classobj, NDBPolyModel #, 
rdbms 

In pyday google.py lines 54, 55:
#def connector(self):
#   return rdbms.connect(**self.driver_args)

It obviously disable @adapters.register_for("google:sql") but if Datastore 
is used  there is no problem.


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


[web2py] Re: web2py 2.21.1 is OUT

2020-11-30 Thread Jacinto Parga
Hello, 

I think it is an issue that comes from previous version. It has to do with 
IS_NOT_IN_DB validator and auth. It worked in 2.17.2 version with no problem

Traceback (most recent call last): 
 File 
"/base/data/home/apps/e~canal-responsable-marcafranca/218.431301544681755891/gluon/restricted.py",
 
line 219, in restricted exec(ccode, environment) 
 File 
"/base/data/home/apps/e~canal-responsable-marcafranca/218.431301544681755891/applications/myapp/controllers/mycontroller.py",
 
line 199, in  
 File 
"/base/data/home/apps/e~canal-responsable-marcafranca/218.431301544681755891/gluon/globals.py",
 
line 430, in  self._caller = lambda f: f() 
 File 
"/base/data/home/apps/e~canal-responsable-marcafranca/218.431301544681755891/gluon/tools.py",
 
line 3875, in f return action(*a, **b) 
 File 
"/base/data/home/apps/e~canal-responsable-marcafranca/218.431301544681755891/applications/myapp/controllers/mycrontroller.py",
 
line 110, in crear_usuario if form.accepts(request.vars, session): 
 File 
"/base/data/home/apps/e~canal-responsable-marcafranca/218.431301544681755891/gluon/sqlhtml.py",
 
line 1790, in accepts **kwargs 
 File 
"/base/data/home/apps/e~canal-responsable-marcafranca/218.431301544681755891/gluon/html.py",
 
line 2162, in accepts status = self._traverse(status, hideerror) 
 File 
"/base/data/home/apps/e~canal-responsable-marcafranca/218.431301544681755891/gluon/html.py",
 
line 921, in _traverse newstatus = c._traverse(status, hideerror) and 
newstatus 
  File 
"/base/data/home/apps/e~canal-responsable-marcafranca/218.431301544681755891/gluon/html.py",
 
line 921, in _traverse newstatus = c._traverse(status, hideerror) and 
newstatus 
 File 
"/base/data/home/apps/e~canal-responsable-marcafranca/218.431301544681755891/gluon/html.py",
 
line 921, in _traverse newstatus = c._traverse(status, hideerror) and 
newstatus 
 File 
"/base/data/home/apps/e~canal-responsable-marcafranca/218.431301544681755891/gluon/html.py",
 
line 921, in _traverse newstatus = c._traverse(status, hideerror) and 
newstatus 
 File 
"/base/data/home/apps/e~canal-responsable-marcafranca/218.431301544681755891/gluon/html.py",
 
line 928, in _traverse newstatus = self._validate() 
 File 
"/base/data/home/apps/e~canal-responsable-marcafranca/218.431301544681755891/gluon/html.py",
 
line 1908, in _validate raise Exception(msg) 
Exception: Validation error, field:email 

This is the code of the controller where it breaks


form = SQLFORM(db.auth_user)
if form.accepts(request.vars, session):

It also fails in appadmin db.auth_user new record


El sábado, 28 de noviembre de 2020 a las 5:22:19 UTC+1, Massimo Di Pierro 
escribió:

>
> Hello everybody, 
>
> first of all my apologies to you all. I have been absent from this list 
> for some time, mostly because busy with py4web.
>
> I made a new release (2.21.1) of web2py which includes mostly small bug 
> fixes but no new features. Please report any problem.
>
> At this point web2py has been stable for long time so we are not planning 
> to add features.
>
> py4web on the other side is growing fast. It now has Auth, 
> internationalization, Form, Grid and it is 20x faster than wb2py. pyDAL 
> woks the in the same way as in web2py. I insist you should check it out and 
> consider moving you code. It is easy and we will help.
>
> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/2698dff8-00b2-4bf0-ae27-3a2f66774a54n%40googlegroups.com.


[web2py] Re: Anyone in or near Barcelona?

2020-10-17 Thread Jacinto Parga
I am based in Spain and have some experience with Web2py. Nowadays learning 
how to migrate them to Py4web. In no COVID context I travel sometimes to 
Barcelona. May be I can help.

El jueves, 15 de octubre de 2020 a las 14:43:10 UTC+2, 
i.r...@appichar.com.au escribió:

> Hi - I'm looking for someone based in or around Barcelona with 
> Python/web2py experience who might be able to help with a couple of 
> projects I've built / will be building in web2py (or maybe web3py).
>
> If you know of of anyone please feel free to forward. 
>
> Thanks
> Ian
>

-- 
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/86b40f50-51e8-417d-9b8c-58a5aaa7d309n%40googlegroups.com.


[web2py] Re: deploy web2py with gunicorn, Nginx y HTTPS

2020-09-13 Thread Jacinto Parga
Perfect. Gracias 


El sábado, 12 de septiembre de 2020 a las 17:10:10 UTC+2, cabildocl 
escribió:

> I wrote an article in Spanish on how to deploy web2py with https
>
>
> http://cabildocl.blogspot.com/2020/09/implementar-web2py-con-gunicorn-nginx-y.html
>
>
>

-- 
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/14f19b6e-07d0-4adb-b90c-04f73f88e11fn%40googlegroups.com.


[web2py] Re: Sending smses via my web2py

2020-08-05 Thread Jacinto Parga
I use https://www.messagebird.com/
It has a well documented api and works well with web2py
El miércoles, 5 de agosto de 2020 a las 20:58:51 UTC+2, Massimo Di Pierro 
escribió:

> That list of service providers is very old. I sugget you use twilio
>
>
> On Wednesday, 5 August 2020 02:14:11 UTC-7, mostwanted wrote:
>>
>>
>> I am failing to send smses with my app following the book example (
>> http://www.web2py.com/books/default/chapter/29/08/emails-and-sms#Emails-and-SMS)
>>  
>> which i felt was straight forward, is there something extra must include in 
>> my controller code?
>>
>> *MY CODE*
>> def send_sms():
>> from gluon.contrib.sms_utils import SMSCODES, sms_email
>> email = sms_email('+000 (00) 000-000','Orange')
>> mail.send(to=email, subject='sms test', message='testing testing 123'
>> )
>>
>> Regards
>>
>> Mostwanted
>>
>

-- 
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/f0324d71-58c7-4bac-91b3-96b77932bc0cn%40googlegroups.com.


Re: [web2py] pbkdf2_hmac error on PythonAnywhere

2020-06-05 Thread Jacinto Parga
Hi, 

I had the same error upgrading web2py to version 2.20.4

The python version in pythonanywhere was 2.7.6

Changing the python version to 3.5.2 solved it.

El martes, 2 de abril de 2019, 17:20:33 (UTC+2), Philip Kilner escribió:
>
> Since I asked the question, the ever-helpful Giles has popped up in the 
> forum at PythonAnywhere, and he tells me that they work off images, and 
> that mine was an old one - he's organising an update to the latest version, 
> which takes Python to 2.7.12,
>
> I suspect that if you are able to check your Python version, you will be 
> at 2.78 or later - I think I am the exception, by virtue of being on an 
> older image.
>
> --
>
> P
>
>

-- 
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/5c1f0d8c-770f-4d0f-bc17-14005185d4e9o%40googlegroups.com.


Re: [web2py] Re: RestAPI: how to restrict query results to data belonging to logged in user?

2020-05-28 Thread Jacinto Parga
Hello, 

yes you are right.

Are these tools not enough for the aproach of "scopes" 
http://web2py.com/books/default/chapter/29/09/access-control#Authorization
 and http://web2py.com/books/default/chapter/29/09/access-control#Decorators
 ?

I mean you are talking about allow certain users to certain information in 
some tables. You are talking about access control and permissions. 
Something like the example in the book:

Assuming the following definitions:

>>> from gluon.tools import Auth
>>> auth = Auth(db)
>>> auth.define_tables()
>>> secrets = db.define_table('secret_document', Field('body'))
>>> james_bond = db.auth_user.insert(first_name='James',
 last_name='Bond')

Here is an example:

>>> doc_id = db.secret_document.insert(body = 'top secret')
>>> agents = auth.add_group(role = 'Secret Agent')
>>> auth.add_membership(agents, james_bond)
>>> auth.add_permission(agents, 'read', secrets)
>>> print auth.has_permission('read', secrets, doc_id, james_bond)
True
>>> print auth.has_permission('update', secrets, doc_id, james_bond)
False


@auth.requires_permission('read', secrets)
def function_four():
return 'you can read secret documents'




El miércoles, 27 de mayo de 2020, 19:03:07 (UTC+2), Kevin Keller escribió:
>
> The "proper" way would be to define "scopes" in your application. Scopes 
> define who has access to which data. 
> You can also call it roles or tags or whatever. 
> Scopes is the term that is used by OAuth/OpenID connect, which is usually 
> used to secure APIs. 
>
> Normally you would get an OpenID (OIDC) ID Token as JWT when you login. 
> Once you have that you would read that tokens contents and look for the 
> scopes in the token and match those scopes with which the user shall access 
> your data.
> Similiar to what you did here with the workaround to match the user.id to 
> the data. 
> I suppose you can extend this examlple/workaround to used custom auth 
> fields or the roles fields provided by web2py. 
>
> Some applications dont use scopes but so called claims from the JWT token. 
> Claims is extra info about a user such as first, lastname phonenumber etc. 
> that can be extracted from the token. 
> They put user roles in the tokens claims and match them with the 
> applications rest api against the database. 
> Similair to what you did. 
>
> But claims are not supposed to be used for that normally, that is what 
> scopes are for. 
> Claims are just used to "contextualize" a reqiest for the API i.e. fetch 
> relevant information for the requestor if the requestor is for example from 
> Europe fetch all infos for Europeans from the database, 
> if from another continent, fetch other data. 
>
> I have not seen Web2py used in this way, but there you go. 
> Just though this info may be interesting. 
>
> I found this example / workaorund super useful. 
>
> Will also use it :). 
>
> Seems to just get the job done quickly. 
>
>
>
>
>
> On Wed, May 27, 2020 at 6:18 PM Jacinto Parga  > wrote:
>
>> Hello, 
>>
>> I used this workaround in a similar case:
>>
>> @auth.requires_login()
>> @request.restful()
>> def myapi():
>> def GET():
>> response.view = 'generic.json'
>> myreg = db(db.mytable.created_by==auth.user.id).select() # Maybe 
>> in your case mytable.user_id==auth.user.id
>> if myreg:
>> return dict(myreg=myreg)
>> else:
>> data ='{"Result" : "Still empty"}'
>> return data
>> return dict(GET=GET)
>>
>>
>>
>> El sábado, 23 de mayo de 2020, 10:17:44 (UTC+2), Alexei Vinidiktov 
>> escribió:
>>>
>>> Hello,
>>>
>>> How can I restrict access via RestAPI for the user such that they can 
>>> only get their own records (those that have the field user_id matching 
>>> their user id)?
>>>
>>> For example, I have a a table named 'collections' that has a 'user_id' 
>>> field, and I want my users to get only the collections that they created.
>>>
>>> If they try to get someone else's collection, then they should get a 
>>> 'not authorized' response.
>>>
>>> As an extension, I would also like to allow for users to be able to get 
>>> someone else's collection if its status is equal to 'PUBLIC'.
>>>
>>> Here's the definition of my collections table:
>>>
>>> db.define_table('collections',
>>> Field('user_id', db.auth_user, notnull=True),
>>> Field('language_code', length=&

[web2py] Re: RestAPI: how to restrict query results to data belonging to logged in user?

2020-05-27 Thread Jacinto Parga
Hello, 

I used this workaround in a similar case:

@auth.requires_login()
@request.restful()
def myapi():
def GET():
response.view = 'generic.json'
myreg = db(db.mytable.created_by==auth.user.id).select() # Maybe in 
your case mytable.user_id==auth.user.id
if myreg:
return dict(myreg=myreg)
else:
data ='{"Result" : "Still empty"}'
return data
return dict(GET=GET)



El sábado, 23 de mayo de 2020, 10:17:44 (UTC+2), Alexei Vinidiktov escribió:
>
> Hello,
>
> How can I restrict access via RestAPI for the user such that they can only 
> get their own records (those that have the field user_id matching their 
> user id)?
>
> For example, I have a a table named 'collections' that has a 'user_id' 
> field, and I want my users to get only the collections that they created.
>
> If they try to get someone else's collection, then they should get a 'not 
> authorized' response.
>
> As an extension, I would also like to allow for users to be able to get 
> someone else's collection if its status is equal to 'PUBLIC'.
>
> Here's the definition of my collections table:
>
> db.define_table('collections',
> Field('user_id', db.auth_user, notnull=True),
> Field('language_code', length="3", requires=IS_IN_DB(db, 'language.code', 
> db.language._format), notnull=True),
> Field('title', length=512, notnull=True),
> Field('description', 'text', notnull=False),
> Field('privacy', length=50, requires=IS_IN_SET(privacy_set), notnull=True, 
> default='PRIVATE'),
> Field('level',length=10, requires=IS_IN_SET(level_set), notnull=True, 
> default='NONE'))
>
> Thanks,
>
> --
> Alexei
>

-- 
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/a01f1311-adfe-4b95-9200-14afe29c9e5b%40googlegroups.com.


Re: [web2py] Off topic : new js alternative to vue and react

2020-05-09 Thread Jacinto Parga
I like svelte too. Do you think it can be a good complement for web2py / py4web?

-- 
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/31a7af75-9c64-4fd4-9ed9-870e27291e85%40googlegroups.com.


[web2py] Re: py4web - Deployment on GCloud (aka Google App Engine)

2020-04-16 Thread Jacinto Parga
Hi Andrew,

How did you connect with Datastore. I mean, how did you configure db in 
settings.py?

Thanks 

El lunes, 13 de abril de 2020, 0:38:35 (UTC+2), Andrew W escribió:
>
> Hi all,
> Not a question but a tip for others experimenting with py4web on GCP App 
> Engine.
>
> Following the instructions in the _documentation, after a few failed 
> attempts to access my app (with 502 and 404 errors), I modified the deploy 
> command in the Makefile by adding the --promote flag to make it :
>
> gcloud app deploy app.yaml --promote
>
>
> I'm ready to build out my first py4web app !
>
> Might be worth adding this to the script and/or documentation.
>
>
> Regards
>
> Andrew W
>
>
>
>

-- 
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/4f78d4ae-f645-4527-8c15-b30d7178c13a%40googlegroups.com.


[web2py] Re: py4web in Google App Engine route app

2020-04-09 Thread Jacinto Parga
Thanks, perfect!! It's better.

I have some apps deployed in GAE, with web2py pyhton 2.7. I want to migrate 
them to python 3.7, but cannot deploy web2py python 3.7 on GAE. I wonder if 
stable version of py4web will take too long or if it is better to try to 
find out how to deploy web2py python 3.7 on GAE



El martes, 24 de marzo de 2020, 5:17:40 (UTC+1), Massimo Di Pierro escribió:
>
> There are two problems here:
> 1) you cannot symlink in an action because it must be done once and only 
> once.
> 2) You cannot have paths like /_default because they are absolute paths
>
> Assuming this is a linux or OSX machine you should do from the shell
>
> $ rm -rf apps/_default
> $ ln -s apps/myapp apps/_default
>
> You only need to do this once.
>
> On Monday, 23 March 2020 05:01:41 UTC-7, Jacinto Parga wrote:
>>
>> Yes, but I get an error with symlink in __init.py__ of _default: 
>>
>> from py4web import action, __version__
>> import os
>>
>> @action("index")
>> @action.uses("index.html")
>> def index():
>> src = "/_default"
>> dst = "/myapp"
>> os.symlink(src, dst)
>> return dict(version=__version__)
>>
>>
>> Error Ticket: [Errno 13] Permission denied: '/_default' -> '/myapp'
>>
>> Traceback (most recent call last):
>>   File "/home/jacinto/PROGRAMACION/py4web/py4web/core.py", line 554, in 
>> wrapper
>> ret = func(*func_args, **func_kwargs)
>>   File "/home/jacinto/PROGRAMACION/py4web/py4web/core.py", line 515, in 
>> wrapper
>> ret = func(*args, **kwargs)
>>   File "apps/_default/__init__.py", line 10, in index
>> os.symlink(src, dst)
>> PermissionError: [Errno 13] Permission denied: '/_default' -> '/myapp'
>>
>> id 48
>> uuid 8b97b87a-7ec0-4158-bace-e414438f513a
>> app_name _default
>> method GET
>> path /
>> timestamp datetime.datetime(2020, 3, 23, 11, 48, 18)
>> client_ip 127.0.0.1
>> error [Errno 13] Permission denied: '/_default' -> '/myapp'
>> snapshot 
>> timestamp 2020-03-23T11:48:18.745672
>> python_version 3.7.5 (default, Nov 20 2019, 09:21:52) 
>>
>>
>>
>>
>>
>>
>> El sábado, 21 de marzo de 2020, 8:03:00 (UTC+1), Massimo Di Pierro 
>> escribió:
>>>
>>> This is a good solution. One trick is to symlink _default to myapp
>>>
>>> On Monday, 16 March 2020 02:17:56 UTC-7, Jacinto Parga wrote:
>>>>
>>>> Finally solved.
>>>>
>>>>1. I add an entrypoint to the app.yaml . The app runs fine:
>>>>runtime: python37
>>>>entrypoint: gunicorn -b :8080 -w 2 main:app 
>>>>
>>>>
>>>># Handlers define how to route requests to your application.
>>>>handlers:
>>>>
>>>>- url: /.*
>>>>  secure: always
>>>>  redirect_http_response_code: 301
>>>>  script: auto
>>>>
>>>>2. I get rid off all the apps but the default app and the app I 
>>>>want to deploy in the .gcloudignore:
>>>># This file specifies files that are *not* uploaded to Google Cloud 
>>>>Platform
>>>># using gcloud. It follows the same syntax as .gitignore, with the 
>>>>addition of
>>>># "#!include" directives (which insert the entries of the given 
>>>>.gitignore-style
>>>># file at that point).
>>>>#
>>>># For more information, run:
>>>>#   $ gcloud topic gcloudignore
>>>>#
>>>>.gcloudignore
>>>># If you would like to upload your .git directory, .gitignore file 
>>>>or files
>>>># from your .gitignore file, remove the corresponding line
>>>># below:
>>>>.git
>>>>.gitignore
>>>>
>>>># Python pycache:
>>>>__pycache__/
>>>># Ignored by the build system
>>>>/setup.cfg
>>>>
>>>>.travis.yml
>>>>*.pyc
>>>>*.pyo
>>>>*~
>>>>#*
>>>>*.1
>>>>*.bak
>>>>*.bak2
>>>>*.svn
>>>>*.w2p
>>>>*.class
>>>>*.rej
>>>>*.orig
>>>>Thumbs.db
>>>>.DS_Store
>>>>./deposit
>>>>./benchmark
>>>> 

[web2py] Re: Deploying of a web2py based webapp on GAE fails with 'No module named 'google'

2020-04-06 Thread Jacinto Parga
I have the same issue. Have you find any solution.

El domingo, 23 de febrero de 2020, 0:49:43 (UTC+1), Sreedevi escribió:
>
> My aim is to create a python 3 based webapp using web2py 2.18.5 + google 
> cloud sdk 281.0.0 + python 3.7.6. I am using the web2py's inbuilt welcome 
> app.
>
>- The app.yaml and requirements.txt file that I am using are attached
>- I can run this web2py app on my local machine and view the welcome 
>app.
>- But when I try to deploy the same app onto the cloud, I get 502 Bad 
>Gateway, nginx error. The logs corresponding to this error are as follows
>Traceback (most recent call last): File 
>"/env/lib/python3.7/site-packages/gunicorn/arbiter.py", line 583, in 
>spawn_worker worker.init_process() File 
>"/env/lib/python3.7/site-packages/gunicorn/workers/gthread.py", line 92, 
> in 
>init_process super().init_process() File 
>"/env/lib/python3.7/site-packages/gunicorn/workers/base.py", line 119, in 
>init_process self.load_wsgi() File 
>"/env/lib/python3.7/site-packages/gunicorn/workers/base.py", line 144, in 
>load_wsgi self.wsgi = self.app.wsgi() File 
>"/env/lib/python3.7/site-packages/gunicorn/app/base.py", line 67, in wsgi 
>self.callable = self.load() File 
>"/env/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 49, in 
>load return self.load_wsgiapp() File 
>"/env/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 39, in 
>load_wsgiapp return util.import_app(self.app_uri) File 
>"/env/lib/python3.7/site-packages/gunicorn/util.py", line 358, in 
>import_app mod = importlib.import_module(module) File 
>"/opt/python3.7/lib/python3.7/importlib/init.py", line 127, in 
>import_module return _bootstrap._gcd_import(name[level:], package, level) 
>File "", line 1006, in _gcd_import File "", line 983, in _find_and_load 
>File "", line 967, in _find_and_load_unlocked File "", line 677, in 
>_load_unlocked File "", line 728, in exec_module File "", line 219, in 
>_call_with_frames_removed File "/srv/main.py", line 1, in import 
> gaehandler 
>File "/srv/gaehandler.py", line 48, in from google.appengine.ext import 
>webapp ModuleNotFoundError: No module named 'google'
>
>

-- 
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/8d8f986c-3b3e-4df7-b3bb-0d228e50b118%40googlegroups.com.


[web2py] Re: letsencrypt google appengine with web2py

2020-03-31 Thread Jacinto Parga
It is no longer necessary as Google appengine gives autogenerated ssl 
certificates if you want:

[image: settings-mereba.png]


 

El viernes, 7 de junio de 2019, 3:59:29 (UTC+2), Daniel Guilhermino 
escribió:
>
> Dude ... thanks a lot! After hours, this answer helped me a lot!
>
> Many... Many thanks!
>
> Em domingo, 6 de março de 2016 16:30:42 UTC-3, Jacinto Parga escreveu:
>>
>> With GAE deployed apps...
>>
>> The best solution I've found is using an error handler and a redirection 
>> to the static file with the letsencrypt response. Something like this:
>>
>> In routes.py:
>>
>> routes_onerror = [
>> ('myapp/*', '/myapp/default/error_handler')
>> ]
>>
>> In the error_handler controller:
>>
>> def error_handler():
>> ...
>>   requested_uri = request.vars.requested_uri
>>   if str(requested_uri)[:28] == "/.well-known/acme-challenge/" :
>>         redirect("http://mysite/filewithaccesstoletsencrypt.txt;)
>> ...
>>
>>
>>
>>
>> El lunes, 7 de diciembre de 2015, 10:24:48 (UTC+1), Jacinto Parga 
>> escribió:
>>>
>>> Hi, 
>>>
>>> I want to use letsencrypt ssl certificates ( https://letsencrypt.org/ ) 
>>> in a web2py application deployed on GAE.
>>>
>>> There is a good explanation about how to get it:  
>>> http://blog.seafuj.com/lets-encrypt-on-google-app-engine
>>>
>>> But I don't know how to deploy a view like : http://
>>> www.example.com/.well-known/acme-challenge/[challenge] 
>>> <http://www.example.com/.well-known/acme-challenge/%5Bchallenge%5D>
>>>
>>> I have given all steps, I have created the certificates and the keys. 
>>> The only thing I need is to create a view to let letsencrypt to confirm the 
>>> proper response.
>>>
>>> In other words, I need to make this code work on web2py: 
>>> class LetsEncryptHandler(RequestHandler):
>>>
>>> def get(self, challenge):
>>> self.response.headers['Content-Type'] = 'text/plain'
>>> responses = {
>>> '[challenge 1]': '[response 1]'
>>> '[challenge 2]': '[response 2]'
>>> }
>>> self.response.write(responses.get(challenge, ''))
>>>
>>> application = WSGIApplication([
>>> ('/.well-known/acme-challenge/([\w-]+)', LetsEncryptHandler),
>>> ])...
>>>
>>> Any idea?
>>>
>>

-- 
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/55d5ae88-f491-4465-a5a6-904a2c647ce9%40googlegroups.com.


[web2py] Re: Python3 GAE 502 Error

2020-03-31 Thread Jacinto Parga
Is there any main.py example to deploy web2py in GAE with python 3.7 as it 
is in py4web?


El domingo, 21 de abril de 2019, 18:32:33 (UTC+2), Jacinto Parga escribió:
>
> Or may be what i need is just to know what is the entrypoint in the 
> app.yalm for my web2py application
>
>
> runtime: python37
> entrypoint: gunicorn -b :$PORT main:app
>
>
>
>
> El domingo, 21 de abril de 2019, 18:19:59 (UTC+2), Jacinto Parga escribió:
>>
>> The first issue (fatal:ambiguous argument'HEAD') solved just with git 
>> init. 
>>
>> The second one 'Bad Gateway' in google app engine with python3.7 not yet. 
>>
>> May be this solution valid for web2py) 
>> https://stackoverflow.com/questions/54565417/error-bad-gateway-502-when-opening-google-app-engine-python-domain
>>  
>>
>>
>>
>> El jueves, 18 de abril de 2019, 14:21:41 (UTC+2), Jacinto Parga escribió:
>>>
>>> Hi, 
>>>
>>> I'm trying to deploy my first python3 app in Google App Engine. I've 
>>> edited  app.yaml according to 
>>> https://cloud.google.com/appengine/docs/standard/python3/config/appref 
>>> . I have created .gcloudignore replacing skip files and I have deployed it 
>>> gcloud app deploy app.yaml --version  --promote
>>>
>>> But what I get is
>>>
>>> Beginning deployment of service [default]...
>>> fatal:ambiguous argument'HEAD': unknown revision or path outside the 
>>> working tree.
>>> Use '--' to separate the routes of the revisions, in this way:
>>> 'git  [...] -- [...]'
>>>
>>> I vhave checked that all the files are uploaded wrght to Google App 
>>> Engine, but when I access to the app:
>>>
>>> [image: bad-gateway-502.png]
>>> I dont know if it is an app.yaml mistale or there is somethin wrong in 
>>> web2py with python3 apps in GAE.
>>>
>>> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/fd05f3f2-a158-43e6-8660-308c273984c5%40googlegroups.com.


[web2py] Re: py4web in Google App Engine route app

2020-03-23 Thread Jacinto Parga
Yes, but I get an error with symlink in __init.py__ of _default: 

from py4web import action, __version__
import os

@action("index")
@action.uses("index.html")
def index():
src = "/_default"
dst = "/myapp"
os.symlink(src, dst)
return dict(version=__version__)


Error Ticket: [Errno 13] Permission denied: '/_default' -> '/myapp'

Traceback (most recent call last):
  File "/home/jacinto/PROGRAMACION/py4web/py4web/core.py", line 554, in wrapper
ret = func(*func_args, **func_kwargs)
  File "/home/jacinto/PROGRAMACION/py4web/py4web/core.py", line 515, in wrapper
ret = func(*args, **kwargs)
  File "apps/_default/__init__.py", line 10, in index
os.symlink(src, dst)
PermissionError: [Errno 13] Permission denied: '/_default' -> '/myapp'

id 48
uuid 8b97b87a-7ec0-4158-bace-e414438f513a
app_name _default
method GET
path /
timestamp datetime.datetime(2020, 3, 23, 11, 48, 18)
client_ip 127.0.0.1
error [Errno 13] Permission denied: '/_default' -> '/myapp'
snapshot 
timestamp 2020-03-23T11:48:18.745672
python_version 3.7.5 (default, Nov 20 2019, 09:21:52) 






El sábado, 21 de marzo de 2020, 8:03:00 (UTC+1), Massimo Di Pierro escribió:
>
> This is a good solution. One trick is to symlink _default to myapp
>
> On Monday, 16 March 2020 02:17:56 UTC-7, Jacinto Parga wrote:
>>
>> Finally solved.
>>
>>1. I add an entrypoint to the app.yaml . The app runs fine:
>>runtime: python37
>>entrypoint: gunicorn -b :8080 -w 2 main:app 
>>
>>
>># Handlers define how to route requests to your application.
>>handlers:
>>
>>- url: /.*
>>  secure: always
>>  redirect_http_response_code: 301
>>  script: auto
>>
>>2. I get rid off all the apps but the default app and the app I want 
>>to deploy in the .gcloudignore:
>># This file specifies files that are *not* uploaded to Google Cloud 
>>Platform
>># using gcloud. It follows the same syntax as .gitignore, with the 
>>addition of
>># "#!include" directives (which insert the entries of the given 
>>.gitignore-style
>># file at that point).
>>#
>># For more information, run:
>>#   $ gcloud topic gcloudignore
>>#
>>.gcloudignore
>># If you would like to upload your .git directory, .gitignore file or 
>>files
>># from your .gitignore file, remove the corresponding line
>># below:
>>.git
>>.gitignore
>>
>># Python pycache:
>>__pycache__/
>># Ignored by the build system
>>/setup.cfg
>>
>>.travis.yml
>>*.pyc
>>*.pyo
>>*~
>>#*
>>*.1
>>*.bak
>>*.bak2
>>*.svn
>>*.w2p
>>*.class
>>*.rej
>>*.orig
>>Thumbs.db
>>.DS_Store
>>./deposit
>>./benchmark
>>./build
>>./dist
>>./ssl
>>./docs
>>./logs
>>./*.zip
>># Only ignore the default app and the app we want to deploy
>>env/*
>>env/
>>!apps/*
>>apps/todo
>>apps/todo/*
>>apps/examples
>>apps/examples/*
>>apps/_dashboard
>>apps/_dashboard/*
>>apps/_scaffold
>>apps/_scaffold/*
>>apps/_minimal
>>apps/_minimal/*
>>!apps/_default
>>!apps/_default/*
>>!apps/myapp
>>!apps/myapp/*
>>apps/_documentation/*
>>apps/superheroes
>>apps/superheroes/*
>>apps/myfeed
>>apps/myfeed/*
>>apps/*/databases/README*
>>pps/*/databases/*
>>apps/*/uploads/*
>>apps/*/*.py[oc]
>>packages/
>>deployment_tools/*
>>deployment_tools/
>>tests/*
>>tests/
>>README.md
>>test-requirements.txt
>>source-context.json
>>password.txt
>>py4web-start.py
>>setup.py
>>Makefile
>>So when it is deployed in GAE http://myapp.appspot.com/ goes to 
>>_default/index.html url
>>3. I modify the __init.py__ file of the _default app to redirect to 
>>myapp folder:
>>from py4web import action, __version__
>>from bottle import redirect  #get redirect function from bottle
>>
>>@action("index")
>>@action.uses("index.html")
>>def index():
>>  redirect("/myapp")  # The former code: return 
>>dict(version=__version__)
>>  

[web2py] py4web GAE db datastore connection

2020-03-18 Thread Jacinto Parga
Hi, 

I have deployed an app in GAE and works fine with these  db settings in 
settings.py:

# db settings
APP_FOLDER = os.path.dirname(__file__)
APP_NAME = os.path.split(APP_FOLDER)[-1]
# DB_FOLDER:Sets the place where migration files will be created
#   and is the store location for SQLite databases
DB_FOLDER = os.path.join(APP_FOLDER, "databases")
DB_URI = "sqlite://storage.db"
DB_POOL_SIZE = 1

But it's not connected to google:datastore. If I just change:

# db settings
APP_FOLDER = os.path.dirname(__file__)
APP_NAME = os.path.split(APP_FOLDER)[-1]
# DB_FOLDER:Sets the place where migration files will be created
#   and is the store location for SQLite databases
DB_FOLDER = os.path.join(APP_FOLDER, "databases")
DB_URI = "google:datastore"
DB_POOL_SIZE = 1

It returns a not found error.

How can I configure py4web db connection to datastore?

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/51f81107-8c9f-4ce2-8e74-8e5f136e20ea%40googlegroups.com.


[web2py] Re: py4web in Google App Engine route app

2020-03-16 Thread Jacinto Parga
Finally solved.

   1. I add an entrypoint to the app.yaml . The app runs fine:
   runtime: python37
   entrypoint: gunicorn -b :8080 -w 2 main:app 
   
   
   # Handlers define how to route requests to your application.
   handlers:
   
   - url: /.*
 secure: always
 redirect_http_response_code: 301
 script: auto
   
   2. I get rid off all the apps but the default app and the app I want to 
   deploy in the .gcloudignore:
   # This file specifies files that are *not* uploaded to Google Cloud 
   Platform
   # using gcloud. It follows the same syntax as .gitignore, with the 
   addition of
   # "#!include" directives (which insert the entries of the given 
   .gitignore-style
   # file at that point).
   #
   # For more information, run:
   #   $ gcloud topic gcloudignore
   #
   .gcloudignore
   # If you would like to upload your .git directory, .gitignore file or 
   files
   # from your .gitignore file, remove the corresponding line
   # below:
   .git
   .gitignore
   
   # Python pycache:
   __pycache__/
   # Ignored by the build system
   /setup.cfg
   
   .travis.yml
   *.pyc
   *.pyo
   *~
   #*
   *.1
   *.bak
   *.bak2
   *.svn
   *.w2p
   *.class
   *.rej
   *.orig
   Thumbs.db
   .DS_Store
   ./deposit
   ./benchmark
   ./build
   ./dist
   ./ssl
   ./docs
   ./logs
   ./*.zip
   # Only ignore the default app and the app we want to deploy
   env/*
   env/
   !apps/*
   apps/todo
   apps/todo/*
   apps/examples
   apps/examples/*
   apps/_dashboard
   apps/_dashboard/*
   apps/_scaffold
   apps/_scaffold/*
   apps/_minimal
   apps/_minimal/*
   !apps/_default
   !apps/_default/*
   !apps/myapp
   !apps/myapp/*
   apps/_documentation/*
   apps/superheroes
   apps/superheroes/*
   apps/myfeed
   apps/myfeed/*
   apps/*/databases/README*
   pps/*/databases/*
   apps/*/uploads/*
   apps/*/*.py[oc]
   packages/
   deployment_tools/*
   deployment_tools/
   tests/*
   tests/
   README.md
   test-requirements.txt
   source-context.json
   password.txt
   py4web-start.py
   setup.py
   Makefile
   So when it is deployed in GAE http://myapp.appspot.com/ goes to 
   _default/index.html url
   3. I modify the __init.py__ file of the _default app to redirect to 
   myapp folder:
   from py4web import action, __version__
   from bottle import redirect  #get redirect function from bottle
   
   @action("index")
   @action.uses("index.html")
   def index():
 redirect("/myapp")  # The former code: return 
   dict(version=__version__)
   The result is that http://myapp.appspot.com/ serves 
   http://myapp.app.com/myapp

Maybe there is a more elegant way to get it. Any suggestion would be 
appreciated.

Thanks

El martes, 4 de febrero de 2020, 19:46:32 (UTC+1), Jacinto Parga escribió:
>
> I cannot properly deploy a simple py4web app in GAE. I think it's just a 
> .gcloudignore or a app.yaml configuration issue. The only thing I've got is 
> a not found page.
>
> [image: minimal-py4web.png]
>
> Some help about how to route the right app in the google app engine?
>
> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/972cbcc2-991c-4ed9-a20e-84c002cd3c5c%40googlegroups.com.


Re: [web2py] py4web in Google App Engine route app

2020-03-14 Thread Jacinto Parga
Yes. I've created a new application that is the only one I want to serve. 
In that case how can I  do in py4web the same thing I do with routes.py in 
web2py

Thanks

El lunes, 10 de febrero de 2020, 7:07:02 (UTC+1), Massimo Di Pierro 
escribió:
>
> Your .gitcloudignore appears to be ignoring all of the apps:
>
> apps/filemanager
> apps/filemanager/*
> apps/todo
> apps/todo/*
> apps/examples
> apps/examples/*
> apps/_dashboard
> apps/_dashboard/*
> apps/_scaffold
> apps/_scaffold/*
> apps/_minimal
> apps/_minimal/*
> apps/_default
> apps/_default/*
> apps/_documentation/*
> apps/superheroes
> apps/superheroes/*
>
>
>
> On Wednesday, 5 February 2020 12:38:56 UTC-8, Jacinto Parga wrote:
>>
>> No, thanks.
>>
>> Finally it was a problem with the .gcloudignore
>>
>> I had to get rid off every app but the one I wanted to deploy and the 
>> other unneccesary files to the GAE. The only thing left is that I need to 
>> add the name of the application to route the main domain to the proper app.
>>
>> This is my .gcloudignore
>> # This file specifies files that are *not* uploaded to Google Cloud 
>> Platform
>> # using gcloud. It follows the same syntax as .gitignore, with the 
>> addition of
>> # "#!include" directives (which insert the entries of the given 
>> .gitignore-style
>> # file at that point).
>> #
>> # For more information, run:
>> #   $ gcloud topic gcloudignore
>> #
>> .gcloudignore
>> # If you would like to upload your .git directory, .gitignore file or 
>> files
>> # from your .gitignore file, remove the corresponding line
>> # below:
>> .git
>> .gitignore
>>
>> #Ojo no se puede quitar requirements.txt
>>
>> # Python pycache:
>> __pycache__/
>> # Ignored by the build system
>> /setup.cfg
>>
>> .travis.yml
>> *.pyc
>> *.pyo
>> *~
>> #*
>> *.1
>> *.bak
>> *.bak2
>> *.svn
>> *.w2p
>> *.class
>> *.rej
>> *.orig
>> Thumbs.db
>> .DS_Store
>> ./deposit
>> ./benchmark
>> ./build
>> ./dist
>> ./ssl
>> ./docs
>> ./logs
>> ./*.zip
>> !apps/*
>> apps/filemanager
>> apps/filemanager/*
>> apps/todo
>> apps/todo/*
>> apps/examples
>> apps/examples/*
>> apps/_dashboard
>> apps/_dashboard/*
>> apps/_scaffold
>> apps/_scaffold/*
>> apps/_minimal
>> apps/_minimal/*
>> apps/_default
>> apps/_default/*
>> apps/_documentation/*
>> apps/superheroes
>> apps/superheroes/*
>> apps/*/databases/README*
>> pps/*/databases/*
>> apps/*/uploads/*
>> apps/*/*.py[oc]
>> packages/
>> deployment_tools/*
>> deployment_tools/
>> tests/*
>> tests/
>> README.md
>> test-requirements.txt
>> source-context.json
>> password.txt
>> py4web-start.py
>> setup.py
>>
>>
>> And I'm using the default app.yaml may be this is the problem
>>
>> runtime: python37
>>
>>
>> # Handlers define how to route requests to your application.
>> handlers:
>>
>> - url: .*  # This regex directs all routes to main.bottle
>>   script: auto
>>
>> So I had to write  the name of the application in the navigation bar: 
>>
>> https://myapplication.appspot.com/*aplicationname*
>>
>> In other case I get a not found page.
>>
>> And it goes very very slow, it is only a login page.
>>
>> Some help?
>>
>>
>>
>> El martes, 4 de febrero de 2020, 20:09:59 (UTC+1), Christian Varas 
>> escribió:
>>>
>>> Hi I haven’t tried GAE but maybe is the controller.
>>>
>>> Are you using the decorator ’action()’ to expose the function ?.
>>>
>>> Ex:
>>> @action('some_name')
>>> def some_function():
>>>
>>>   return locals()
>>>
>>> Then you acces like http://IP/your_app/some_name
>>>
>>> Cheers.
>>> Chris.
>>>
>>> El El mar, 4 de feb. de 2020 a la(s) 15:46, Jacinto Parga <
>>> jpa...@gmail.com> escribió:
>>>
>>>> I cannot properly deploy a simple py4web app in GAE. I think it's just 
>>>> a .gcloudignore or a app.yaml configuration issue. The only thing I've got 
>>>> is a not found page.
>>>>
>>>> [image: minimal-py4web.png]
>>>>
>>>> Some help about how to route the right app in the google app engine?
>>>>
>>>> Thanks
>>

Re: [web2py] py4web in Google App Engine route app

2020-02-05 Thread Jacinto Parga
No, thanks.

Finally it was a problem with the .gcloudignore

I had to get rid off every app but the one I wanted to deploy and the other 
unneccesary files to the GAE. The only thing left is that I need to add the 
name of the application to route the main domain to the proper app.

This is my .gcloudignore
# This file specifies files that are *not* uploaded to Google Cloud Platform
# using gcloud. It follows the same syntax as .gitignore, with the addition 
of
# "#!include" directives (which insert the entries of the given 
.gitignore-style
# file at that point).
#
# For more information, run:
#   $ gcloud topic gcloudignore
#
.gcloudignore
# If you would like to upload your .git directory, .gitignore file or files
# from your .gitignore file, remove the corresponding line
# below:
.git
.gitignore

#Ojo no se puede quitar requirements.txt

# Python pycache:
__pycache__/
# Ignored by the build system
/setup.cfg

.travis.yml
*.pyc
*.pyo
*~
#*
*.1
*.bak
*.bak2
*.svn
*.w2p
*.class
*.rej
*.orig
Thumbs.db
.DS_Store
./deposit
./benchmark
./build
./dist
./ssl
./docs
./logs
./*.zip
!apps/*
apps/filemanager
apps/filemanager/*
apps/todo
apps/todo/*
apps/examples
apps/examples/*
apps/_dashboard
apps/_dashboard/*
apps/_scaffold
apps/_scaffold/*
apps/_minimal
apps/_minimal/*
apps/_default
apps/_default/*
apps/_documentation/*
apps/superheroes
apps/superheroes/*
apps/*/databases/README*
pps/*/databases/*
apps/*/uploads/*
apps/*/*.py[oc]
packages/
deployment_tools/*
deployment_tools/
tests/*
tests/
README.md
test-requirements.txt
source-context.json
password.txt
py4web-start.py
setup.py


And I'm using the default app.yaml may be this is the problem

runtime: python37


# Handlers define how to route requests to your application.
handlers:

- url: .*  # This regex directs all routes to main.bottle
  script: auto

So I had to write  the name of the application in the navigation bar: 

https://myapplication.appspot.com/*aplicationname*

In other case I get a not found page.

And it goes very very slow, it is only a login page.

Some help?



El martes, 4 de febrero de 2020, 20:09:59 (UTC+1), Christian Varas escribió:
>
> Hi I haven’t tried GAE but maybe is the controller.
>
> Are you using the decorator ’action()’ to expose the function ?.
>
> Ex:
> @action('some_name')
> def some_function():
>
>   return locals()
>
> Then you acces like http://IP/your_app/some_name
>
> Cheers.
> Chris.
>
> El El mar, 4 de feb. de 2020 a la(s) 15:46, Jacinto Parga <
> jpa...@gmail.com > escribió:
>
>> I cannot properly deploy a simple py4web app in GAE. I think it's just a 
>> .gcloudignore or a app.yaml configuration issue. The only thing I've got is 
>> a not found page.
>>
>> [image: minimal-py4web.png]
>>
>> Some help about how to route the right app in the google app engine?
>>
>> 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 web...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/web2py/a7ba6f1c-2c53-4f30-8197-9c0b51d3229d%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/web2py/a7ba6f1c-2c53-4f30-8197-9c0b51d3229d%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>

-- 
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/942c9a41-020a-488b-9783-dcbeb8fdbb86%40googlegroups.com.


[web2py] py4web in Google App Engine route app

2020-02-04 Thread Jacinto Parga
I cannot properly deploy a simple py4web app in GAE. I think it's just a 
.gcloudignore or a app.yaml configuration issue. The only thing I've got is 
a not found page.

[image: minimal-py4web.png]

Some help about how to route the right app in the google app engine?

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/a7ba6f1c-2c53-4f30-8197-9c0b51d3229d%40googlegroups.com.


[web2py] Re: 2.18.5 admin UnicodeDecodeError

2019-05-22 Thread Jacinto Parga


El jueves, 25 de abril de 2019, 11:00:49 (UTC+2), Jacinto Parga escribió:
>
> Hi, It suddenly appeared. Version downloaded from source web. The same 
> with github version.
>
> Error ticket for "admin" Ticket ID 
>
> 127.0.0.1.2019-04-25.10-45-30.ec4c021c-532a-46c7-a8cd-6f9356fc7ab7
>  'ascii' codec can't decode byte 0x8b in 
> position 1: ordinal not in range(128) Versión 
> web2py™ Version 2.18.5-stable+timestamp.2019.04.08.04.22.03 
> Python Python 3.7.3: /usr/bin/python3.7 (prefix: /usr) Rastreo 
>
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
> 10.
>
> Traceback (most recent call last):
>   File "/home/jacinto/web2py2185/gluon/restricted.py", line 219, in restricted
> exec(ccode, environment)
>   File "/home/jacinto/web2py2185/applications/admin/controllers/default.py" 
> <https://127.0.0.1:8000/admin/edit/admin/controllers/default.py>, line 2021, 
> in 
>   File "/home/jacinto/web2py2185/gluon/globals.py", line 421, in 
> self._caller = lambda f: f()
>   File "/home/jacinto/web2py2185/applications/admin/controllers/default.py" 
> <https://127.0.0.1:8000/admin/edit/admin/controllers/default.py>, line 1627, 
> in errors
> error = pickle.load(fullpath_file)
> UnicodeDecodeError: 'ascii' codec can't decode byte 0x8b in position 1: 
> ordinal not in range(128)
>
> Error snapshot [image: help] 
> <https://127.0.0.1:8000/admin/default/ticket/admin/127.0.0.1.2019-04-25.10-45-30.ec4c021c-532a-46c7-a8cd-6f9356fc7ab7#>
>  
>
> UnicodeDecodeError('ascii' codec can't decode byte 0x8b in position 1: 
> ordinal not in range(128)) 
>
> inspeccionar atributos 
> Frames 
>
>- 
>
>*File /home/jacinto/web2py2185/gluon/restricted.py in restricted at 
>line 219* código argumentos variables 
>Code listing 
>
>214.
>215.
>216.
>217.
>218.
>219.
>220.
>221.
>222.
>223.
>
>if environment is None:
>environment = {}
>environment['__file__'] = layer
>environment['__name__'] = '__restricted__'
>try:
>exec(ccode, environment)
>except HTTP:
>raise
>except RestrictedError:
># do not encapsulate (obfuscate) the original RestrictedError
>
>- 
>
>*File 
>/home/jacinto/web2py2185/applications/admin/controllers/default.py in 
> at line 2021* código argumentos variables 
>Code listing 
>
>2010.
>2011.
>2012.
>2013.
>2014.
>2015.
>2016.
>2017.
>2018.
>2019.
>
>else:
>filename = "web2py.plugin.%s.w2p" % cleanpath(plugin)
>if plugin_install(app, urlopen(source),
>  request, filename):
>session.flash = T('New plugin installed: %s', filename)
>else:
>session.flash = \
>T('unable to install plugin "%s"', filename)
>redirect(URL(f="plugins", args=[app, ]))
>return dict(form=form, app=app, plugin=plugin, source=source)
>
>- 
>
>*File /home/jacinto/web2py2185/gluon/globals.py in  at line 
>421* código argumentos variables 
>Code listing 
>
>416.
>417.
>418.
>419.
>420.
>421.
>422.
>423.
>424.
>425.
>
>self.flash = ''# used by the default view layout
>self.meta = Storage()  # used by web2py_ajax.html
>self.menu = [] # used by the default view layout
>self.files = []# used by web2py_ajax.html
>self._vars = None
>self._caller = lambda f: f()
>self._view_environment = None
>self._custom_commit = None
>self._custom_rollback = None
>self.generic_patterns = ['*']
>
>- 
>
>*File 
>/home/jacinto/web2py2185/applications/admin/controllers/default.py in 
>errors at line 1627* código argumentos variables 
>Function argument list 
>
>()
>Code listing 
>
>1622.
>1623.
>1624.
>1625.
>1626.
>1627.
>1628.
>1629.
>1630.
>1631.
>
>if not os.path.isfile(fullpath):
>continue
>try:
>fullpath_file = safe_open(fullpath, 'rb')
>try:
>error = pickle.load(fullpath_file)

[web2py] Re: 2.18.5 admin UnicodeDecodeError

2019-05-22 Thread Jacinto Parga
Yes I had to clear the sessions. There is an issue when you start sessions 
in chrome width different users.

Thanks

El jueves, 25 de abril de 2019, 23:55:48 (UTC+2), João Matos escribió:
>
> Did you change the Python version? Check your path.
> Also, if clearing the sessions and errors doesn't work, try to delete all 
> *.pyc in the web2py tree.
>
> Another possible origin are the databases if using SQLite.
>
>
> quinta-feira, 25 de Abril de 2019 às 10:00:49 UTC+1, Jacinto Parga 
> escreveu:
>>
>> Hi, It suddenly appeared. Version downloaded from source web. The same 
>> with github version.
>>
>> Error ticket for "admin" Ticket ID 
>>
>> 127.0.0.1.2019-04-25.10-45-30.ec4c021c-532a-46c7-a8cd-6f9356fc7ab7
>>  'ascii' codec can't decode byte 0x8b in 
>> position 1: ordinal not in range(128) Versión 
>> web2py™ Version 2.18.5-stable+timestamp.2019.04.08.04.22.03 
>> Python Python 3.7.3: /usr/bin/python3.7 (prefix: /usr) Rastreo 
>>
>> 1.
>> 2.
>> 3.
>> 4.
>> 5.
>> 6.
>> 7.
>> 8.
>> 9.
>> 10.
>>
>> Traceback (most recent call last):
>>   File "/home/jacinto/web2py2185/gluon/restricted.py", line 219, in 
>> restricted
>> exec(ccode, environment)
>>   File "/home/jacinto/web2py2185/applications/admin/controllers/default.py" 
>> <https://127.0.0.1:8000/admin/edit/admin/controllers/default.py>, line 2021, 
>> in 
>>   File "/home/jacinto/web2py2185/gluon/globals.py", line 421, in 
>> self._caller = lambda f: f()
>>   File "/home/jacinto/web2py2185/applications/admin/controllers/default.py" 
>> <https://127.0.0.1:8000/admin/edit/admin/controllers/default.py>, line 1627, 
>> in errors
>> error = pickle.load(fullpath_file)
>> UnicodeDecodeError: 'ascii' codec can't decode byte 0x8b in position 1: 
>> ordinal not in range(128)
>>
>> Error snapshot [image: help] 
>> <https://127.0.0.1:8000/admin/default/ticket/admin/127.0.0.1.2019-04-25.10-45-30.ec4c021c-532a-46c7-a8cd-6f9356fc7ab7#>
>>  
>>
>> UnicodeDecodeError('ascii' codec can't decode byte 0x8b in position 1: 
>> ordinal not in range(128)) 
>>
>> inspeccionar atributos 
>> Frames 
>>
>>- 
>>
>>*File /home/jacinto/web2py2185/gluon/restricted.py in restricted at 
>>line 219* código argumentos variables 
>>Code listing 
>>
>>214.
>>215.
>>216.
>>217.
>>218.
>>219.
>>220.
>>221.
>>222.
>>223.
>>
>>if environment is None:
>>environment = {}
>>environment['__file__'] = layer
>>environment['__name__'] = '__restricted__'
>>try:
>>exec(ccode, environment)
>>except HTTP:
>>raise
>>except RestrictedError:
>># do not encapsulate (obfuscate) the original RestrictedError
>>
>>- 
>>
>>*File 
>>/home/jacinto/web2py2185/applications/admin/controllers/default.py in 
>> at line 2021* código argumentos variables 
>>Code listing 
>>
>>2010.
>>2011.
>>2012.
>>2013.
>>2014.
>>2015.
>>2016.
>>2017.
>>2018.
>>2019.
>>
>>else:
>>filename = "web2py.plugin.%s.w2p" % cleanpath(plugin)
>>if plugin_install(app, urlopen(source),
>>  request, filename):
>>session.flash = T('New plugin installed: %s', filename)
>>else:
>>session.flash = \
>>T('unable to install plugin "%s"', filename)
>>redirect(URL(f="plugins", args=[app, ]))
>>return dict(form=form, app=app, plugin=plugin, source=source)
>>
>>- 
>>
>>*File /home/jacinto/web2py2185/gluon/globals.py in  at line 
>>421* código argumentos variables 
>>Code listing 
>>
>>416.
>>417.
>>418.
>>419.
>>420.
>>421.
>>422.
>>423.
>>424.
>>425.
>>
>>self.flash = ''# used by the default view layout
>>self.meta = Storage()  # used by web2py_ajax.html
>>self.menu = [] # used by the default view layout
>>self.files = []# used b

[web2py] Recaptcha V3 in auth.login form

2019-05-22 Thread Jacinto Parga
I have tried recaptcha v3 width auth login form but something is wrong. It 
seems to break the basic  auth validation methods.

Controller

def user():

form = auth()
my_captcha_element = TR(INPUT(_name='recaptcharesponse', value='', 
_type='hidden', _id='g-recaptcha-response'))
form[0].insert(-1, my_captcha_element)
if form.accepts(request.vars, session):
#Comprobamos el CAPTCHA
token = str(form.vars.recaptcharesponse)
action = 'login'
remoteip = str(request.env.remote_addr)
score = 0.5 #elegimos el score que queremos
capt = comprobar_captcha(token, action, remoteip, score) # A 
fucntion I've created to evaluate the captcha in server
if capt == 'Falso':
response.flash = T('Posible spam please try later.') 
if session.counter >= 20:
redirect(URL('errores','error',args='posiblebot'))
return dict(form=form)

View

{{extend 'layout.html'}}

 
  

  {{=T('Sign Up') if request.args(0) == 'register' else T('Log In') if 
request.args(0) == 'login' else T(request.args(0).replace('_',' 
').title())}}

{{=form}}

{{if request.args(0)=='login' and not 'register' in 
auth.settings.actions_disabled:}}
{{=T('Register')}}

{{pass}}
{{if request.args(0)=='login' and not 'retrieve_password' in 
auth.settings.actions_disabled:}}
{{=T('Lost your 
password?')}}
{{pass}}
{{if request.args(0)=='register':}}
{{=T('Login')}}
{{pass}}
  




{{block page_js}}

jQuery("#web2py_user_form input:visible:enabled:first").focus();
{{if request.args(0)=='register':}}
web2py_validate_entropy(jQuery('#auth_user_password'),100);
{{elif request.args(0)=='change_password':}}
web2py_validate_entropy(jQuery('#no_table_new_password'),100);
{{pass}}

{{end page_js}}


 grecaptcha.ready(function() {
  grecaptcha.execute('', 
{action:'login'}).then(function(token) {
  document.getElementById('g-recaptcha-response').value = token;
  });
  });
  



-- 
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/06b4ded4-53e2-45e8-b119-2ef42621f42b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] 2.18.5 admin UnicodeDecodeError

2019-04-25 Thread Jacinto Parga
Hi, It suddenly appeared. Version downloaded from source web. The same with 
github version.

Error ticket for "admin" Ticket ID 

127.0.0.1.2019-04-25.10-45-30.ec4c021c-532a-46c7-a8cd-6f9356fc7ab7
 'ascii' codec can't decode byte 0x8b in 
position 1: ordinal not in range(128) Versión 
web2py™ Version 2.18.5-stable+timestamp.2019.04.08.04.22.03 
Python Python 3.7.3: /usr/bin/python3.7 (prefix: /usr) Rastreo 

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

Traceback (most recent call last):
  File "/home/jacinto/web2py2185/gluon/restricted.py", line 219, in restricted
exec(ccode, environment)
  File "/home/jacinto/web2py2185/applications/admin/controllers/default.py" 
, line 2021, in 

  File "/home/jacinto/web2py2185/gluon/globals.py", line 421, in 
self._caller = lambda f: f()
  File "/home/jacinto/web2py2185/applications/admin/controllers/default.py" 
, line 1627, in 
errors
error = pickle.load(fullpath_file)
UnicodeDecodeError: 'ascii' codec can't decode byte 0x8b in position 1: ordinal 
not in range(128)

Error snapshot [image: help] 

 

UnicodeDecodeError('ascii' codec can't decode byte 0x8b in position 1: 
ordinal not in range(128)) 

inspeccionar atributos 
Frames 
   
   - 
   
   *File /home/jacinto/web2py2185/gluon/restricted.py in restricted at line 
   219* código argumentos variables 
   Code listing 
   
   214.
   215.
   216.
   217.
   218.
   219.
   220.
   221.
   222.
   223.
   
   if environment is None:
   environment = {}
   environment['__file__'] = layer
   environment['__name__'] = '__restricted__'
   try:
   exec(ccode, environment)
   except HTTP:
   raise
   except RestrictedError:
   # do not encapsulate (obfuscate) the original RestrictedError
   
   - 
   
   *File /home/jacinto/web2py2185/applications/admin/controllers/default.py 
   in  at line 2021* código argumentos variables 
   Code listing 
   
   2010.
   2011.
   2012.
   2013.
   2014.
   2015.
   2016.
   2017.
   2018.
   2019.
   
   else:
   filename = "web2py.plugin.%s.w2p" % cleanpath(plugin)
   if plugin_install(app, urlopen(source),
 request, filename):
   session.flash = T('New plugin installed: %s', filename)
   else:
   session.flash = \
   T('unable to install plugin "%s"', filename)
   redirect(URL(f="plugins", args=[app, ]))
   return dict(form=form, app=app, plugin=plugin, source=source)
   
   - 
   
   *File /home/jacinto/web2py2185/gluon/globals.py in  at line 421* 
   código argumentos variables 
   Code listing 
   
   416.
   417.
   418.
   419.
   420.
   421.
   422.
   423.
   424.
   425.
   
   self.flash = ''# used by the default view layout
   self.meta = Storage()  # used by web2py_ajax.html
   self.menu = [] # used by the default view layout
   self.files = []# used by web2py_ajax.html
   self._vars = None
   self._caller = lambda f: f()
   self._view_environment = None
   self._custom_commit = None
   self._custom_rollback = None
   self.generic_patterns = ['*']
   
   - 
   
   *File /home/jacinto/web2py2185/applications/admin/controllers/default.py 
   in errors at line 1627* código argumentos variables 
   Function argument list 
   
   ()
   Code listing 
   
   1622.
   1623.
   1624.
   1625.
   1626.
   1627.
   1628.
   1629.
   1630.
   1631.
   
   if not os.path.isfile(fullpath):
   continue
   try:
   fullpath_file = safe_open(fullpath, 'rb')
   try:
   error = pickle.load(fullpath_file)
   finally:
   fullpath_file.close()
   except IOError:
   continue
   
   Variables
   

-- 
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: Python3 GAE 502 Error

2019-04-21 Thread Jacinto Parga
Or may be what i need is just to know what is the entrypoint in the 
app.yalm for my web2py application


runtime: python37
entrypoint: gunicorn -b :$PORT main:app




El domingo, 21 de abril de 2019, 18:19:59 (UTC+2), Jacinto Parga escribió:
>
> The first issue (fatal:ambiguous argument'HEAD') solved just with git 
> init. 
>
> The second one 'Bad Gateway' in google app engine with python3.7 not yet. 
>
> May be this solution valid for web2py) 
> https://stackoverflow.com/questions/54565417/error-bad-gateway-502-when-opening-google-app-engine-python-domain
>  
>
>
>
> El jueves, 18 de abril de 2019, 14:21:41 (UTC+2), Jacinto Parga escribió:
>>
>> Hi, 
>>
>> I'm trying to deploy my first python3 app in Google App Engine. I've 
>> edited  app.yaml according to 
>> https://cloud.google.com/appengine/docs/standard/python3/config/appref . 
>> I have created .gcloudignore replacing skip files and I have deployed it 
>> gcloud app deploy app.yaml --version  --promote
>>
>> But what I get is
>>
>> Beginning deployment of service [default]...
>> fatal:ambiguous argument'HEAD': unknown revision or path outside the 
>> working tree.
>> Use '--' to separate the routes of the revisions, in this way:
>> 'git  [...] -- [...]'
>>
>> I vhave checked that all the files are uploaded wrght to Google App 
>> Engine, but when I access to the app:
>>
>> [image: bad-gateway-502.png]
>> I dont know if it is an app.yaml mistale or there is somethin wrong in 
>> web2py with python3 apps in GAE.
>>
>> 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: Python3 GAE 502 Error

2019-04-21 Thread Jacinto Parga
The first issue (fatal:ambiguous argument'HEAD') solved just with git init. 

The second one 'Bad Gateway' in google app engine with python3.7 not yet. 

May be this solution valid for 
web2py) 
https://stackoverflow.com/questions/54565417/error-bad-gateway-502-when-opening-google-app-engine-python-domain
 



El jueves, 18 de abril de 2019, 14:21:41 (UTC+2), Jacinto Parga escribió:
>
> Hi, 
>
> I'm trying to deploy my first python3 app in Google App Engine. I've 
> edited  app.yaml according to 
> https://cloud.google.com/appengine/docs/standard/python3/config/appref . 
> I have created .gcloudignore replacing skip files and I have deployed it 
> gcloud app deploy app.yaml --version  --promote
>
> But what I get is
>
> Beginning deployment of service [default]...
> fatal:ambiguous argument'HEAD': unknown revision or path outside the 
> working tree.
> Use '--' to separate the routes of the revisions, in this way:
> 'git  [...] -- [...]'
>
> I vhave checked that all the files are uploaded wrght to Google App 
> Engine, but when I access to the app:
>
> [image: bad-gateway-502.png]
> I dont know if it is an app.yaml mistale or there is somethin wrong in 
> web2py with python3 apps in GAE.
>
> 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: Web3py

2019-04-20 Thread Jacinto Parga
So, if you plan to move your web services developed with web2py python 2.7 
to python 3 and deploy new micro services, what would be the best choice to 
try?
 - web2py for python 3
 - web3py
 
 Let's suppose one year term

El sábado, 20 de abril de 2019, 22:45:55 (UTC+2), 黄祥 escribió:
>
> is it on same situation web2py for python 3 vs web3py
> with
> laravel vs lumen
> ?
> the first is full stack web framework, while the other is micro web 
> framework
>
> best regards,
> stifan
>

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


[web2py] Python3 GAE 502 Error

2019-04-18 Thread Jacinto Parga
Hi, 

I'm trying to deploy my first python3 app in Google App Engine. I've 
edited  app.yaml according to 
https://cloud.google.com/appengine/docs/standard/python3/config/appref . I 
have created .gcloudignore replacing skip files and I have deployed it 
gcloud app deploy app.yaml --version  --promote

But what I get is

Beginning deployment of service [default]...
fatal:ambiguous argument'HEAD': unknown revision or path outside the 
working tree.
Use '--' to separate the routes of the revisions, in this way:
'git  [...] -- [...]'

I vhave checked that all the files are uploaded wrght to Google App Engine, 
but when I access to the app:

[image: bad-gateway-502.png]
I dont know if it is an app.yaml mistale or there is somethin wrong in 
web2py with python3 apps in GAE.

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: 2.18.2 gluon/main.py bug..?

2019-02-28 Thread Jacinto Parga
ok.
should I report it as a bug?

El jueves, 28 de febrero de 2019, 14:15:45 (UTC+1), Leonel Câmara escribió:
>
> I would just downgrade and wait for a new release with an updated pydal 
> then. Massimo moved a lot of _compat stuff to pydal including the 
> urllib_quote causing you problems.
>

-- 
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: 2.18.2 gluon/main.py bug..?

2019-02-28 Thread Jacinto Parga
No, I have got it 
form https://mdipierro.pythonanywhere.com/examples/static/web2py_src.zip  
from the download page http://www.web2py.com/init/default/download


El jueves, 28 de febrero de 2019, 13:24:30 (UTC+1), Leonel Câmara escribió:
>
> Are you using the github version of web2py? You need to update your pydal. 
> Run a:
>
> git submodule update --recursive --remote
>
>

-- 
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] 2.18.2 gluon/main.py bug..?

2019-02-28 Thread Jacinto Parga
Unable to store in FILE: Framework
Traceback (most recent call last):
File "/base//2263366/gluon/main.py", 
line 488, in wsgibase
urllib_quote(xmlescape(response.flash).replace(b'\n', b''))
NameError: global name 'urllib_quote' is not defined

I've got this error width 2.18.2, not in 2.17.3. Any fix?

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] GAE deposit folder skipped in app.yaml

2017-08-19 Thread Jacinto Parga
Hi, 

I have included deposit folder in the skipped files in app.yaml to deploy 
in GAE.

¿Is there any trouble ?

 ...
 (applications/examples/.*)|
 (deposit/.*)|
 ((examples|welcome)\.(w2p|tar))|
 (applications/.*?/(cron|databases|errors|cache|sessions)/.*)|


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

2017-07-13 Thread Jacinto Parga
Great job. Thanks.

First issue with @mobilize import



from gluon.contrib.user_agent_parser import mobilize




El miércoles, 5 de julio de 2017, 8:55:21 (UTC+2), Massimo Di Pierro 
escribió:
>
> Please help us test the new web2py:
>
> https://mdipierro.pythonanywhere.com/examples/static/nightly/web2py_src.zip
>  
> https://mdipierro.pythonanywhere.com/examples/static/nightly/web2py_osx.zip
> https://mdipierro.pythonanywhere.com/examples/static/nightly/web2py_win.zip
>
> Personally and on behalf of the community: thanks to everybody who has 
> contributed! 
>
> It has been a year but we piled up a huge number of small changes and bug 
> fixes.
>
> ## 2.16.0b1
>
> - experimental python 3 support
>
> - experimental authapi for service login
>
> - more tests
>
> - d3.js model visulization
>
> - improved scheduler
>
> - is_email support for internationalized Domain Names
>
> - improved used of cookies with CookieJar
>
> - SQLFORM.grid(showblobs=True)
>
> - import JS events (added w2p.componentBegin event)
>
> - added support for CASv3
>
> - allow first_name and last_name placeholders in verify_email message
>
> - added three-quote support in markmin
>
> - updated pg8000 driver (but we still recommend psycopg2)
>
> - compiled views use . separator not _ separator (must recompile code)
>
> - better serbian, french, and catalan translations
>
> - speed improvements (refactor of compileapp and pyc caching)
>
> - removed web shell (never worked as intended)
>
> - allow Expose(..., follow_symlink_out=False).
>
> - Updated fpdf to latest version
>
> - JWT support
>
> - import fabfile for remote deployment
>
> - jQuery 3.2.1
>
> - PyDAL 17.07 including:
>
>   allow jsonb support for postgres
>
>   correctly configure adapters that need connection for configuration
>
>   better caching
>
>   updated IMAP adapter methods to new API
>
>   experimental suport for joinable subselects
>
>   improved Teradata support
>
>   improved mongodb support
>
>   overall refactoring
>
>   experimental support for Google Cloud SQL v2
>

-- 
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: Password Recovery Not Sending (lazyT object being passed to GAE?)

2017-04-14 Thread Jacinto Parga
Yes it is easy to change anyone password, but you still have to access to 
his/hers email to set the final password. Anyway it is not the right 
solution. There was no problem with 2.13 versions.

 

El viernes, 14 de abril de 2017, 0:55:50 (UTC+2), webm...@trytha.com 
escribió:
>
> Can we not get a real solution to this?  I was gonna try the posted hack, 
> but it can be too easily abused (it changes the user's password instead of 
> using a password_reset token, so anyone could change your password just by 
> knowing your email address).
>
> On Friday, April 7, 2017 at 7:28:48 PM UTC-7, webm...@trytha.com wrote:
>>
>> Thanks for bringing this issue back up and posting a workaround.  
>>
>> The worst part is the way to fix this is probably about as easy as 
>> wrapping something in "str()", just need to know how the web2py internals 
>> all link together.
>>
>> On Thursday, April 6, 2017 at 4:51:17 AM UTC-7, Karoly Kantor wrote:
>>>
>>> Thanks, this helped, i am now using my own function to send the password 
>>> reset email.
>>>
>>> On Friday, March 31, 2017 at 2:51:03 PM UTC+2, Jacinto Parga wrote:
>>>>
>>>> Yes, still unresolved.
>>>>
>>>> I did a workaround for the request_reset_password: 
>>>>
>>>> def user(): 
>>>> if request.args(0)=='request_reset_password':
>>>> redirect(URL('default','myrequestpass'))
>>>> return dict(form=auth())
>>>>
>>>> def myrequestpass():
>>>> form = SQLFORM.factory(
>>>> Field('u_email', requires =[IS_EMAIL(error_message='Wrong 
>>>> email'), IS_IN_DB(db, 'auth_user.email', error_message='Address not in 
>>>> DB')]),
>>>>   table_name='solicitar_pass')
>>>> if form.process().accepted:
>>>> user = 
>>>> db(db.auth_user.email==form.vars.u_email).select().first()
>>>> session.flash = 'Comprueba tu correo '+str(user.first_name)
>>>> u_passwd = str(hex(int(time.time([2:]
>>>> user.update_record(password=CRYPT()(u_passwd.encode('utf8'))[0])
>>>> mensaje=' Retrieve your password Temporal 
>>>> password :  '+ u_passwd   +'   Login with the temporal 
>>>> password and set your new password in this link :https://yoursite.com/user/login?_next=/user/change_password;>Change 
>>>> Password''
>>>> mail.send(to=[form.vars.u_email],
>>>> subject='Change your password, follow this link',
>>>> message=mensaje)
>>>> redirect(URL('default','index'))
>>>> elif form.errors:
>>>> response.flash = 'Wrong Email address'
>>>> return dict(form=form)
>>>>
>>>>
>>>> But anyway the lazyT found is an annoying error width, for instance: 
>>>> auth.settings.auth_two_factor_enabled = True
>>>>
>>>>
>>>> El jueves, 30 de marzo de 2017, 8:13:06 (UTC+2), Karoly Kantor escribió:
>>>>>
>>>>> As the issue is still unresolved, i have unchecked the "no action 
>>>>> needed" flag on this topic. Any help would be appreciated. Thank you.
>>>>>
>>>>> On Thursday, March 30, 2017 at 6:33:07 AM UTC+2, Karoly Kantor wrote:
>>>>>>
>>>>>> This issue still seems to be unsolved. I have a fresh installation on 
>>>>>> GAE, reset password emails fail due to "need string or buffer, lazyT 
>>>>>> found"
>>>>>>
>>>>>> Is there something I can do?
>>>>>>
>>>>>> Thanks.
>>>>>>
>>>>>> On Friday, July 29, 2016 at 7:49:14 AM UTC+2, webm...@trytha.com 
>>>>>> wrote:
>>>>>>>
>>>>>>> I just uploaded an updated version of web2py to my server, replacing 
>>>>>>> a much older version (likely 2.12.2), and now it won't send password 
>>>>>>> recovery emails.  The error in the logs is: 
>>>>>>>
>>>>>>> Mail.send failure:coercing to Unicode: need string or buffer, lazyT 
>>>>>>> found
>>>>>>>
>>>>>>> This suggests to me that somehow a string is not properly being 
>>>>>>> passed.  I gather that lazyT has something to do with the built-in 
>>>>>>> translation capabilities of web2py?  Probably don't need to be 
>>>>>>> translating 
>>>>>>> email addresses (though I guess it could be trying to translate the 
>>>>>>> recovery message).  Either way, GAE wants nothing to do with it.
>>>>>>>
>>>>>>> How can I 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] two-step validation error

2017-03-31 Thread Jacinto Parga
Two errors when I try to apply an two-step access


1 I try whith 

auth.settings.auth_two_factor_enabled = True


and I get

Mail.send failure:coercing to Unicode: need string or buffer, lazyT found


Unable to store in FILE: Framework Traceback (most recent call last): File 
"/base/data/home/apps/e~errad-marcafranca/0.400231479324356605/gluon/main.py", 
line 464 
,
 
in wsgibase session._try_store_in_db(request, response) File 
"/base/data/home/apps/e~errad-marcafranca/0.400231479324356605/gluon/globals.py",
 
line 1156 
,
 
in _try_store_in_db or (self._unchanged(response) and not 
response.session_new)): File 
"/base/data/home/apps/e~errad-marcafranca/0.400231479324356605/gluon/globals.py",
 
line 1145 
,
 
in _unchanged session_pickled = pickle.dumps(self, pickle.HIGHEST_PROTOCOL) 
File 
"/base/data/home/runtimes/python27/python27_dist/lib/python2.7/pickle.py", 
line 1374, in dumps Pickler(file, protocol).dump(obj) File 
"/base/data/home/runtimes/python27/python27_dist/lib/python2.7/pickle.py", 
line 224, in dump self.save(obj) File 
"/base/data/home/runtimes/python27/python27_dist/lib/python2.7/pickle.py", 
line 331, in save self.save_reduce(obj=obj, *rv) File 
"/base/data/home/runtimes/python27/python27_dist/lib/python2.7/pickle.py", 
line 401, in save_reduce save(args) File 
"/base/data/home/runtimes/python27/python27_dist/lib/python2.7/pickle.py", 
line 286, in save f(self, obj) # Call unbound method with explicit self 
File 
"/base/data/home/runtimes/python27/python27_dist/lib/python2.7/pickle.py", 
line 548, in save_tuple save(element) File 
"/base/data/home/runtimes/python27/python27_dist/lib/python2.7/pickle.py", 
line 286, in save f(self, obj) # Call unbound method with explicit self 
File 
"/base/data/home/runtimes/python27/python27_dist/lib/python2.7/pickle.py", 
line 649, in save_dict self._batch_setitems(obj.iteritems()) File 
"/base/data/home/runtimes/python27/python27_dist/lib/python2.7/pickle.py", 
line 681, in _batch_setitems save(v) File 
"/base/data/home/runtimes/python27/python27_dist/lib/python2.7/pickle.py", 
line 331, in save self.save_reduce(obj=obj, *rv) File 
"/base/data/home/runtimes/python27/python27_dist/lib/python2.7/pickle.py", 
line 401, in save_reduce save(args) File 
"/base/data/home/runtimes/python27/python27_dist/lib/python2.7/pickle.py", 
line 286, in save f(self, obj) # Call unbound method with explicit self 
File 
"/base/data/home/runtimes/python27/python27_dist/lib/python2.7/pickle.py", 
line 548, in save_tuple save(element) File 
"/base/data/home/runtimes/python27/python27_dist/lib/python2.7/pickle.py", 
line 286, in save f(self, obj) # Call unbound method with explicit self 
File 
"/base/data/home/runtimes/python27/python27_dist/lib/python2.7/pickle.py", 
line 649, in save_dict self._batch_setitems(obj.iteritems()) File 
"/base/data/home/runtimes/python27/python27_dist/lib/python2.7/pickle.py", 
line 681, in _batch_setitems save(v) File 
"/base/data/home/runtimes/python27/python27_dist/lib/python2.7/pickle.py", 
line 331, in save self.save_reduce(obj=obj, *rv) File 
"/base/data/home/runtimes/python27/python27_dist/lib/python2.7/pickle.py", 
line 419, in save_reduce save(state) File 
"/base/data/home/runtimes/python27/python27_dist/lib/python2.7/pickle.py", 
line 286, in save f(self, obj) # Call unbound method with explicit self 
File 
"/base/data/home/runtimes/python27/python27_dist/lib/python2.7/pickle.py", 
line 649, in save_dict self._batch_setitems(obj.iteritems()) File 
"/base/data/home/runtimes/python27/python27_dist/lib/python2.7/pickle.py", 
line 681, in _batch_setitems save(v) File 
"/base/data/home/runtimes/python27/python27_dist/lib/python2.7/pickle.py", 
line 331, in save self.save_reduce(obj=obj, *rv) File 
"/base/data/home/runtimes/python27/python27_dist/lib/python2.7/pickle.py", 
line 401, in save_reduce save(args) File 
"/base/data/home/runtimes/python27/python27_dist/lib/python2.7/pickle.py", 
line 286, in save f(self, obj) # Call unbound method with explicit self 
File 
"/base/data/home/runtimes/python27/python27_dist/lib/python2.7/pickle.py", 
line 548, in save_tuple save(element) File 
"/base/data/home/runtimes/python27/python27_dist/lib/python2.7/pickle.py", 
line 286, in save f(self, obj) # Call unbound method with 

[web2py] Re: Password Recovery Not Sending (lazyT object being passed to GAE?)

2017-03-31 Thread Jacinto Parga
Yes, still unresolved.

I did a workaround for the request_reset_password: 

def user(): 
if request.args(0)=='request_reset_password':
redirect(URL('default','myrequestpass'))
return dict(form=auth())

def myrequestpass():
form = SQLFORM.factory(
Field('u_email', requires =[IS_EMAIL(error_message='Wrong email'), 
IS_IN_DB(db, 'auth_user.email', error_message='Address not in DB')]),
  table_name='solicitar_pass')
if form.process().accepted:
user = db(db.auth_user.email==form.vars.u_email).select().first()
session.flash = 'Comprueba tu correo '+str(user.first_name)
u_passwd = str(hex(int(time.time([2:]
user.update_record(password=CRYPT()(u_passwd.encode('utf8'))[0])
mensaje=' Retrieve your password Temporal password : 
 '+ u_passwd   +'   Login with the temporal password 
and set your new password in this link :https://yoursite.com/user/login?_next=/user/change_password;>Change 
Password''
mail.send(to=[form.vars.u_email],
subject='Change your password, follow this link',
message=mensaje)
redirect(URL('default','index'))
elif form.errors:
response.flash = 'Wrong Email address'
return dict(form=form)


But anyway the lazyT found is an annoying error width, for instance: auth.
settings.auth_two_factor_enabled = True


El jueves, 30 de marzo de 2017, 8:13:06 (UTC+2), Karoly Kantor escribió:
>
> As the issue is still unresolved, i have unchecked the "no action needed" 
> flag on this topic. Any help would be appreciated. Thank you.
>
> On Thursday, March 30, 2017 at 6:33:07 AM UTC+2, Karoly Kantor wrote:
>>
>> This issue still seems to be unsolved. I have a fresh installation on 
>> GAE, reset password emails fail due to "need string or buffer, lazyT 
>> found"
>>
>> Is there something I can do?
>>
>> Thanks.
>>
>> On Friday, July 29, 2016 at 7:49:14 AM UTC+2, webm...@trytha.com wrote:
>>>
>>> I just uploaded an updated version of web2py to my server, replacing a 
>>> much older version (likely 2.12.2), and now it won't send password recovery 
>>> emails.  The error in the logs is: 
>>>
>>> Mail.send failure:coercing to Unicode: need string or buffer, lazyT 
>>> found
>>>
>>> This suggests to me that somehow a string is not properly being passed. 
>>>  I gather that lazyT has something to do with the built-in translation 
>>> capabilities of web2py?  Probably don't need to be translating email 
>>> addresses (though I guess it could be trying to translate the recovery 
>>> message).  Either way, GAE wants nothing to do with it.
>>>
>>> How can I 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] Re: how to deploy in GAE

2017-02-17 Thread Jacinto Parga
With gcloud you have to configure the app.yalm without "yourappname" and 
"version"

The appname is provided when you make gcloud init

And you can specify the version with --version  flag

El martes, 25 de octubre de 2016, 7:11:49 (UTC+2), Massimo Di Pierro 
escribió:
>
> wget http://web2py.com/examples/static/web2py_src.zip
> unzip web2py_src.zip
> cd web2py
> cp examples/app.example.yaml app.yaml
> cp handler/gaehandler.py gaehandler.py
>
> EDIT app.yaml and replace "yourappname with" your application name
>
> deploy with
>cd ..
>
>appcfg.py update web2py
> or with
> gcloud app deploy web2py/app.yaml
>
>
>

-- 
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] Issue width auht.has_mermbership in menu.py

2017-02-14 Thread Jacinto Parga
Yes, because the error appears again.

My db.py

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

#
## This scaffolding model makes your app work on Google App Engine too
## File is released under public domain and you can use without limitations
#

## if SSL/HTTPS is properly configured and you want all HTTP requests to
## be redirected to HTTPS, uncomment the line below:
request.requires_https()

## app configuration made easy. Look inside private/appconfig.ini
from gluon.contrib.appconfig import AppConfig
## once in production, remove reload=True to gain full speed
myconf = AppConfig(reload=True)


if not request.env.web2py_runtime_gae:
## if NOT running on Google App Engine use SQLite or other DB
db = DAL(myconf.take('db.uri'), pool_size=myconf.take('db.pool_size', 
cast=int), check_reserved=['all'])
else:
## connect to Google BigTable (optional 'google:datastore://namespace')
db = DAL('google:datastore+ndb')
## store sessions and tickets there
session.connect(request, response, db=db)
## or store session in Memcache, Redis, etc.
## from gluon.contrib.memdb import MEMDB
## from google.appengine.api.memcache import Client
## session.connect(request, response, db = MEMDB(Client()))

## by default give a view/generic.extension to all actions from localhost
## none otherwise. a pattern can be 'controller/function.extension'
response.generic_patterns = ['*'] if request.is_local else []
## choose a style for forms
response.formstyle = myconf.take('forms.formstyle')  # or 
'bootstrap3_stacked' or 'bootstrap2' or other
response.form_label_separator = myconf.take('forms.separator')


## (optional) optimize handling of static files
# response.optimize_css = 'concat,minify,inline'
# response.optimize_js = 'concat,minify,inline'
## (optional) static assets folder versioning
# response.static_version = '0.0.0'
#
## Here is sample code if you need for
## - email capabilities
## - authentication (registration, login, logout, ... )
## - authorization (role based authorization)
## - services (xml, csv, json, xmlrpc, jsonrpc, amf, rss)
## - old style crud actions
## (more options discussed in gluon/tools.py)
#

from gluon.tools import Auth, Service, PluginManager

auth = Auth(db)
service = Service()
plugins = PluginManager()


from gluon.contrib.login_methods.gae_google_account import GaeGoogleAccount
auth.settings.login_form = GaeGoogleAccount()...

My 0.py

<https://lh3.googleusercontent.com/-DPl8GXHsfcg/WKN-cXjRwuI/D7A/gRtaU4RWWgsxwo3dftyrWeXS6OhXz9ypQCLcB/s1600/Selecci%25C3%25B3n_092.png>

Just don't know what happen because it has been working well for almost one 
year.



El martes, 14 de febrero de 2017, 15:57:05 (UTC+1), Richard escribió:
>
> Can you show us more of your conf, there is maybe other things involve 
> here.
>
> Richard
>
> On Tue, Feb 14, 2017 at 4:50 AM, Jacinto Parga <jpa...@gmail.com 
> > wrote:
>
>> Hi, 
>> I have had google appengine error like this:
>>
>>
>> <https://lh3.googleusercontent.com/-FFLxC05WjF8/WKLRr-_redI/D6s/RYhhTsb-Y3kcDTHOMcIEpnFkO78F8ylYwCLcB/s1600/Selecci%25C3%25B3n_183.png>
>>
>>
>> Any auth.has_membership in menu.py raised this error.
>>
>>
>> I finally solved setting *myconf = AppConfig(reload=True) *in db.py 
>>
>>
>> I had previously set it to False.
>>
>>
>> But I still don't know why this error raised.
>>
>>
>>
>> -- 
>> 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+un...@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] Issue width auht.has_mermbership in menu.py

2017-02-14 Thread Jacinto Parga
Hi, 
I have had google appengine error like this:




Any auth.has_membership in menu.py raised this error.


I finally solved setting *myconf = AppConfig(reload=True) *in db.py 


I had previously set it to False.


But I still don't know why this error raised.



-- 
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: Password Recovery Not Sending (lazyT object being passed to GAE?)

2017-02-14 Thread Jacinto Parga
I just did a workaround with my own password reset function.

El miércoles, 5 de octubre de 2016, 1:46:41 (UTC+2), webm...@trytha.com 
escribió:
>
> So has this and the DAL issue with GAE been addressed?  Should I try the 
> latest version of web2py or is it a waste of time?  I'd really prefer to 
> use a later version because 2.12.2 (the latest version of web2py that fully 
> works with GAE) has a bug that logs users out randomly.
>
> Could we just have ONE version of web2py that works completely with GAE? 
>  Right now it's like Frankenstein's monster.
>
> On Saturday, September 24, 2016 at 9:11:43 AM UTC-7, Jacinto Parga wrote:
>>
>>
>> Unfortunatly it didn't work for me.
>>
>> Is it a translation issue? Can it be solved changing the auth_user 
>> messages?
>>
>> I think it is an important bug!! I can send mails with my application 
>> form GAE, there is no problem at all. But when someone is singing up it is 
>> "Unable to send mail!" Same happens width reset_request_password.
>>
>> Expecting for solution.
>>
>>
>> El viernes, 23 de septiembre de 2016, 9:05:32 (UTC+2), Mathieu Clabaut 
>> escribió:
>>>
>>> I had a probably similar problem that I solved by patching pydal.
>>> See https://github.com/web2py/pydal/issues/403 
>>> <https://github.com/web2py/pydal/issues/403#issuecomment-238115508> and 
>>> https://github.com/web2py/pydal/pull/404.
>>>
>>> However, as mention in the issue thread,  the change shall be done in 
>>> web2py.
>>>
>>> Alas, I did not have time to try to reproduce with a more recent web2py.
>>> If you use a recent web2py and the dal PR#404 solves the problem for 
>>> you, then I propose that you open a new bug in web2py.
>>>
>>> Best regards,
>>> -Mathieu
>>>
>>>
>>>
>>> On Thu, Sep 22, 2016 at 9:17 PM Jacinto Parga <jpa...@gmail.com> wrote:
>>>
>>>> The same error when I try to register an user: Unable to send email.
>>>>
>>>>
>>>> Mail.send failure:coercing to Unicode: need string or buffer, lazyT 
>>>> found
>>>>
>>>> I don't know what to do
>>>>
>>>>
>>>> El domingo, 31 de julio de 2016, 8:36:02 (UTC+2), Massimo Di Pierro 
>>>> escribió:
>>>>
>>>>> OK. will check this today.
>>>>>
>>>>> On Friday, 29 July 2016 15:40:26 UTC-5, webm...@trytha.com wrote:
>>>>>>
>>>>>> Nope, same error in:  2.14.6-stable+timestamp.2016.05.10.00.21.47 
>>>>>> (the source code off the web2py site).
>>>>>>
>>>>>> If you want me to try a nightly or something, let me know.
>>>>>>
>>>>>> The only semi-unique thing about my app is that I allow usernames for 
>>>>>> login as well.  Here is my default/user():
>>>>>>
>>>>>> def user():
>>>>>>
>>>>>> db.auth_user.first_name.writable = False
>>>>>> db.auth_user.last_name.writable = False
>>>>>>
>>>>>> # NOTE: This is an addition I found that enables using usernames 
>>>>>> (default is email as login).
>>>>>> if 'login' in request.args:
>>>>>> db.auth_user.username.label   = T('Username or Email')
>>>>>> auth.settings.login_userfield = 'username'
>>>>>> if request.vars.username and not IS_EMAIL()(request.vars.username)[1]:
>>>>>> auth.settings.login_userfield = 'email'
>>>>>> request.vars.email= request.vars.username
>>>>>> request.post_vars.email   = request.vars.email
>>>>>> request.vars.username = None
>>>>>> request.post_vars.username= None
>>>>>>
>>>>>>
>>>>>>
>>>>>> return dict(form = auth())
>>>>>>
>>>>>> Everything was working fine in 2.12.2, but I can't say for certain it 
>>>>>> was working in my 2.13 deployment.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Friday, July 29, 2016 at 6:26:11 AM UTC-7, Massimo Di Pierro wrote:
>>>>>>>
>>>>>>> This may have been fixed already. Can you upgrade and try it?
>>>>>>>
>>>>>>> On Friday, 29 July 2016 00:49:14 UTC-5, webm...@trytha.com wrote:
>&g

[web2py] Re: jquery 1.12.2 vulnerability

2017-02-14 Thread Jacinto Parga
Yeap thanks

El miércoles, 14 de diciembre de 2016, 20:36:49 (UTC+1), Niphlod escribió:
>
> you are free to use whatever you may like in your own app. 
> btw, jquery 1.12.2 afaik is not vulnerable, just "old".
>
> On Monday, December 12, 2016 at 7:53:29 PM UTC+1, Jacinto Parga wrote:
>>
>>
>> Hi, 
>>
>> I have recently made a security analisys in a web application deployed 
>> with web2py in Google App Engine. A jquery 1.12.2 vulnerability was the 
>> result:
>>
>>
>> <https://lh3.googleusercontent.com/-_948VymoqCk/WE7xyLyXkRI/DbE/qMvyCfHqKyUoRVpoDOWBdFgRWUQWFwSAwCLcB/s1600/Selecci%25C3%25B3n_046.png>
>>
>>

-- 
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] jquery 1.12.2 vulnerability

2016-12-12 Thread Jacinto Parga

Hi, 

I have recently made a security analisys in a web application deployed with 
web2py in Google App Engine. A jquery 1.12.2 vulnerability was the result:



-- 
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: Password Recovery Not Sending (lazyT object being passed to GAE?)

2016-09-24 Thread Jacinto Parga

Unfortunatly it didn't work for me.

Is it a translation issue? Can it be solved changing the auth_user messages?

I think it is an important bug!! I can send mails with my application form 
GAE, there is no problem at all. But when someone is singing up it is 
"Unable to send mail!" Same happens width reset_request_password.

Expecting for solution.


El viernes, 23 de septiembre de 2016, 9:05:32 (UTC+2), Mathieu Clabaut 
escribió:
>
> I had a probably similar problem that I solved by patching pydal.
> See https://github.com/web2py/pydal/issues/403 
> <https://github.com/web2py/pydal/issues/403#issuecomment-238115508> and 
> https://github.com/web2py/pydal/pull/404.
>
> However, as mention in the issue thread,  the change shall be done in 
> web2py.
>
> Alas, I did not have time to try to reproduce with a more recent web2py.
> If you use a recent web2py and the dal PR#404 solves the problem for you, 
> then I propose that you open a new bug in web2py.
>
> Best regards,
> -Mathieu
>
>
>
> On Thu, Sep 22, 2016 at 9:17 PM Jacinto Parga <jpa...@gmail.com 
> > wrote:
>
>> The same error when I try to register an user: Unable to send email.
>>
>>
>> Mail.send failure:coercing to Unicode: need string or buffer, lazyT found
>>
>> I don't know what to do
>>
>>
>> El domingo, 31 de julio de 2016, 8:36:02 (UTC+2), Massimo Di Pierro 
>> escribió:
>>
>>> OK. will check this today.
>>>
>>> On Friday, 29 July 2016 15:40:26 UTC-5, webm...@trytha.com wrote:
>>>>
>>>> Nope, same error in:  2.14.6-stable+timestamp.2016.05.10.00.21.47 (the 
>>>> source code off the web2py site).
>>>>
>>>> If you want me to try a nightly or something, let me know.
>>>>
>>>> The only semi-unique thing about my app is that I allow usernames for 
>>>> login as well.  Here is my default/user():
>>>>
>>>> def user():
>>>>
>>>> db.auth_user.first_name.writable = False
>>>> db.auth_user.last_name.writable = False
>>>>
>>>> # NOTE: This is an addition I found that enables using usernames 
>>>> (default is email as login).
>>>> if 'login' in request.args:
>>>> db.auth_user.username.label   = T('Username or Email')
>>>> auth.settings.login_userfield = 'username'
>>>> if request.vars.username and not IS_EMAIL()(request.vars.username)[1]:
>>>> auth.settings.login_userfield = 'email'
>>>> request.vars.email= request.vars.username
>>>> request.post_vars.email   = request.vars.email
>>>> request.vars.username = None
>>>> request.post_vars.username= None
>>>>
>>>>
>>>>
>>>> return dict(form = auth())
>>>>
>>>> Everything was working fine in 2.12.2, but I can't say for certain it 
>>>> was working in my 2.13 deployment.
>>>>
>>>>
>>>>
>>>>
>>>> On Friday, July 29, 2016 at 6:26:11 AM UTC-7, Massimo Di Pierro wrote:
>>>>>
>>>>> This may have been fixed already. Can you upgrade and try it?
>>>>>
>>>>> On Friday, 29 July 2016 00:49:14 UTC-5, webm...@trytha.com wrote:
>>>>>>
>>>>>> I just uploaded an updated version of web2py to my server, replacing 
>>>>>> a much older version (likely 2.12.2), and now it won't send password 
>>>>>> recovery emails.  The error in the logs is: 
>>>>>>
>>>>>> Mail.send failure:coercing to Unicode: need string or buffer, lazyT 
>>>>>> found
>>>>>>
>>>>>> This suggests to me that somehow a string is not properly being 
>>>>>> passed.  I gather that lazyT has something to do with the built-in 
>>>>>> translation capabilities of web2py?  Probably don't need to be 
>>>>>> translating 
>>>>>> email addresses (though I guess it could be trying to translate the 
>>>>>> recovery message).  Either way, GAE wants nothing to do with it.
>>>>>>
>>>>>> How can I 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+un...@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] Re: Password Recovery Not Sending (lazyT object being passed to GAE?)

2016-09-22 Thread Jacinto Parga
The same error when I try to register an user: Unable to send email.

Mail.send failure:coercing to Unicode: need string or buffer, lazyT found

I don't know what to do

El domingo, 31 de julio de 2016, 8:36:02 (UTC+2), Massimo Di Pierro 
escribió:
>
> OK. will check this today.
>
> On Friday, 29 July 2016 15:40:26 UTC-5, webm...@trytha.com  
> wrote:
>>
>> Nope, same error in:  2.14.6-stable+timestamp.2016.05.10.00.21.47 (the 
>> source code off the web2py site).
>>
>> If you want me to try a nightly or something, let me know.
>>
>> The only semi-unique thing about my app is that I allow usernames for 
>> login as well.  Here is my default/user():
>>
>> def user():
>>
>> db.auth_user.first_name.writable = False
>> db.auth_user.last_name.writable = False
>>
>> # NOTE: This is an addition I found that enables using usernames (default 
>> is email as login).
>> if 'login' in request.args:
>> db.auth_user.username.label   = T('Username or Email')
>> auth.settings.login_userfield = 'username'
>> if request.vars.username and not IS_EMAIL()(request.vars.username)[1]:
>> auth.settings.login_userfield = 'email'
>> request.vars.email= request.vars.username
>> request.post_vars.email   = request.vars.email
>> request.vars.username = None
>> request.post_vars.username= None
>>
>>
>>
>> return dict(form = auth())
>>
>> Everything was working fine in 2.12.2, but I can't say for certain it was 
>> working in my 2.13 deployment.
>>
>>
>>
>>
>> On Friday, July 29, 2016 at 6:26:11 AM UTC-7, Massimo Di Pierro wrote:
>>>
>>> This may have been fixed already. Can you upgrade and try it?
>>>
>>> On Friday, 29 July 2016 00:49:14 UTC-5, webm...@trytha.com wrote:

 I just uploaded an updated version of web2py to my server, replacing a 
 much older version (likely 2.12.2), and now it won't send password 
 recovery 
 emails.  The error in the logs is: 

 Mail.send failure:coercing to Unicode: need string or buffer, lazyT 
 found

 This suggests to me that somehow a string is not properly being passed. 
  I gather that lazyT has something to do with the built-in translation 
 capabilities of web2py?  Probably don't need to be translating email 
 addresses (though I guess it could be trying to translate the recovery 
 message).  Either way, GAE wants nothing to do with it.

 How can I 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] Re: Password Recovery Not Sending (lazyT object being passed to GAE?)

2016-09-06 Thread Jacinto Parga
Yes, It is also in Google App engine. 

I could find several differences between files gluon/tools.py

I guess it has something to do with it as the GAE warning said, but I can't 
solve it.

This is what I get when I try to request reset password 

<https://lh3.googleusercontent.com/-ZoDv29EG1Hw/V87jnSuuCGI/Cnw/JSEK0KjqFU42TsvrYtWSMeJsdvX6ylAywCLcB/s1600/Selecci%25C3%25B3n_034.png>

Help would be appreciated!


El lunes, 5 de septiembre de 2016, 21:18:18 (UTC+2), webm...@trytha.com 
escribió:
>
> I've been working on a lot of other little things and haven't had a chance 
> to test yet.  Is yours also on Google App Engine?
>
> One thing to try would be to use version 2.12.2 of web2py to see if that 
> fixes it.  Diagnosing the issue is on my very short list of things to do.
>
> On Monday, September 5, 2016 at 11:39:08 AM UTC-7, Jacinto Parga wrote:
>>
>> I have the same problem
>>
>>
>> 20:30:08.307Mail.send failure:coercing to Unicode: need string or buffer, 
>> lazyT found ( 
>> <https://console.cloud.google.com/debug/fromlog?appModule=default=0=%2Fbase%2Fdata%2Fhome%2Fapps%2Fe~canal-etico-marcafranca%2F0.395432313309680422%2Fgluon%2Ftools.py=808=2016-09-05%7C11%3A30%3A11.760266-07%7C10.106.195.196%7C1711941905=147310020794505=0=canal-etico-marcafranca>
>> /base/data/home/apps/e~canal-etico-marcafranca/0.395432313309680422/gluon
>> /tools.py:808 
>> <https://console.cloud.google.com/debug/fromlog?appModule=default=0=%2Fbase%2Fdata%2Fhome%2Fapps%2Fe~canal-etico-marcafranca%2F0.395432313309680422%2Fgluon%2Ftools.py=808=2016-09-05%7C11%3A30%3A11.760266-07%7C10.106.195.196%7C1711941905=147310020794505=0=canal-etico-marcafranca>
>> )
>>
>>
>>
>>
>> El domingo, 31 de julio de 2016, 8:36:02 (UTC+2), Massimo Di Pierro 
>> escribió:
>>>
>>> OK. will check this today.
>>>
>>> On Friday, 29 July 2016 15:40:26 UTC-5, webm...@trytha.com wrote:
>>>>
>>>> Nope, same error in:  2.14.6-stable+timestamp.2016.05.10.00.21.47 (the 
>>>> source code off the web2py site).
>>>>
>>>> If you want me to try a nightly or something, let me know.
>>>>
>>>> The only semi-unique thing about my app is that I allow usernames for 
>>>> login as well.  Here is my default/user():
>>>>
>>>> def user():
>>>>
>>>> db.auth_user.first_name.writable = False
>>>> db.auth_user.last_name.writable = False
>>>>
>>>> # NOTE: This is an addition I found that enables using usernames 
>>>> (default is email as login).
>>>> if 'login' in request.args:
>>>> db.auth_user.username.label   = T('Username or Email')
>>>> auth.settings.login_userfield = 'username'
>>>> if request.vars.username and not IS_EMAIL()(request.vars.username)[1]:
>>>> auth.settings.login_userfield = 'email'
>>>> request.vars.email= request.vars.username
>>>> request.post_vars.email   = request.vars.email
>>>> request.vars.username = None
>>>> request.post_vars.username= None
>>>>
>>>>
>>>>
>>>> return dict(form = auth())
>>>>
>>>> Everything was working fine in 2.12.2, but I can't say for certain it 
>>>> was working in my 2.13 deployment.
>>>>
>>>>
>>>>
>>>>
>>>> On Friday, July 29, 2016 at 6:26:11 AM UTC-7, Massimo Di Pierro wrote:
>>>>>
>>>>> This may have been fixed already. Can you upgrade and try it?
>>>>>
>>>>> On Friday, 29 July 2016 00:49:14 UTC-5, webm...@trytha.com wrote:
>>>>>>
>>>>>> I just uploaded an updated version of web2py to my server, replacing 
>>>>>> a much older version (likely 2.12.2), and now it won't send password 
>>>>>> recovery emails.  The error in the logs is: 
>>>>>>
>>>>>> Mail.send failure:coercing to Unicode: need string or buffer, lazyT 
>>>>>> found
>>>>>>
>>>>>> This suggests to me that somehow a string is not properly being 
>>>>>> passed.  I gather that lazyT has something to do with the built-in 
>>>>>> translation capabilities of web2py?  Probably don't need to be 
>>>>>> translating 
>>>>>> email addresses (though I guess it could be trying to translate the 
>>>>>> recovery message).  Either way, GAE wants nothing to do with it.
>>>>>>
>>>>>> How can I 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] Re: Password Recovery Not Sending (lazyT object being passed to GAE?)

2016-09-05 Thread Jacinto Parga
I have the same problem


20:30:08.307Mail.send failure:coercing to Unicode: need string or buffer, 
lazyT found ( 

/base/data/home/apps/e~canal-etico-marcafranca/0.395432313309680422/gluon/
tools.py:808 

)




El domingo, 31 de julio de 2016, 8:36:02 (UTC+2), Massimo Di Pierro 
escribió:
>
> OK. will check this today.
>
> On Friday, 29 July 2016 15:40:26 UTC-5, webm...@trytha.com  
> wrote:
>>
>> Nope, same error in:  2.14.6-stable+timestamp.2016.05.10.00.21.47 (the 
>> source code off the web2py site).
>>
>> If you want me to try a nightly or something, let me know.
>>
>> The only semi-unique thing about my app is that I allow usernames for 
>> login as well.  Here is my default/user():
>>
>> def user():
>>
>> db.auth_user.first_name.writable = False
>> db.auth_user.last_name.writable = False
>>
>> # NOTE: This is an addition I found that enables using usernames (default 
>> is email as login).
>> if 'login' in request.args:
>> db.auth_user.username.label   = T('Username or Email')
>> auth.settings.login_userfield = 'username'
>> if request.vars.username and not IS_EMAIL()(request.vars.username)[1]:
>> auth.settings.login_userfield = 'email'
>> request.vars.email= request.vars.username
>> request.post_vars.email   = request.vars.email
>> request.vars.username = None
>> request.post_vars.username= None
>>
>>
>>
>> return dict(form = auth())
>>
>> Everything was working fine in 2.12.2, but I can't say for certain it was 
>> working in my 2.13 deployment.
>>
>>
>>
>>
>> On Friday, July 29, 2016 at 6:26:11 AM UTC-7, Massimo Di Pierro wrote:
>>>
>>> This may have been fixed already. Can you upgrade and try it?
>>>
>>> On Friday, 29 July 2016 00:49:14 UTC-5, webm...@trytha.com wrote:

 I just uploaded an updated version of web2py to my server, replacing a 
 much older version (likely 2.12.2), and now it won't send password 
 recovery 
 emails.  The error in the logs is: 

 Mail.send failure:coercing to Unicode: need string or buffer, lazyT 
 found

 This suggests to me that somehow a string is not properly being passed. 
  I gather that lazyT has something to do with the built-in translation 
 capabilities of web2py?  Probably don't need to be translating email 
 addresses (though I guess it could be trying to translate the recovery 
 message).  Either way, GAE wants nothing to do with it.

 How can I 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] Re: Display value from reference fields and not ids in SQLFORM.grid

2016-09-05 Thread Jacinto Parga
That's what I did in controller:

db.table2.field2.represent = lambda s,r: db(db.table1.id == 
s).select(db.table1.field2).first().field2



El viernes, 4 de septiembre de 2015, 22:57:27 (UTC+2), LoveWeb2py escribió:
>
> And of course I find it within a minute of posting... lol
>
> Here is my solution:
>
>
> in model:
> db.define_table('table2',
>  Field('field1','reference table1'),
>  Field('field2','reference table1', requires=IS_IN_DB(db, 
> db.table1.id, '%(field2)s')),
>  migrate=False)
>
> in controller:
> db.table2.field2.represent = lambda s,r: s.field2
> grid=SQLFORM.smartgrid(table2)
> return dict(grid=grid)
>
> Hope this helps someone in the future. Time for beer!
>
>
>
>
> On Friday, September 4, 2015 at 4:49:31 PM UTC-4, LoveWeb2py wrote:
>>
>> I've been struggling with this for hours! 
>>
>> db.define_table('table1',
>>   Field('field1', 'string'),
>>   Field('field2','date'),
>>   format='%(field1)s %(field2)s', migrate=False)
>>
>> db.define_table('table2',
>>  Field('field1','reference table1'),
>>  Field('field2','reference table1'),
>>  migrate=False)
>>
>> I'm trying to show table2 in a SQLFORM, but it only shows the field 1 
>> values, for both fields. I want to show field 2 values  in table 1 for 
>> table 2. In SQLFORM.grid it only returns the id instead of the grid.
>>
>> I'm so frustrated! 
>>
>> I've tried:
>> https://groups.google.com/forum/#!topic/web2py/bO1N4r2j0Dg
>>
>> http://stackoverflow.com/questions/1012179/how-to-generate-a-many-to-many-relationship-form-in-web2py
>> http://markmail.org/message/usmvxp5zctssog7d
>>
>  
>
>>
>> Any advice is greatly appreciated. I'm sure it's something simple, but I 
>> just can't seem to find it.
>>
>

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


[web2py] Re: Problem running GAE SDK with web2py 2.14.5

2016-05-10 Thread Jacinto Parga
Deploying GAE-applications with web2py 2.14.5 linux, GAE SDK 1.9.37 seems ok

El lunes, 18 de abril de 2016, 13:09:27 (UTC+2), Tommi Lahtonen escribió:
>
> I already asked about this in this thread:
> https://groups.google.com/forum/#!topic/web2py/RVhRsRdXrYI
>
> I have reported the defect to google but so far no help from them:
>
> https://code.google.com/p/googleappengine/issues/detail?id=12852=4=ID%20Type%20Component%20Status%20Stars%20Summary%20Language%20Priority%20Owner%20Log
>
> It looks like developing GAE-applications with web2py and Google App 
> Engine Launcher is impossible right now.
>

-- 
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: letsencrypt google appengine with web2py

2016-03-06 Thread Jacinto Parga
With GAE deployed apps...

The best solution I've found is using an error handler and a redirection to 
the static file with the letsencrypt response. Something like this:

In routes.py:

routes_onerror = [
('myapp/*', '/myapp/default/error_handler')
]

In the error_handler controller:

def error_handler():
...
  requested_uri = request.vars.requested_uri
  if str(requested_uri)[:28] == "/.well-known/acme-challenge/" :
redirect("http://mysite/filewithaccesstoletsencrypt.txt;)
...




El lunes, 7 de diciembre de 2015, 10:24:48 (UTC+1), Jacinto Parga escribió:
>
> Hi, 
>
> I want to use letsencrypt ssl certificates ( https://letsencrypt.org/ ) 
> in a web2py application deployed on GAE.
>
> There is a good explanation about how to get it:  
> http://blog.seafuj.com/lets-encrypt-on-google-app-engine
>
> But I don't know how to deploy a view like : http://
> www.example.com/.well-known/acme-challenge/[challenge] 
> <http://www.example.com/.well-known/acme-challenge/%5Bchallenge%5D>
>
> I have given all steps, I have created the certificates and the keys. The 
> only thing I need is to create a view to let letsencrypt to confirm the 
> proper response.
>
> In other words, I need to make this code work on web2py: 
> class LetsEncryptHandler(RequestHandler):
>
> def get(self, challenge):
> self.response.headers['Content-Type'] = 'text/plain'
> responses = {
> '[challenge 1]': '[response 1]'
> '[challenge 2]': '[response 2]'
> }
> self.response.write(responses.get(challenge, ''))
>
> application = WSGIApplication([
> ('/.well-known/acme-challenge/([\w-]+)', LetsEncryptHandler),
> ])...
>
> Any idea?
>

-- 
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: How to use Let's Encrypt with Web2Py on Apache

2016-03-06 Thread Jacinto Parga
It's ok.  I have already solved it with routes.py and the error handler.

Thanks anyway

El sábado, 5 de marzo de 2016, 0:30:35 (UTC+1), Jacinto Parga escribió:
>
> How can routes.py be configured to return the requested file?
>
> The page requested is something like this:
>
>
> http://example.com/.well-known/acme-challenge/dkB1xZ7bb_x1JgWilNwyYNrteHPUoqnLvNfnn3gS3b0
>
> The response is a plain text, something like this:
>
>
> EZvKzpPMR2sCRRPqfyi_fOBvx9cV9FS59jmTpAMsLlc.wsviFLCnmgajAEkPk0QNPbOowoXWV4hIjs1Sxb_fAt8
>
> I don't know how to do it using routes.py
>
> I am running my application on Google App Engine
>
> El sábado, 23 de enero de 2016, 16:52:33 (UTC+1), Anthony escribió:
>>
>> You could configure Apache itself to respond, or you can use web2py's 
>> routes.py to route the incoming request to a controller that then returns 
>> the requested file.
>>
>> Anthony
>>
>> On Saturday, January 23, 2016 at 10:30:52 AM UTC-5, Jean-François Milants 
>> wrote:
>>>
>>> Hi,
>>>
>>> I would like to get certificates from Let's Encrypt (
>>> https://letsencrypt.org/) for my Web2Py applications, but I don't know 
>>> how to make it work with Let's Encrypt.
>>>
>>> I already manage to get a certificate for a PHP application, using the 
>>> --webroot method. This method creates a temporary file in 
>>> "${webroot-path}/.well-known/acme-challenge" 
>>> to check the validity of the domain/server/... Then, the server from Let's 
>>> Encrypt do an HTTP GET command on this file.
>>>
>>> How to do this with Web2Py? How to make Web2Py answer to a request on a 
>>> file that is not in a controller/view? 
>>>
>>> NOTE : my applications runs on Apache2.2, using the WSGI handler.
>>>
>>> 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: How to use Let's Encrypt with Web2Py on Apache

2016-03-04 Thread Jacinto Parga
How can routes.py be configured to return the requested file?

The page requested is something like this:

http://example.com/.well-known/acme-challenge/dkB1xZ7bb_x1JgWilNwyYNrteHPUoqnLvNfnn3gS3b0

The response is a plain text, something like this:

EZvKzpPMR2sCRRPqfyi_fOBvx9cV9FS59jmTpAMsLlc.wsviFLCnmgajAEkPk0QNPbOowoXWV4hIjs1Sxb_fAt8

I don't know how to do it using routes.py

I am running my application on Google App Engine

El sábado, 23 de enero de 2016, 16:52:33 (UTC+1), Anthony escribió:
>
> You could configure Apache itself to respond, or you can use web2py's 
> routes.py to route the incoming request to a controller that then returns 
> the requested file.
>
> Anthony
>
> On Saturday, January 23, 2016 at 10:30:52 AM UTC-5, Jean-François Milants 
> wrote:
>>
>> Hi,
>>
>> I would like to get certificates from Let's Encrypt (
>> https://letsencrypt.org/) for my Web2Py applications, but I don't know 
>> how to make it work with Let's Encrypt.
>>
>> I already manage to get a certificate for a PHP application, using the 
>> --webroot method. This method creates a temporary file in 
>> "${webroot-path}/.well-known/acme-challenge" 
>> to check the validity of the domain/server/... Then, the server from Let's 
>> Encrypt do an HTTP GET command on this file.
>>
>> How to do this with Web2Py? How to make Web2Py answer to a request on a 
>> file that is not in a controller/view? 
>>
>> NOTE : my applications runs on Apache2.2, using the WSGI handler.
>>
>> 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: web2py 2.13.3 is OUT

2016-01-04 Thread Jacinto Parga
Hi, 

I upgraded from 2.11.2

I get a error ticket when I deploy to GAE:

Traceback (most recent call last):
  File 
"/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py"
, line 240, in Handle
handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
  File 
"/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py"
, line 299, in _LoadHandler
handler, path, err = LoadObject(self._handler)
  File 
"/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py"
, line 85, in LoadObject
obj = __import__(path[0])
  File 
"/base/data/home/apps/s~clubatletismosada/2.389741792186866429/gaehandler.py"
, line 62 

, in 
import gluon.main
  File 
"/base/data/home/apps/s~clubatletismosada/2.389741792186866429/gluon/main.py"
, line 85 

, in 
logging.config.fileConfig(abspath("logging.conf"))
  File 
"/base/data/home/runtimes/python27/python27_dist/lib/python2.7/logging/config.py"
, line 78, in fileConfig
handlers = _install_handlers(cp, formatters)
  File 
"/base/data/home/runtimes/python27/python27_dist/lib/python2.7/logging/config.py"
, line 156, in _install_handlers
h = klass(*args)
  File 
"/base/data/home/runtimes/python27/python27_dist/lib/python2.7/logging/handlers.py"
, line 117, in __init__
BaseRotatingHandler.__init__(self, filename, mode, encoding, delay)
  File 
"/base/data/home/runtimes/python27/python27_dist/lib/python2.7/logging/handlers.py"
, line 64, in __init__
logging.FileHandler.__init__(self, filename, mode, encoding, delay)
  File 
"/base/data/home/runtimes/python27/python27_dist/lib/python2.7/logging/__init__.py"
, line 902, in __init__
StreamHandler.__init__(self, self._open())
  File 
"/base/data/home/runtimes/python27/python27_dist/lib/python2.7/logging/__init__.py"
, line 925, in _open
stream = open(self.baseFilename, self.mode)
IOError: [Errno 30] Read-only file system: 
'/base/data/home/apps/s~clubatletismosada/2.389741792186866429/logs/web2py.log'

Maybe I have missed something with the handlers?

El jueves, 24 de diciembre de 2015, 16:21:42 (UTC+1), Massimo Di Pierro 
escribió:
>
> 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

2016-01-04 Thread Jacinto Parga
I have solved it. 

I have removed *logging.conf* file from the web2py folder, but I don't 
 know if it has undesidered consecuences!

Can it be harmful?

Thanks!

El lunes, 4 de enero de 2016, 11:52:22 (UTC+1), Jacinto Parga escribió:
>
> Hi, 
>
> I upgraded from 2.11.2
>
> I get a error ticket when I deploy to GAE:
>
> Traceback (most recent call last):
>   File 
> "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py"
> , line 240, in Handle
> handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
>   File 
> "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py"
> , line 299, in _LoadHandler
> handler, path, err = LoadObject(self._handler)
>   File 
> "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py"
> , line 85, in LoadObject
> obj = __import__(path[0])
>   File 
> "/base/data/home/apps/s~clubatletismosada/2.389741792186866429/gaehandler.py"
> , line 62 
> <https://console.developers.google.com/debug/resolve_location?appModule=default=2=145190133855273=%2Fbase%2Fdata%2Fhome%2Fapps%2Fs~clubatletismosada%2F2.389741792186866429%2Fgaehandler.py=62=clubatletismosada>
> , in 
> import gluon.main
>   File 
> "/base/data/home/apps/s~clubatletismosada/2.389741792186866429/gluon/main.py"
> , line 85 
> <https://console.developers.google.com/debug/resolve_location?appModule=default=2=145190133855273=%2Fbase%2Fdata%2Fhome%2Fapps%2Fs~clubatletismosada%2F2.389741792186866429%2Fgluon%2Fmain.py=85=clubatletismosada>
> , in 
> logging.config.fileConfig(abspath("logging.conf"))
>   File 
> "/base/data/home/runtimes/python27/python27_dist/lib/python2.7/logging/config.py"
> , line 78, in fileConfig
> handlers = _install_handlers(cp, formatters)
>   File 
> "/base/data/home/runtimes/python27/python27_dist/lib/python2.7/logging/config.py"
> , line 156, in _install_handlers
> h = klass(*args)
>   File 
> "/base/data/home/runtimes/python27/python27_dist/lib/python2.7/logging/handlers.py"
> , line 117, in __init__
> BaseRotatingHandler.__init__(self, filename, mode, encoding, delay)
>   File 
> "/base/data/home/runtimes/python27/python27_dist/lib/python2.7/logging/handlers.py"
> , line 64, in __init__
> logging.FileHandler.__init__(self, filename, mode, encoding, delay)
>   File 
> "/base/data/home/runtimes/python27/python27_dist/lib/python2.7/logging/__init__.py"
> , line 902, in __init__
> StreamHandler.__init__(self, self._open())
>   File 
> "/base/data/home/runtimes/python27/python27_dist/lib/python2.7/logging/__init__.py"
> , line 925, in _open
> stream = open(self.baseFilename, self.mode)
> IOError: [Errno 30] Read-only file system: 
> '/base/data/home/apps/s~clubatletismosada/2.389741792186866429/logs/web2py.log'
>
> Maybe I have missed something with the handlers?
>
> El jueves, 24 de diciembre de 2015, 16:21:42 (UTC+1), Massimo Di Pierro 
> escribió:
>>
>> 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: letsencrypt google appengine with web2py

2015-12-14 Thread Jacinto Parga
Solved, thanks. It doesn't have to do with web2py. I solved it just with 
letsencrypt configuration.

El lunes, 7 de diciembre de 2015, 10:24:48 (UTC+1), Jacinto Parga escribió:
>
> Hi, 
>
> I want to use letsencrypt ssl certificates ( https://letsencrypt.org/ ) 
> in a web2py application deployed on GAE.
>
> There is a good explanation about how to get it:  
> http://blog.seafuj.com/lets-encrypt-on-google-app-engine
>
> But I don't know how to deploy a view like : http://
> www.example.com/.well-known/acme-challenge/[challenge] 
> <http://www.example.com/.well-known/acme-challenge/%5Bchallenge%5D>
>
> I have given all steps, I have created the certificates and the keys. The 
> only thing I need is to create a view to let letsencrypt to confirm the 
> proper response.
>
> In other words, I need to make this code work on web2py: 
> class LetsEncryptHandler(RequestHandler):
>
> def get(self, challenge):
> self.response.headers['Content-Type'] = 'text/plain'
> responses = {
> '[challenge 1]': '[response 1]'
> '[challenge 2]': '[response 2]'
> }
> self.response.write(responses.get(challenge, ''))
>
> application = WSGIApplication([
> ('/.well-known/acme-challenge/([\w-]+)', LetsEncryptHandler),
> ])...
>
> Any idea?
>

-- 
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] letsencrypt google appengine with web2py

2015-12-07 Thread Jacinto Parga
Hi, 

I want to use letsencrypt ssl certificates ( https://letsencrypt.org/ ) in 
a web2py application deployed on GAE.

There is a good explanation about how to get it:  
http://blog.seafuj.com/lets-encrypt-on-google-app-engine

But I don't know how to deploy a view like : http:
//www.example.com/.well-known/acme-challenge/[challenge]

I have given all steps, I have created the certificates and the keys. The 
only thing I need is to create a view to let letsencrypt to confirm the 
proper response.

In other words, I need to make this code work on web2py: 
class LetsEncryptHandler(RequestHandler):

def get(self, challenge):
self.response.headers['Content-Type'] = 'text/plain'
responses = {
'[challenge 1]': '[response 1]'
'[challenge 2]': '[response 2]'
}
self.response.write(responses.get(challenge, ''))

application = WSGIApplication([
('/.well-known/acme-challenge/([\w-]+)', LetsEncryptHandler),
])...

Any idea?

-- 
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: Error in GAE TypeError: ConjunctionNode()

2015-08-14 Thread Jacinto Parga
(query,fields,attributes)
  File 
/base/data/home/apps/s~clubatletismosada/2.386424209805371251/gluon/packages/dal/pydal/adapters/google_adapters.py
, line 376 
https://console.developers.google.com/project/clubatletismosada/clouddev/debug/resolve_location?appModule=defaultappVersion=2timestampNanos=143954268392200file=%2Fbase%2Fdata%2Fhome%2Fapps%2Fs~clubatletismosada%2F2.386424209805371251%2Fgluon%2Fpackages%2Fdal%2Fpydal%2Fadapters%2Fgoogle_adapters.pyline=376
, in select_raw
filters = self.expand(query)
  File 
/base/data/home/apps/s~clubatletismosada/2.386424209805371251/gluon/packages/dal/pydal/adapters/google_adapters.py
, line 237 
https://console.developers.google.com/project/clubatletismosada/clouddev/debug/resolve_location?appModule=defaultappVersion=2timestampNanos=143954268392200file=%2Fbase%2Fdata%2Fhome%2Fapps%2Fs~clubatletismosada%2F2.386424209805371251%2Fgluon%2Fpackages%2Fdal%2Fpydal%2Fadapters%2Fgoogle_adapters.pyline=237
, in expand
return expression.op(expression.first, expression.second)
  File 
/base/data/home/apps/s~clubatletismosada/2.386424209805371251/gluon/packages/dal/pydal/adapters/google_adapters.py
, line 257 
https://console.developers.google.com/project/clubatletismosada/clouddev/debug/resolve_location?appModule=defaultappVersion=2timestampNanos=143954268392200file=%2Fbase%2Fdata%2Fhome%2Fapps%2Fs~clubatletismosada%2F2.386424209805371251%2Fgluon%2Fpackages%2Fdal%2Fpydal%2Fadapters%2Fgoogle_adapters.pyline=257
, in AND
return ndb.AND(first, second)
  File 
/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/ext/ndb/query.py
, line 558, in __new__
' received a non-Node instance %r' % node)
TypeError: ConjunctionNode() expects Node instances as arguments; received 
a non-Node instance None



El jueves, 13 de agosto de 2015, 13:48:35 (UTC+2), Jacinto Parga escribió:

 I have an aplication deployed in GAE tha has been running for months with 
 no problem, but in the last deployment in GAE, it has raised a new error:

 TypeError: ConjunctionNode() expects Node instances as arguments; received 
 a non-Node instance None

 The error has to do with *IS_IN_DB* validator, and is has appeared in the 
 last deployment (today). It worked fine until now.

 This is the code: 

 def index_gestor():
 titulares = db(db.auth_user.tipo_usuario=='Titular')
 form = SQLFORM.factory(
 Field('socio', db.auth_user, requires = IS_IN_DB(titulares,'
 auth_user.id','%(last_name)s'+', '+ '%(first_name)s'+' - '+ 
 '%(f_numero_socio)s',sort=True)), 
 Field('consulta', type='string', requires = 
 IS_IN_SET(['Familiares', 'Movimientos','Pedidos']),default='Familiares'),
 buttons=[TAG.button('CONSULTAR',_type=submit, _class=btn 
 btn-warning btn-large)],
 table_name='seleccion_socios')
 if form.process().accepted:
 if form.vars.consulta == 'Familiares':
   
  
 redirect(URL(gestor,familiares_socio_manage.html,args=[form.vars.socio],user_signature=True))
 elif form.vars.consulta == 'Movimientos':
   
  
 redirect(URL(gestor,cuenta_socio_manage.html,args=[form.vars.socio],user_signature=True))
 elif form.vars.consulta == 'Pedidos':
   
  
 redirect(URL(gestor_productos,pedidos_por_socio,args=[form.vars.socio],user_signature=True))
 
 return locals()

 The problem is with the line  Field('socio', db.auth_user, requires = 
 IS_IN_DB(titulares,'auth_user.id','%(last_name)s'+', '+ 
 '%(first_name)s'+' - '+ '%(f_numero_socio)s',sort=True)), 

 This is the ticket: 

 Traceback (most recent call last): File 
 /base/data/home/apps/s~clubatletismosada/2.386403586504283664/gluon/restricted.py,
  
 line 227 
 https://console.developers.google.com/project/clubatletismosada/clouddev/debug/resolve_location?appModule=defaultappVersion=2timestampNanos=143946559800300file=%2Fbase%2Fdata%2Fhome%2Fapps%2Fs~clubatletismosada%2F2.386403586504283664%2Fgluon%2Frestricted.pyline=227,
  
 in restricted exec ccode in environment File 
 /base/data/home/apps/s~clubatletismosada/2.386403586504283664/applications/CAS/controllers/gestor.py,
  
 line 400 
 https://console.developers.google.com/project/clubatletismosada/clouddev/debug/resolve_location?appModule=defaultappVersion=2timestampNanos=143946559800300file=%2Fbase%2Fdata%2Fhome%2Fapps%2Fs~clubatletismosada%2F2.386403586504283664%2Fapplications%2FCAS%2Fcontrollers%2Fgestor.pyline=400,
  
 in module File 
 /base/data/home/apps/s~clubatletismosada/2.386403586504283664/gluon/globals.py,
  
 line 412 
 https://console.developers.google.com/project/clubatletismosada/clouddev/debug/resolve_location?appModule=defaultappVersion=2timestampNanos=143946559800300file=%2Fbase%2Fdata%2Fhome%2Fapps%2Fs~clubatletismosada%2F2.386403586504283664%2Fgluon%2Fglobals.pyline=412,
  
 in lambda self._caller = lambda f: f() File 
 /base/data/home/apps/s~clubatletismosada/2.386403586504283664/gluon/tools.py,
  
 line 3769 
 https

[web2py] Re: Error in GAE TypeError: ConjunctionNode()

2015-08-14 Thread Jacinto Parga
I surrender width *IS_IN_DB* and GAE

I finally solved it width a workaround using *IS_IN_SET:*

First I get rid off IS_IN_DB in my models requirements

titulares = db(db.auth_user.tipo_usuario=='Titular')
db.t_familiares.f_titular.requires= 
(IS_IN_DB(titulares,'auth_user.id','%(last_name)s'+', '+ '%(first_name)s'+' 
- '+ '%(f_numero_socio)s',sort=True))

Then I build a IS_IN_SET equivalent in the controllers

titulares 
=db(db.auth_user.tipo_usuario=='Titular').select(orderby=db.auth_user.last_name)
titu = []
for titulares in titulares:
titu.append((titulares.id,titulares.last_name + ' ' + 
titulares.first_name + '- ' +titulares.f_numero_socio))
db.t_familiares.f_titular.requires= IS_IN_SET(titu)
form = SQLFORM(db.t_familiares)

So *titulares.id* is the value I get and *titulares.last_name + '  ' 
+titulares.first_name + '-  ' +titulares.f_numero_socio *is the dropdown 
value

It seems to work fine.

May be someone has a better solution

El jueves, 13 de agosto de 2015, 13:48:35 (UTC+2), Jacinto Parga escribió:

 I have an aplication deployed in GAE tha has been running for months with 
 no problem, but in the last deployment in GAE, it has raised a new error:

 TypeError: ConjunctionNode() expects Node instances as arguments; received 
 a non-Node instance None

 The error has to do with *IS_IN_DB* validator, and is has appeared in the 
 last deployment (today). It worked fine until now.

 This is the code: 

 def index_gestor():
 titulares = db(db.auth_user.tipo_usuario=='Titular')
 form = SQLFORM.factory(
 Field('socio', db.auth_user, requires = IS_IN_DB(titulares,'
 auth_user.id','%(last_name)s'+', '+ '%(first_name)s'+' - '+ 
 '%(f_numero_socio)s',sort=True)), 
 Field('consulta', type='string', requires = 
 IS_IN_SET(['Familiares', 'Movimientos','Pedidos']),default='Familiares'),
 buttons=[TAG.button('CONSULTAR',_type=submit, _class=btn 
 btn-warning btn-large)],
 table_name='seleccion_socios')
 if form.process().accepted:
 if form.vars.consulta == 'Familiares':
   
  
 redirect(URL(gestor,familiares_socio_manage.html,args=[form.vars.socio],user_signature=True))
 elif form.vars.consulta == 'Movimientos':
   
  
 redirect(URL(gestor,cuenta_socio_manage.html,args=[form.vars.socio],user_signature=True))
 elif form.vars.consulta == 'Pedidos':
   
  
 redirect(URL(gestor_productos,pedidos_por_socio,args=[form.vars.socio],user_signature=True))
 
 return locals()

 The problem is with the line  Field('socio', db.auth_user, requires = 
 IS_IN_DB(titulares,'auth_user.id','%(last_name)s'+', '+ 
 '%(first_name)s'+' - '+ '%(f_numero_socio)s',sort=True)), 

 This is the ticket: 

 Traceback (most recent call last): File 
 /base/data/home/apps/s~clubatletismosada/2.386403586504283664/gluon/restricted.py,
  
 line 227 
 https://console.developers.google.com/project/clubatletismosada/clouddev/debug/resolve_location?appModule=defaultappVersion=2timestampNanos=143946559800300file=%2Fbase%2Fdata%2Fhome%2Fapps%2Fs~clubatletismosada%2F2.386403586504283664%2Fgluon%2Frestricted.pyline=227,
  
 in restricted exec ccode in environment File 
 /base/data/home/apps/s~clubatletismosada/2.386403586504283664/applications/CAS/controllers/gestor.py,
  
 line 400 
 https://console.developers.google.com/project/clubatletismosada/clouddev/debug/resolve_location?appModule=defaultappVersion=2timestampNanos=143946559800300file=%2Fbase%2Fdata%2Fhome%2Fapps%2Fs~clubatletismosada%2F2.386403586504283664%2Fapplications%2FCAS%2Fcontrollers%2Fgestor.pyline=400,
  
 in module File 
 /base/data/home/apps/s~clubatletismosada/2.386403586504283664/gluon/globals.py,
  
 line 412 
 https://console.developers.google.com/project/clubatletismosada/clouddev/debug/resolve_location?appModule=defaultappVersion=2timestampNanos=143946559800300file=%2Fbase%2Fdata%2Fhome%2Fapps%2Fs~clubatletismosada%2F2.386403586504283664%2Fgluon%2Fglobals.pyline=412,
  
 in lambda self._caller = lambda f: f() File 
 /base/data/home/apps/s~clubatletismosada/2.386403586504283664/gluon/tools.py,
  
 line 3769 
 https://console.developers.google.com/project/clubatletismosada/clouddev/debug/resolve_location?appModule=defaultappVersion=2timestampNanos=143946559800300file=%2Fbase%2Fdata%2Fhome%2Fapps%2Fs~clubatletismosada%2F2.386403586504283664%2Fgluon%2Ftools.pyline=3769,
  
 in f return action(*a, **b) File 
 /base/data/home/apps/s~clubatletismosada/2.386403586504283664/applications/CAS/controllers/gestor.py,
  
 line 12 
 https://console.developers.google.com/project/clubatletismosada/clouddev/debug/resolve_location?appModule=defaultappVersion=2timestampNanos=143946559800300file=%2Fbase%2Fdata%2Fhome%2Fapps%2Fs~clubatletismosada%2F2.386403586504283664%2Fapplications%2FCAS%2Fcontrollers%2Fgestor.pyline=12,
  
 in index_gestor table_name='seleccion_socios') File 
 /base/data/home/apps/s~clubatletismosada/2.386403586504283664/gluon/sqlhtml.py

[web2py] Error in GAE TypeError: ConjunctionNode()

2015-08-13 Thread Jacinto Parga
I have an aplication deployed in GAE tha has been running for months with 
no problem, but in the last deployment in GAE, it has raised a new error:

TypeError: ConjunctionNode() expects Node instances as arguments; received 
a non-Node instance None

The error has to do with *IS_IN_DB* validator, and is has appeared in the 
last deployment (today). It worked fine until now.

This is the code: 

def index_gestor():
titulares = db(db.auth_user.tipo_usuario=='Titular')
form = SQLFORM.factory(
Field('socio', db.auth_user, requires = 
IS_IN_DB(titulares,'auth_user.id','%(last_name)s'+', '+ '%(first_name)s'+' 
- '+ '%(f_numero_socio)s',sort=True)), 
Field('consulta', type='string', requires = 
IS_IN_SET(['Familiares', 'Movimientos','Pedidos']),default='Familiares'),
buttons=[TAG.button('CONSULTAR',_type=submit, _class=btn 
btn-warning btn-large)],
table_name='seleccion_socios')
if form.process().accepted:
if form.vars.consulta == 'Familiares':
  
 
redirect(URL(gestor,familiares_socio_manage.html,args=[form.vars.socio],user_signature=True))
elif form.vars.consulta == 'Movimientos':
  
 
redirect(URL(gestor,cuenta_socio_manage.html,args=[form.vars.socio],user_signature=True))
elif form.vars.consulta == 'Pedidos':
  
 
redirect(URL(gestor_productos,pedidos_por_socio,args=[form.vars.socio],user_signature=True))

return locals()

The problem is with the line  Field('socio', db.auth_user, requires = 
IS_IN_DB(titulares,'auth_user.id','%(last_name)s'+', '+ '%(first_name)s'+' 
- '+ '%(f_numero_socio)s',sort=True)), 

This is the ticket: 

Traceback (most recent call last): File 
/base/data/home/apps/s~clubatletismosada/2.386403586504283664/gluon/restricted.py,
 
line 227 
https://console.developers.google.com/project/clubatletismosada/clouddev/debug/resolve_location?appModule=defaultappVersion=2timestampNanos=143946559800300file=%2Fbase%2Fdata%2Fhome%2Fapps%2Fs~clubatletismosada%2F2.386403586504283664%2Fgluon%2Frestricted.pyline=227,
 
in restricted exec ccode in environment File 
/base/data/home/apps/s~clubatletismosada/2.386403586504283664/applications/CAS/controllers/gestor.py,
 
line 400 
https://console.developers.google.com/project/clubatletismosada/clouddev/debug/resolve_location?appModule=defaultappVersion=2timestampNanos=143946559800300file=%2Fbase%2Fdata%2Fhome%2Fapps%2Fs~clubatletismosada%2F2.386403586504283664%2Fapplications%2FCAS%2Fcontrollers%2Fgestor.pyline=400,
 
in module File 
/base/data/home/apps/s~clubatletismosada/2.386403586504283664/gluon/globals.py,
 
line 412 
https://console.developers.google.com/project/clubatletismosada/clouddev/debug/resolve_location?appModule=defaultappVersion=2timestampNanos=143946559800300file=%2Fbase%2Fdata%2Fhome%2Fapps%2Fs~clubatletismosada%2F2.386403586504283664%2Fgluon%2Fglobals.pyline=412,
 
in lambda self._caller = lambda f: f() File 
/base/data/home/apps/s~clubatletismosada/2.386403586504283664/gluon/tools.py, 
line 3769 
https://console.developers.google.com/project/clubatletismosada/clouddev/debug/resolve_location?appModule=defaultappVersion=2timestampNanos=143946559800300file=%2Fbase%2Fdata%2Fhome%2Fapps%2Fs~clubatletismosada%2F2.386403586504283664%2Fgluon%2Ftools.pyline=3769,
 
in f return action(*a, **b) File 
/base/data/home/apps/s~clubatletismosada/2.386403586504283664/applications/CAS/controllers/gestor.py,
 
line 12 
https://console.developers.google.com/project/clubatletismosada/clouddev/debug/resolve_location?appModule=defaultappVersion=2timestampNanos=143946559800300file=%2Fbase%2Fdata%2Fhome%2Fapps%2Fs~clubatletismosada%2F2.386403586504283664%2Fapplications%2FCAS%2Fcontrollers%2Fgestor.pyline=12,
 
in index_gestor table_name='seleccion_socios') File 
/base/data/home/apps/s~clubatletismosada/2.386403586504283664/gluon/sqlhtml.py,
 
line 1771 
https://console.developers.google.com/project/clubatletismosada/clouddev/debug/resolve_location?appModule=defaultappVersion=2timestampNanos=143946559800300file=%2Fbase%2Fdata%2Fhome%2Fapps%2Fs~clubatletismosada%2F2.386403586504283664%2Fgluon%2Fsqlhtml.pyline=1771,
 
in factory **attributes) File 
/base/data/home/apps/s~clubatletismosada/2.386403586504283664/gluon/sqlhtml.py,
 
line 1259 
https://console.developers.google.com/project/clubatletismosada/clouddev/debug/resolve_location?appModule=defaultappVersion=2timestampNanos=143946559800300file=%2Fbase%2Fdata%2Fhome%2Fapps%2Fs~clubatletismosada%2F2.386403586504283664%2Fgluon%2Fsqlhtml.pyline=1259,
 
in __init__ inp = self.widgets.options.widget(field, default) File 
/base/data/home/apps/s~clubatletismosada/2.386403586504283664/gluon/sqlhtml.py,
 
line 313 
https://console.developers.google.com/project/clubatletismosada/clouddev/debug/resolve_location?appModule=defaultappVersion=2timestampNanos=143946559800300file=%2Fbase%2Fdata%2Fhome%2Fapps%2Fs~clubatletismosada%2F2.386403586504283664%2Fgluon%2Fsqlhtml.pyline=313,
 
in widget 

[web2py] Re: Google Cloud Storage in GAE refresh token access

2015-02-26 Thread Jacinto Parga
Well, I have made a little progress 
: 
https://developers.google.com/api-client-library/python/guide/google_app_engine#Credentials

But, now the only question is how to get the modules:

type 'exceptions.ImportError' No module named appengine.api



El jueves, 26 de febrero de 2015, 8:48:46 (UTC+1), Jacinto Parga escribió:

 Hi, 

 I am using Google Cloud Storage (GCS) with web2py.

 I've implemented ( 
 https://cloud.google.com/storage/docs/json_api/v1/json-api-python-samples 
 ) it works fine in localhost or in systems where you can write in the 
 filesystem.

 But in Google App Engine (GAE) you can not write in the filesystem so it 
 doesn't create nor update *sample.dat*

  # If the credentials don't exist or are invalid run through the native client
   # flow. The Storage object will ensure that if successful the good
   # credentials will get written back to the file.
   storage = file.Storage('sample.dat')
   credentials = storage.get()
   if credentials is None or credentials.invalid:
 credentials = tools.run_flow(FLOW, storage, flags)

   # Create an httplib2.Http object to handle our HTTP requests and authorize 
 it

   # with our good Credentials.
   http = httplib2.Http()
   http = credentials.authorize(http)

   # Construct the service object for the interacting with the Cloud Storage 
 API.
   service = discovery.build('storage', _API_VERSION, http=http)


 The result is that anytime I deploy it in GAE it works fine until the 
 *token* stored in *sample.dat * expires. As soon as it expires it cannot 
 update the file so the access is revoked.

 Maybe I can change the file *sample.dat*  for a variable stored in a 
 table, something like this. 

 db.define_table('t_sample',
 Field('f_sampledat', type='text',  label=T('Mensaje')))

 But I haven't found how to do it right, how to store the content of 
 sample.dat and to access it in the same way. Any suggestion.

 The sample.dat file is like this:

 {_module: oauth2client.client, token_expiry: 2015-02-25T20:17:48Z,
  access_token: , 
 token_uri: https://accounts.google.com/o/oauth2/token;, invalid: 
 false, token_response: {access_token: 
 x, token_type:
  Bearer, expires_in: 3600}, client_id: 
 xx.apps.googleusercontent.com, id_token
 : null, client_secret: xxx, revoke_uri: 
 https://accounts.google.com/o/oauth2/revoke;, _class: 
 OAuth2Credentials, refresh_token: 
 x, 
 user_agent: null}



-- 
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] Google Cloud Storage in GAE refresh token access

2015-02-25 Thread Jacinto Parga
Hi, 

I am using Google Cloud Storage (GCS) with web2py.

I've implemented 
( https://cloud.google.com/storage/docs/json_api/v1/json-api-python-samples 
) it works fine in localhost or in systems where you can write in the 
filesystem.

But in Google App Engine (GAE) you can not write in the filesystem so it 
doesn't create nor update *sample.dat*

 # If the credentials don't exist or are invalid run through the native client
  # flow. The Storage object will ensure that if successful the good
  # credentials will get written back to the file.
  storage = file.Storage('sample.dat')
  credentials = storage.get()
  if credentials is None or credentials.invalid:
credentials = tools.run_flow(FLOW, storage, flags)

  # Create an httplib2.Http object to handle our HTTP requests and authorize it

  # with our good Credentials.
  http = httplib2.Http()
  http = credentials.authorize(http)

  # Construct the service object for the interacting with the Cloud Storage API.
  service = discovery.build('storage', _API_VERSION, http=http)


The result is that anytime I deploy it in GAE it works fine until the 
*token* stored in *sample.dat * expires. As soon as it expires it cannot 
update the file so the access is revoked.

Maybe I can change the file *sample.dat*  for a variable stored in a table, 
something like this. 

db.define_table('t_sample',
Field('f_sampledat', type='text',  label=T('Mensaje')))

But I haven't found how to do it right, how to store the content of 
sample.dat and to access it in the same way. Any suggestion.

The sample.dat file is like this:

{_module: oauth2client.client, token_expiry: 2015-02-25T20:17:48Z, 
access_token: , 
token_uri: https://accounts.google.com/o/oauth2/token;, invalid: false,
 token_response: {access_token: 
x, token_type: 
Bearer, expires_in: 3600}, client_id: 
xx.apps.googleusercontent.com, id_token:
 null, client_secret: xxx, revoke_uri: 
https://accounts.google.com/o/oauth2/revoke;, _class: OAuth2Credentials
, refresh_token: 
x, 
user_agent: null}

-- 
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] 2.9.12 app deploy in GAE error

2015-01-30 Thread Jacinto Parga
Hello,

I deploy an applicaction in GAE with 2.9.11 succesfully but If I try to 
deploy it with 2.9.12 I get the following ticket:

2015-01-30 14:31:41.094

 Unable to store in FILE: 
/base/data/home/apps/s~clubatletismosada/2.381882905081239360/applications/CAS/models/db.py

Traceback (most recent call last):
  File 
/base/data/home/apps/s~clubatletismosada/2.381882905081239360/gluon/restricted.py,
 line 224, in restricted
exec ccode in environment
  File 
/base/data/home/apps/s~clubatletismosada/2.381882905081239360/applications/CAS/models/db.py,
 line 19, in module
session.connect(request, response, db=db)
  File 
/base/data/home/apps/s~clubatletismosada/2.381882905081239360/gluon/globals.py,
 line 904, in connect
session_data = pickle.loads(row.session_data)
  File 
/base/data/home/runtimes/python27/python27_dist/lib/python2.7/pickle.py, line 
1382, in loads
return Unpickler(file).load()
  File 
/base/data/home/runtimes/python27/python27_dist/lib/python2.7/pickle.py, line 
858, in load
dispatch[key](self)
  File 
/base/data/home/runtimes/python27/python27_dist/lib/python2.7/pickle.py, line 
1090, in load_global
klass = self.find_class(module, name)
  File 
/base/data/home/runtimes/python27/python27_dist/lib/python2.7/pickle.py, line 
1126, in find_class
klass = getattr(mod, name)
AttributeError: 'module' object has no attribute 'Row'


I have copied the gaehandler.py to main folder in 2.9.12. If I deploy it 
again with 2.9.11 it works fine

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


[web2py] Re: Google Cloud Storage libraries interaction web2py appengine

2015-01-27 Thread Jacinto Parga
Finally solved.

The solution: 
https://groups.google.com/forum/#!topic/google-appengine-stackoverflow/JZX2Yh67ylI

I had to include: apiclient, gflags, httplib2, oauth2client, uritemplate in 
*site-packages* folder

Thanks 

El jueves, 22 de enero de 2015, 23:59:11 (UTC+1), Massimo Di Pierro 
escribió:

 GAE does not provide httplib2

 they want you to use urlfetch (their api). web2py provides 
 gluon.tools.fetch which wraps urlfetch and works like urllib.urlopen when 
 not on GAE.


 First step, I have adapted the example: 
 https://cloud.google.com/storage/docs/json_api/v1/json-api-python-samples

 I works fine in localhost. Here it is the controller: 

 import argparse
 import httplib2
 import os
 import sys
 import json


 from apiclient import discovery
 from oauth2client import file
 from oauth2client import client
 from oauth2client import tools

 # Define sample variables.
 _BUCKET_NAME = 'mybucket'
 _API_VERSION = 'v1'

 # Parser for command-line arguments.
 parser = argparse.ArgumentParser(
 description=__doc__,
 formatter_class=argparse.RawDescriptionHelpFormatter,
 parents=[tools.argparser])

 # CLIENT_SECRETS is name of a file containing the OAuth 2.0 information 
 for this
 # application, including client_id and client_secret. You can see the 
 Client ID
 # and Client secret on the APIs page in the Cloud Console:
 # https://console.developers.google.com/
 CLIENT_SECRETS = os.path.join(os.path.dirname(__file__), 
 'client_secrets.json')

 # Set up a Flow object to be used for authentication.
 # Add one or more of the following scopes. PLEASE ONLY ADD THE SCOPES YOU
 # NEED. For more information on using scopes please see
 # https://developers.google.com/storage/docs/authentication#oauth.
 FLOW = client.flow_from_clientsecrets(CLIENT_SECRETS,
   scope=[
   'https://www.googleapis.com/auth/devstorage.full_control',
   'https://www.googleapis.com/auth/devstorage.read_only',
   'https://www.googleapis.com/auth/devstorage.read_write',
 ],
 message=tools.message_if_missing(CLIENT_SECRETS))

 def index():
   cliente=CLIENT_SECRETS
   flow= FLOW
 #va= main(sys.argv)
# Parse the command-line flags.
 #  flags = parser.parse_args(argv[1:])
 # If the credentials don't exist or are invalid run through the 
 native client
   # flow. The Storage object will ensure that if successful the good
   # credentials will get written back to the file.
   storage = file.Storage('sample.dat')
   credentials = storage.get()
   if credentials is None or credentials.invalid:
 credentials = tools.run_flow(FLOW, storage, flags)

   # Create an httplib2.Http object to handle our HTTP requests and 
 authorize it
   # with our good Credentials.
   http = httplib2.Http()
   http = credentials.authorize(http)

   # Construct the service object for the interacting with the Cloud 
 Storage API.
   service = discovery.build('storage', _API_VERSION, http=http)

   try:
 req = service.buckets().get(bucket=_BUCKET_NAME)
 resp = req.execute()
 print1= json.dumps(resp, indent=2)


 fields_to_return = 
 'nextPageToken,items(name,size,contentType,metadata(my-key))'
 req = service.objects().list(bucket=_BUCKET_NAME, 
 fields=fields_to_return)
 # If you have too many items to list in one request, list_next() will
 # automatically handle paging with the pageToken.
 while req is not None:
   resp = req.execute()
   print2= json.dumps(resp, indent=2)
   req = service.objects().list_next(req, resp)

   except client.AccessTokenRefreshError:
 aviso= The credentials have been revoked or expired, please re-run 
 the application to re-authorize
 
   form=SQLFORM(db.gfile)
   return dict(print1=print1,print2=print2, form=form)

  I get the result expected.

 But when I deploy it to the google app engine, there rises an error 
 ticket: 

 14:49:26.005
  Unable to store in FILE: 
 /base/data/home/apps/s~merebafs/2.381697639759293929/applications/MRBFILE/controllers/default.py
  
 Traceback (most recent call last): File 
 /base/data/home/apps/s~merebafs/2.381697639759293929/gluon/restricted.py, 
 line 224 
 https://console.developers.google.com/project/merebafs/clouddev/source/resolve_location?appModule=defaultappVersion=2timestampNanos=142193456600500file=%2Fbase%2Fdata%2Fhome%2Fapps%2Fs~merebafs%2F2.381697639759293929%2Fgluon%2Frestricted.pyline=224,
  
 in restricted exec ccode in environment File 
 /base/data/home/apps/s~merebafs/2.381697639759293929/applications/MRBFILE/controllers/default.py,
  
 line 12 
 https://console.developers.google.com/project/merebafs/clouddev/source/resolve_location?appModule=defaultappVersion=2timestampNanos=142193456600500file=%2Fbase%2Fdata%2Fhome%2Fapps%2Fs~merebafs%2F2.381697639759293929%2Fapplications%2FMRBFILE%2Fcontrollers%2Fdefault.pyline=12,
  
 in module import httplib2 File 
 /base/data/home/apps/s~merebafs/2.381697639759293929/gluon/custom_import.py,
  
 line 86 
 

[web2py] Re: Google Cloud Storage libraries interaction web2py appengine

2015-01-23 Thread Jacinto Parga
Thanks, 
I'm just looking for a simple way to upload and download files from google 
cloud store, but it seems so tricky to me.

El jueves, 22 de enero de 2015, 23:59:11 (UTC+1), Massimo Di Pierro 
escribió:

 GAE does not provide httplib2

 they want you to use urlfetch (their api). web2py provides 
 gluon.tools.fetch which wraps urlfetch and works like urllib.urlopen when 
 not on GAE.


 First step, I have adapted the example: 
 https://cloud.google.com/storage/docs/json_api/v1/json-api-python-samples

 I works fine in localhost. Here it is the controller: 

 import argparse
 import httplib2
 import os
 import sys
 import json


 from apiclient import discovery
 from oauth2client import file
 from oauth2client import client
 from oauth2client import tools

 # Define sample variables.
 _BUCKET_NAME = 'mybucket'
 _API_VERSION = 'v1'

 # Parser for command-line arguments.
 parser = argparse.ArgumentParser(
 description=__doc__,
 formatter_class=argparse.RawDescriptionHelpFormatter,
 parents=[tools.argparser])

 # CLIENT_SECRETS is name of a file containing the OAuth 2.0 information 
 for this
 # application, including client_id and client_secret. You can see the 
 Client ID
 # and Client secret on the APIs page in the Cloud Console:
 # https://console.developers.google.com/
 CLIENT_SECRETS = os.path.join(os.path.dirname(__file__), 
 'client_secrets.json')

 # Set up a Flow object to be used for authentication.
 # Add one or more of the following scopes. PLEASE ONLY ADD THE SCOPES YOU
 # NEED. For more information on using scopes please see
 # https://developers.google.com/storage/docs/authentication#oauth.
 FLOW = client.flow_from_clientsecrets(CLIENT_SECRETS,
   scope=[
   'https://www.googleapis.com/auth/devstorage.full_control',
   'https://www.googleapis.com/auth/devstorage.read_only',
   'https://www.googleapis.com/auth/devstorage.read_write',
 ],
 message=tools.message_if_missing(CLIENT_SECRETS))

 def index():
   cliente=CLIENT_SECRETS
   flow= FLOW
 #va= main(sys.argv)
# Parse the command-line flags.
 #  flags = parser.parse_args(argv[1:])
 # If the credentials don't exist or are invalid run through the 
 native client
   # flow. The Storage object will ensure that if successful the good
   # credentials will get written back to the file.
   storage = file.Storage('sample.dat')
   credentials = storage.get()
   if credentials is None or credentials.invalid:
 credentials = tools.run_flow(FLOW, storage, flags)

   # Create an httplib2.Http object to handle our HTTP requests and 
 authorize it
   # with our good Credentials.
   http = httplib2.Http()
   http = credentials.authorize(http)

   # Construct the service object for the interacting with the Cloud 
 Storage API.
   service = discovery.build('storage', _API_VERSION, http=http)

   try:
 req = service.buckets().get(bucket=_BUCKET_NAME)
 resp = req.execute()
 print1= json.dumps(resp, indent=2)


 fields_to_return = 
 'nextPageToken,items(name,size,contentType,metadata(my-key))'
 req = service.objects().list(bucket=_BUCKET_NAME, 
 fields=fields_to_return)
 # If you have too many items to list in one request, list_next() will
 # automatically handle paging with the pageToken.
 while req is not None:
   resp = req.execute()
   print2= json.dumps(resp, indent=2)
   req = service.objects().list_next(req, resp)

   except client.AccessTokenRefreshError:
 aviso= The credentials have been revoked or expired, please re-run 
 the application to re-authorize
 
   form=SQLFORM(db.gfile)
   return dict(print1=print1,print2=print2, form=form)

  I get the result expected.

 But when I deploy it to the google app engine, there rises an error 
 ticket: 

 14:49:26.005
  Unable to store in FILE: 
 /base/data/home/apps/s~merebafs/2.381697639759293929/applications/MRBFILE/controllers/default.py
  
 Traceback (most recent call last): File 
 /base/data/home/apps/s~merebafs/2.381697639759293929/gluon/restricted.py, 
 line 224 
 https://console.developers.google.com/project/merebafs/clouddev/source/resolve_location?appModule=defaultappVersion=2timestampNanos=142193456600500file=%2Fbase%2Fdata%2Fhome%2Fapps%2Fs~merebafs%2F2.381697639759293929%2Fgluon%2Frestricted.pyline=224,
  
 in restricted exec ccode in environment File 
 /base/data/home/apps/s~merebafs/2.381697639759293929/applications/MRBFILE/controllers/default.py,
  
 line 12 
 https://console.developers.google.com/project/merebafs/clouddev/source/resolve_location?appModule=defaultappVersion=2timestampNanos=142193456600500file=%2Fbase%2Fdata%2Fhome%2Fapps%2Fs~merebafs%2F2.381697639759293929%2Fapplications%2FMRBFILE%2Fcontrollers%2Fdefault.pyline=12,
  
 in module import httplib2 File 
 /base/data/home/apps/s~merebafs/2.381697639759293929/gluon/custom_import.py,
  
 line 86 
 

[web2py] Google Cloud Storage libraries interaction web2py appengine

2015-01-22 Thread Jacinto Parga
Hello, 

I am trying to manage (upload and download) big files from google cloud 
storage width a web2py app deployed in GAE.

First step, I have adapted the 
example: 
https://cloud.google.com/storage/docs/json_api/v1/json-api-python-samples

I works fine in localhost. Here it is the controller: 

import argparse
import httplib2
import os
import sys
import json


from apiclient import discovery
from oauth2client import file
from oauth2client import client
from oauth2client import tools

# Define sample variables.
_BUCKET_NAME = 'mybucket'
_API_VERSION = 'v1'

# Parser for command-line arguments.
parser = argparse.ArgumentParser(
description=__doc__,
formatter_class=argparse.RawDescriptionHelpFormatter,
parents=[tools.argparser])

# CLIENT_SECRETS is name of a file containing the OAuth 2.0 information for 
this
# application, including client_id and client_secret. You can see the 
Client ID
# and Client secret on the APIs page in the Cloud Console:
# https://console.developers.google.com/
CLIENT_SECRETS = os.path.join(os.path.dirname(__file__), 
'client_secrets.json')

# Set up a Flow object to be used for authentication.
# Add one or more of the following scopes. PLEASE ONLY ADD THE SCOPES YOU
# NEED. For more information on using scopes please see
# https://developers.google.com/storage/docs/authentication#oauth.
FLOW = client.flow_from_clientsecrets(CLIENT_SECRETS,
  scope=[
  'https://www.googleapis.com/auth/devstorage.full_control',
  'https://www.googleapis.com/auth/devstorage.read_only',
  'https://www.googleapis.com/auth/devstorage.read_write',
],
message=tools.message_if_missing(CLIENT_SECRETS))

def index():
  cliente=CLIENT_SECRETS
  flow= FLOW
#va= main(sys.argv)
   # Parse the command-line flags.
#  flags = parser.parse_args(argv[1:])
# If the credentials don't exist or are invalid run through the native 
client
  # flow. The Storage object will ensure that if successful the good
  # credentials will get written back to the file.
  storage = file.Storage('sample.dat')
  credentials = storage.get()
  if credentials is None or credentials.invalid:
credentials = tools.run_flow(FLOW, storage, flags)

  # Create an httplib2.Http object to handle our HTTP requests and 
authorize it
  # with our good Credentials.
  http = httplib2.Http()
  http = credentials.authorize(http)

  # Construct the service object for the interacting with the Cloud Storage 
API.
  service = discovery.build('storage', _API_VERSION, http=http)

  try:
req = service.buckets().get(bucket=_BUCKET_NAME)
resp = req.execute()
print1= json.dumps(resp, indent=2)
   

fields_to_return = 
'nextPageToken,items(name,size,contentType,metadata(my-key))'
req = service.objects().list(bucket=_BUCKET_NAME, 
fields=fields_to_return)
# If you have too many items to list in one request, list_next() will
# automatically handle paging with the pageToken.
while req is not None:
  resp = req.execute()
  print2= json.dumps(resp, indent=2)
  req = service.objects().list_next(req, resp)

  except client.AccessTokenRefreshError:
aviso= The credentials have been revoked or expired, please re-run the 
application to re-authorize

  form=SQLFORM(db.gfile)
  return dict(print1=print1,print2=print2, form=form)

 I get the result expected.

But when I deploy it to the google app engine, there rises an error ticket: 

14:49:26.005
 Unable to store in FILE: 
/base/data/home/apps/s~merebafs/2.381697639759293929/applications/MRBFILE/controllers/default.py
 
Traceback (most recent call last): File 
/base/data/home/apps/s~merebafs/2.381697639759293929/gluon/restricted.py, 
line 224 
https://console.developers.google.com/project/merebafs/clouddev/source/resolve_location?appModule=defaultappVersion=2timestampNanos=142193456600500file=%2Fbase%2Fdata%2Fhome%2Fapps%2Fs~merebafs%2F2.381697639759293929%2Fgluon%2Frestricted.pyline=224,
 
in restricted exec ccode in environment File 
/base/data/home/apps/s~merebafs/2.381697639759293929/applications/MRBFILE/controllers/default.py,
 
line 12 
https://console.developers.google.com/project/merebafs/clouddev/source/resolve_location?appModule=defaultappVersion=2timestampNanos=142193456600500file=%2Fbase%2Fdata%2Fhome%2Fapps%2Fs~merebafs%2F2.381697639759293929%2Fapplications%2FMRBFILE%2Fcontrollers%2Fdefault.pyline=12,
 
in module import httplib2 File 
/base/data/home/apps/s~merebafs/2.381697639759293929/gluon/custom_import.py, 
line 86 
https://console.developers.google.com/project/merebafs/clouddev/source/resolve_location?appModule=defaultappVersion=2timestampNanos=142193456600500file=%2Fbase%2Fdata%2Fhome%2Fapps%2Fs~merebafs%2F2.381697639759293929%2Fgluon%2Fcustom_import.pyline=86,
 
in custom_importer raise ImportError, 'Cannot import module %s' % str(e) 
ImportError: Cannot import module 'httplib2' 


And I can't understand because it is a library they use in their example. 
Any idea...

The next thing is to achieve 

[web2py] Re: /appadmin/manage/auth GAE access

2015-01-09 Thread Jacinto Parga
Yes, it is very nice and useful.
But I was worried because I thought than anyone could access to appadmin if 
I forgot to clear the session in the browser when access with google 
account.
Thanks Samuel 

El viernes, 9 de enero de 2015, 16:46:27 (UTC+1), samuel bonill escribió:

 You can use Admin-Plus ( https://github.com/pyner/admin_plus )

-- 
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: /appadmin/manage/auth GAE access

2015-01-09 Thread Jacinto Parga
Yes!!

It is. The only issue is that the browser can store the google session so I 
have to be carefull width this, because you can logout your google account 
without finishing the appadmin session.

Finally thanks, Massimo.

El viernes, 9 de enero de 2015, 6:05:52 (UTC+1), Massimo Di Pierro escribió:

 Checking the code again. appadmin.py calls check_credentials to decide if 
 you have access. On GAE it does (in gluon/fileutils.py/check_credentials):

 from google.appengine.api import users
 if users.is_current_user_admin():
 return True
 elif gae_login:
 login_html = 'a href=%sSign in with your google 
 account/a.' \
 % users.create_login_url(request.env.path_info)
 raise HTTP(200, 'htmlbody%s/body/html' % login_html)
 else:
 return False

 users is the a GAE API. So if you are not logged in you asks you to sign 
 in. If you are signed and the user is an administrator, it returns True. 
 Now Google manages you access, not web2py. This is Google App engine works. 

 Appadmin has noting to do with the session of your application. It relies 
 exclusively on check_credentials with relies on Google login. 

 You as administrator have to know this and have to logout from Google in 
 order to disable access to appadmin.

 I am not understanding the issue?



 On Wednesday, 7 January 2015 17:10:48 UTC-6, Jacinto Parga wrote:

 First of all thanks so much for your attention Massimo.

 So I have done a complete example of what I mean.

 I have deployed an application in GAE: http://web2gae.appspot.com

 It has a user with administration privileges called:  
 super...@example.com javascript:  width password: superadmin

 I have created a google email that can log in the google appengine 
 console (width view privileges): web2g...@gmail.com javascript:   
 width password: superadmin

 So the thing is, I write in a browser (width no session in gmail or gae 
 initiated): https://web2gae.appspot.com/appadmin

 and I can access to the database appadmin without logging in the 
 application, just accessing width the google acount web2g...@gmail.com 
 javascript: 

 The thing is that the session may remain in the browser even if I log out 
 the google account. It depends on the browser settings. Widthout control of 
 the apps permissions.

 And I can't find the app /admin to logout once I am in google app engine 
 application.

 I hope the example is good...

 El miércoles, 7 de enero de 2015 20:20:25 UTC+1, Massimo Di Pierro 
 escribió:

  you try go to the admin app /admin and press the [logout] button?

 On Wednesday, 7 January 2015 11:34:19 UTC-6, Jacinto Parga wrote:

 Well, but I log out the application. Then I clean the browser history 
 and just put in the browser
 * https://myapp.appspot.com/appadmin 
 https://myapp.appspot.com/appadminI am required to sign with google 
 account.*

 I do so, and I can access the appadmin complete fucntionality, but I 
 had not logged in the application at all, neither  as an user with admin 
 privileges nor a simple user. And there is no way to log out as I have not 
 logged in the application. If I log out my google account I can continue 
 using the appadmin interface. Even if I log in with another different 
 google account and access several minutes later to the appadmin.

 If I use the https://myapp.appspot.com/appadmin/manage/auth then 
 everything works fine because I have to log in as an user with admin 
 privileges.

 It is very useful for me to be able to access to appadmin in the 
 application deployed in google app engine, but how can I force it to log 
 in 
 as an user with admin privileges?

 El miércoles, 7 de enero de 2015 15:47:20 UTC+1, Massimo Di Pierro 
 escribió:

 I partially agree. Problem is you signed out of google but you did not 
 sign out of admin. appadmin authorizes you if you are logged into admin. 
 The fact you logout from google does not automatically sign you out from 
 admin.

 Can you reproduce the problem if you sign our from admin?

 On Wednesday, 7 January 2015 06:08:13 UTC-6, Jacinto Parga wrote:

 Hi

 I have deployed my aplication in GAE and /appadmin/manage/auth works 
 fine, asking a login to access.

 But, if I try to go to: https://myapp.appspot.com/appadmin

 Then the browser asks me: Sign in with your google account 
 https://www.google.com/accounts/ServiceLogin?service=ahpassive=truecontinue=https://appengine.google.com/_ah/conflogin%3Fcontinue%3Dhttps://clubatletismosada.appspot.com/appadminltmpl=gmshdf=Ch8LEgZhaG5hbWUaE0NsdWIgQXRsZXRpc21vIFNhZGEMEgJhaCIU4rpxyPjOtFDC1cxqbSHxn4qazIsoATIUrdvnPgTHKBlIIF_ylVxiINsy4sI
 .

 Ok, I sing wiht my google account (the owner of the application) and 
 I can access to the whole database appadmin without loggin in as 
 'administrator' like in /appadmin/manage/auth

 So If the browser keeps the session anyone can access to my app 
 database from this browser. I have to remove the cookie of the session.

 I

[web2py] Re: /appadmin/manage/auth GAE access

2015-01-07 Thread Jacinto Parga
First of all thanks so much for your attention Massimo.

So I have done a complete example of what I mean.

I have deployed an application in GAE: http://web2gae.appspot.com

It has a user with administration privileges called: 
 superad...@example.com  width password: superadmin

I have created a google email that can log in the google appengine console 
(width view privileges): web2gae2...@gmail.com   width password: superadmin

So the thing is, I write in a browser (width no session in gmail or gae 
initiated): https://web2gae.appspot.com/appadmin

and I can access to the database appadmin without logging in the 
application, just accessing width the google acount web2gae2...@gmail.com 

The thing is that the session may remain in the browser even if I log out 
the google account. It depends on the browser settings. Widthout control of 
the apps permissions.

And I can't find the app /admin to logout once I am in google app engine 
application.

I hope the example is good...

El miércoles, 7 de enero de 2015 20:20:25 UTC+1, Massimo Di Pierro escribió:

  you try go to the admin app /admin and press the [logout] button?

 On Wednesday, 7 January 2015 11:34:19 UTC-6, Jacinto Parga wrote:

 Well, but I log out the application. Then I clean the browser history and 
 just put in the browser
 * https://myapp.appspot.com/appadmin 
 https://myapp.appspot.com/appadminI am required to sign with google 
 account.*

 I do so, and I can access the appadmin complete fucntionality, but I had 
 not logged in the application at all, neither  as an user with admin 
 privileges nor a simple user. And there is no way to log out as I have not 
 logged in the application. If I log out my google account I can continue 
 using the appadmin interface. Even if I log in with another different 
 google account and access several minutes later to the appadmin.

 If I use the https://myapp.appspot.com/appadmin/manage/auth then 
 everything works fine because I have to log in as an user with admin 
 privileges.

 It is very useful for me to be able to access to appadmin in the 
 application deployed in google app engine, but how can I force it to log in 
 as an user with admin privileges?

 El miércoles, 7 de enero de 2015 15:47:20 UTC+1, Massimo Di Pierro 
 escribió:

 I partially agree. Problem is you signed out of google but you did not 
 sign out of admin. appadmin authorizes you if you are logged into admin. 
 The fact you logout from google does not automatically sign you out from 
 admin.

 Can you reproduce the problem if you sign our from admin?

 On Wednesday, 7 January 2015 06:08:13 UTC-6, Jacinto Parga wrote:

 Hi

 I have deployed my aplication in GAE and /appadmin/manage/auth works 
 fine, asking a login to access.

 But, if I try to go to: https://myapp.appspot.com/appadmin

 Then the browser asks me: Sign in with your google account 
 https://www.google.com/accounts/ServiceLogin?service=ahpassive=truecontinue=https://appengine.google.com/_ah/conflogin%3Fcontinue%3Dhttps://clubatletismosada.appspot.com/appadminltmpl=gmshdf=Ch8LEgZhaG5hbWUaE0NsdWIgQXRsZXRpc21vIFNhZGEMEgJhaCIU4rpxyPjOtFDC1cxqbSHxn4qazIsoATIUrdvnPgTHKBlIIF_ylVxiINsy4sI
 .

 Ok, I sing wiht my google account (the owner of the application) and I 
 can access to the whole database appadmin without loggin in as 
 'administrator' like in /appadmin/manage/auth

 So If the browser keeps the session anyone can access to my app 
 database from this browser. I have to remove the cookie of the session.

 I think it is a lack of security.

 So I would like to limit the access to 
 https://myapp.appspot.com/appadmin in the same way that 
 /appadmin/manage/auth

 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: /appadmin/manage/auth GAE access

2015-01-07 Thread Jacinto Parga

I have no [logout] button when I am in https://myapp.appspot.com/appadmin 
because I have not logged in. I can access to this page through google 
count access

I have tried to deploy the application through a terminal with the local 
server admin app logged out, but it had no effect.

I'll make a complete example in a few minutes...


El miércoles, 7 de enero de 2015 20:20:25 UTC+1, Massimo Di Pierro escribió:

  you try go to the admin app /admin and press the [logout] button?

 On Wednesday, 7 January 2015 11:34:19 UTC-6, Jacinto Parga wrote:

 Well, but I log out the application. Then I clean the browser history and 
 just put in the browser
 * https://myapp.appspot.com/appadmin 
 https://myapp.appspot.com/appadminI am required to sign with google 
 account.*

 I do so, and I can access the appadmin complete fucntionality, but I had 
 not logged in the application at all, neither  as an user with admin 
 privileges nor a simple user. And there is no way to log out as I have not 
 logged in the application. If I log out my google account I can continue 
 using the appadmin interface. Even if I log in with another different 
 google account and access several minutes later to the appadmin.

 If I use the https://myapp.appspot.com/appadmin/manage/auth then 
 everything works fine because I have to log in as an user with admin 
 privileges.

 It is very useful for me to be able to access to appadmin in the 
 application deployed in google app engine, but how can I force it to log in 
 as an user with admin privileges?

 El miércoles, 7 de enero de 2015 15:47:20 UTC+1, Massimo Di Pierro 
 escribió:

 I partially agree. Problem is you signed out of google but you did not 
 sign out of admin. appadmin authorizes you if you are logged into admin. 
 The fact you logout from google does not automatically sign you out from 
 admin.

 Can you reproduce the problem if you sign our from admin?

 On Wednesday, 7 January 2015 06:08:13 UTC-6, Jacinto Parga wrote:

 Hi

 I have deployed my aplication in GAE and /appadmin/manage/auth works 
 fine, asking a login to access.

 But, if I try to go to: https://myapp.appspot.com/appadmin

 Then the browser asks me: Sign in with your google account 
 https://www.google.com/accounts/ServiceLogin?service=ahpassive=truecontinue=https://appengine.google.com/_ah/conflogin%3Fcontinue%3Dhttps://clubatletismosada.appspot.com/appadminltmpl=gmshdf=Ch8LEgZhaG5hbWUaE0NsdWIgQXRsZXRpc21vIFNhZGEMEgJhaCIU4rpxyPjOtFDC1cxqbSHxn4qazIsoATIUrdvnPgTHKBlIIF_ylVxiINsy4sI
 .

 Ok, I sing wiht my google account (the owner of the application) and I 
 can access to the whole database appadmin without loggin in as 
 'administrator' like in /appadmin/manage/auth

 So If the browser keeps the session anyone can access to my app 
 database from this browser. I have to remove the cookie of the session.

 I think it is a lack of security.

 So I would like to limit the access to 
 https://myapp.appspot.com/appadmin in the same way that 
 /appadmin/manage/auth

 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] /appadmin/manage/auth GAE access

2015-01-07 Thread Jacinto Parga
Hi

I have deployed my aplication in GAE and /appadmin/manage/auth works fine, 
asking a login to access.

But, if I try to go to: https://myapp.appspot.com/appadmin

Then the browser asks me: Sign in with your google account 
https://www.google.com/accounts/ServiceLogin?service=ahpassive=truecontinue=https://appengine.google.com/_ah/conflogin%3Fcontinue%3Dhttps://clubatletismosada.appspot.com/appadminltmpl=gmshdf=Ch8LEgZhaG5hbWUaE0NsdWIgQXRsZXRpc21vIFNhZGEMEgJhaCIU4rpxyPjOtFDC1cxqbSHxn4qazIsoATIUrdvnPgTHKBlIIF_ylVxiINsy4sI
.

Ok, I sing wiht my google account (the owner of the application) and I can 
access to the whole database appadmin without loggin in as 'administrator' 
like in /appadmin/manage/auth

So If the browser keeps the session anyone can access to my app database 
from this browser. I have to remove the cookie of the session.

I think it is a lack of security.

So I would like to limit the access to https://myapp.appspot.com/ in the 
same way that /appadmin/manage/auth

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: /appadmin/manage/auth GAE access

2015-01-07 Thread Jacinto Parga
Well, but I log out the application. Then I clean the browser history and 
just put in the browser
* https://myapp.appspot.com/appadminI am required to sign with google 
account.*

I do so, and I can access the appadmin complete fucntionality, but I had 
not logged in the application at all, neither  as an user with admin 
privileges nor a simple user. And there is no way to log out as I have not 
logged in the application. If I log out my google account I can continue 
using the appadmin interface. Even if I log in with another different 
google account and access several minutes later to the appadmin.

If I use the https://myapp.appspot.com/appadmin/manage/auth then everything 
works fine because I have to log in as an user with admin privileges.

It is very useful for me to be able to access to appadmin in the 
application deployed in google app engine, but how can I force it to log in 
as an user with admin privileges?

El miércoles, 7 de enero de 2015 15:47:20 UTC+1, Massimo Di Pierro escribió:

 I partially agree. Problem is you signed out of google but you did not 
 sign out of admin. appadmin authorizes you if you are logged into admin. 
 The fact you logout from google does not automatically sign you out from 
 admin.

 Can you reproduce the problem if you sign our from admin?

 On Wednesday, 7 January 2015 06:08:13 UTC-6, Jacinto Parga wrote:

 Hi

 I have deployed my aplication in GAE and /appadmin/manage/auth works 
 fine, asking a login to access.

 But, if I try to go to: https://myapp.appspot.com/appadmin

 Then the browser asks me: Sign in with your google account 
 https://www.google.com/accounts/ServiceLogin?service=ahpassive=truecontinue=https://appengine.google.com/_ah/conflogin%3Fcontinue%3Dhttps://clubatletismosada.appspot.com/appadminltmpl=gmshdf=Ch8LEgZhaG5hbWUaE0NsdWIgQXRsZXRpc21vIFNhZGEMEgJhaCIU4rpxyPjOtFDC1cxqbSHxn4qazIsoATIUrdvnPgTHKBlIIF_ylVxiINsy4sI
 .

 Ok, I sing wiht my google account (the owner of the application) and I 
 can access to the whole database appadmin without loggin in as 
 'administrator' like in /appadmin/manage/auth

 So If the browser keeps the session anyone can access to my app database 
 from this browser. I have to remove the cookie of the session.

 I think it is a lack of security.

 So I would like to limit the access to https://myapp.appspot.com/appadmin 
 in the same way that /appadmin/manage/auth

 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: Managing 600MB size files on Google Cloud with web2py

2014-12-29 Thread Jacinto Parga
I'm looking for a similar solution widht google cloud store.


El miércoles, 23 de julio de 2014 11:27:29 UTC+2, Giacomo Dorigo escribió:

 Hello everybody, 
 I am writing an app for storing and delivering files more or less from 3 
 up to 600Mb size. 

 I would like to rely on Google App Engine for running my web2py instance. 

 What I am wondering if it's better to store the data directly in the 
 Google not relational datastore (Google Cloud Datastore), or to upload them 
 to the Google relational MySQL version (Google Cloud SQL), or in the end to 
 implement the upload/download to the Google Cloud Storage treating it as 
 alternative uploadfs.

 Does anybody have any suggestion or experience on this topic? 

 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: json empty with jquery

2014-12-23 Thread Jacinto Parga
First of all thanks so much for your help, Leonel. I finally got it.

I had a concept mistake. I had to declare a variable to get the data of the 
client wiht the same structure of the data. I used  datos = 
str(request.vars), it is correct because I can retrieve data: {'key':'value
','key2':'value2'} as a string, but it is not the proper way. The proper 
way is  
datos = str(request.vars.key),str(request.vars.key2)]

So I can get the values at the client with 
data.datos[0], data.datos[1]

That is solved. The second issue I had was tha I wanted to send the values 
to the controller, to store them in a database. I finally use the jquery 
set val () and send it through a form field.
$(#test).val(data.datos[0])

That's it.


El miércoles, 17 de diciembre de 2014 13:30:03 UTC+1, Leonel Câmara 
escribió:

 What do I mean what do I suggest I see nothing wrong with it.

 Do you want to change the HTML after getting the response? If it's that 
 you can do something like this:

 {{extend 'layout.html'}}
 h2Template default/test2.html/h2


 dl
   dtKey/dt
   dd id=key/dd
   dtKey2/dt
   dd id=key2/dd
 /dl

 script
   $(document).ready(function(){
   $.ajax({
 type: 'POST',
 url:'http://127.0.0.1:8000/MFREG/default/test2.json',
 contentType: application/json; charset=utf-8,
 data: {'key':'value','key2':'value2'},
 dataType: 'json',
 success:  function(data){
 for (var key in data) {
 $('#' + key).text = data[key];
 }
 }
 });
   });
 /script


-- 
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: json empty with jquery

2014-12-17 Thread Jacinto Parga
Sorry, but they are not stored in request.vars as expected. It works fine 
in the alert window, but I can't retrieve the values in the controller to 
handle them. I have tried with a diferent function in the controler, like 
this:

def test2():
result=testpost()
return locals()

def testpost():
datos=str(request.vars)
key=request.vars.key
return locals()


The view:

{{extend 'layout.html'}}
h2Template default/test2.html/h2

{{=BEAUTIFY(response._vars)}}

script
  $(document).ready(function(){
  $.ajax({
type: 'POST',
url:'{{=URL('default','testpost.json',args='datos')}}',
data: {'key':'value','key2':'value2'},
dataType: 'json',
  success:  function(data){  alert(Data:+ data.datos); }
});
  });
/script


And the result: 

https://lh5.googleusercontent.com/-PIXsDgJWotI/VJFcBhXJLTI/ArI/YBS5zRL7dvA/s1600/Selecci%C3%B3n_808.png

Maybe I have to declare key and key2 as var in the script? Because the 
values I get in the request.vars are Storage{} instead 
of {'key':'value','key2':'value2'} as desired. So they are not stored in 
request.vars


El martes, 16 de diciembre de 2014 19:57:30 UTC+1, Leonel Câmara escribió:

 It should, but it should also be in request.vars which is the standard 
 place to deal with it, you should have request.vars.key and 
 request.vars.key2.


-- 
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: json empty with jquery

2014-12-17 Thread Jacinto Parga
Yes, so what do you suggest?. 

Do I have to fill my request.vars before the document is loaded? How can I 
do it? 

El miércoles, 17 de diciembre de 2014 12:43:30 UTC+1, Leonel Câmara 
escribió:

 Jacinto they are in request.vars otherwise you wouldn't see them in the 
 alert window. Let's walk through what is going on here:

 1. You open the address in the browser http://127.0.0.1:8000/MFREG/test2 
 as the extension is omitted web2py assumes HTML and your HTML view is 
 processed
 2. That URL doesn't have any vars so the HTML made by BEAUTIFY 
 response._vars shows them empty
 3. When the document is ready your browser makes an ajax request that does 
 have vars.
 4. The server answers in json because you used the .json extension and you 
 get the result in the success function in its data argument, you then show 
 it in an alert.

 As you can see the HTML is never changed after your initial request - that 
 didn't have vars - hence why it keeps showing you exactly that.


-- 
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] json empty with jquery

2014-12-16 Thread Jacinto Parga

 Hi, 
it's  very simple but I cannot find the mistake. I am tryint to pass a json 
from browser to controller with ajas. The result is that the data object in 
the script is empty:

The view:

{{extend 'layout.html'}}
h2Template default/test2.html/h2


{{=BEAUTIFY(response._vars)}}


script
  $(document).ready(function(){
  $.ajax({
type: 'POST',
url:'http://127.0.0.1:8000/MFREG/default/test2.json',
contentType: application/json; charset=utf-8,
data: {'key':'value','key2':'value2'},
dataType: 'json',
  success:  function(data){  alert(Data: + data); }
});
  });
/script

The controller: 

def test2():
datos = str(request.vars)
datos2= request.args(0)
return locals()

The result:

https://lh3.googleusercontent.com/-5ioc1l3lC2A/VJA4HH8GWuI/AqY/-2WZfxQxMWg/s1600/Selecci%C3%B3n_804.png
It's silly but I can't find what is 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.


[web2py] Re: json empty with jquery

2014-12-16 Thread Jacinto Parga
I mean, I try to send data: {'key':'value','key2':'value2'} 

so I expect to get  {'key':'value','key2':'value2'}
in the controller.

I've tried your suggestion and that's the result:

https://lh5.googleusercontent.com/-HUzPxb4Z-ik/VJBcmcKfUqI/Aqo/aOUHGUqv_FY/s1600/Selecci%C3%B3n_805.png

I get the same that in the datos var, in the controller. But, the Storage{} 
list is empty.


El martes, 16 de diciembre de 2014 15:54:37 UTC+1, Leonel Câmara escribió:

 What do you mean it's empty? It's an object. Try and change your alert to 
 alert(Data: 
 + data.datos);


-- 
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: json empty with jquery

2014-12-16 Thread Jacinto Parga
Ok, I.m getting closer. So I change my url call, like this

url:'{{=URL('default','test2.json',args='data.datos')}}',

but I still have an empty reques.vars. How should I call the controller to 
pass the data field as a json from the view scritp to the controller?

What I am looking for is to send the position.coords.latitude or vars like 
these from the browser to a controler in server.

...

El martes, 16 de diciembre de 2014 17:57:07 UTC+1, Leonel Câmara escribió:

 Well it's supposed to be empty. You're calling the controller like this:

 http://127.0.0.1:8000/MFREG/default/test2.json

 This URL has neither args nor vars.
 http://127.0.0.1:8000/MFREG/default/test2.json
 Then you do this:

 datos = str(request.vars)
 datos2= request.args(0)

 request.vars is an empty Storage so when you convert it to string you get 
 Storage(), datos2 is None because there is no request.args(0)




-- 
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: json empty with jquery

2014-12-16 Thread Jacinto Parga
I did with 
{{=BEAUTIFY(response._vars)}}

and the result is:

datos:Storage {}

So request.vars is empty.

If I change the post method for a get method, I can see the correct result 
at the alert window, but not in the controller, I mean it works in the 
client side:

Wiht get method:

https://lh5.googleusercontent.com/-_9jLacZBDWM/VJBw0zK5TRI/Aq4/KN46UfH72LU/s1600/Selecci%C3%B3n_806.png

The alert window is ok but the datos var an empty storage objetc.

El martes, 16 de diciembre de 2014 18:33:17 UTC+1, Leonel Câmara escribió:

 Humm request.vars shouldn't be empty because you're sending them in data.

 Add a print request.vars to the controller and see what's there.


-- 
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: json empty with jquery

2014-12-16 Thread Jacinto Parga
Yes, it should. I don't know why not. Maybe I'll try with jquery...

El martes, 16 de diciembre de 2014 18:59:18 UTC+1, Leonel Câmara escribió:

 Well

 {{=BEAUTIFY(response._vars)}}

 Won't see anything because the vars are only there in the ajax request. 
 That's why it works in your alert. It should work with POST too.



-- 
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: json empty with jquery

2014-12-16 Thread Jacinto Parga
YES!!! Finally. Thanks so much.

The only thing now is how to handle the string in the controller. I guess 
it should be stored in reques.post_vars 

El martes, 16 de diciembre de 2014 19:36:04 UTC+1, Leonel Câmara escribió:

 You're already using jquery. I think the problem is that you're specifying 
 the contenttype. Remove that line and let it use formencode.


-- 
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: string form javascript function to controller function using ajax

2014-12-14 Thread Jacinto Parga
I have used this example but request.vars is empty, I cannot get the json 
string in controller.

In view:

{{extend 'layout.html'}}
h1Template default/jsontest.html/h1
{{=BEAUTIFY(response._vars)}}

script
  $(document).ready(function(){
  $.ajax({
type: 'POST',
url:'http://127.0.0.1:8000/MFREG/default/jsontest.json',
contentType: application/json; charset=utf-8, 
data: {'key':'value','key2':'value2'},
dataType: 'json',
  success:  function(data){  alert(data); }
});
  });
/script 


In controller:

def jsontest():
datos = str(request.post_vars)
return locals()

What I get:

https://lh3.googleusercontent.com/-hgL-ctSIo8s/VI3OZsdXkEI/Ap4/i2gSvKR9vkg/s1600/Selecci%C3%B3n_802.png
So the json data is not stored in request.post_vars.

I don't know what is wrong.

El viernes, 11 de enero de 2013 16:34:00 UTC+1, Anthony escribió:

 The data will be in request.vars, not request.args.

 Anthony

 On Friday, January 11, 2013 10:28:27 AM UTC-5, yn yn wrote:

 Thanks for the answer...
 Ok 
 I have tested jQuery.post('{{=URL('default', 
 'testpost')}}',{'key':'hello'})

 where in default.py there is a def:

 def testpost():
 import os
 data = request.args(0)
 myfile = os.path.join(request.folder, 'static', 'file1.txt')
 f = open(myfile, w)   
 f.write(data)
 f.close()
 return dict()

 I can open the file1.txt but nothing is writing there. I think 'hello' is 
 not transmited ... isn'it it? do you know what is wrong?



 El viernes, 11 de enero de 2013 15:13:29 UTC+1, Massimo Di Pierro 
 escribió:

 I suggest using jquery.post

 jQuery.post('{{=URL('testfunction')}}',{'key':'value'})

 {'key':'value'} is a js dictionary, can be anything you like and tehy 
 will be passed as vars properly escaped.





-- 
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: Electronic voting anybody?

2014-12-12 Thread Jacinto Parga
Yes, it works but not with https://... (i have to remove the 's'), and only 
with the browser address: http://www.youtube.com/watch?v=LBvDcz0yHZg

It doesnt' work with the share youtube link: http://youtu.be/LBvDcz0yHZg

Thanks!

El martes, 18 de septiembre de 2012 14:42:39 UTC+2, Massimo Di Pierro 
escribió:

 None of them.

 auth.wiki() support the newer MARKMIN which uses the 
 gluon.contrib.autonlinks module which supports the OEMBED protocol.

 You just add a link to the original youtube video and it will contact the 
 youtube oembed service to ask for the best way to embed it.

 {{from gluon.contrib.autolinks import expand_one}}
 *{{=MARKMIN(... http://www.youtube.com/x1w8hKTJ2Co 
 http://www.youtube.com/embed/x1w8hKTJ2Co  ..., autolinks=lambda link: 
 expand_one(link,{}) )}}*

 Massimo


 On Monday, 17 September 2012 23:45:10 UTC-5, apps in tables wrote:

 Thank you for deciding to add the option.

 Please, let me understand. 
 Is adding the plugin_wiki to the voting application, will make

 *{{=MARKMIN(embed:http://www.youtube.com/embed/x1w8hKTJ2Co 
 http://www.youtube.com/embed/x1w8hKTJ2Co  )}}*

 or 

 *{{=plugin_wiki.widget('youtube',code='* *x1w8hKTJ2Co * *')}}*

 possible (understandable) in cleditor?

  

 Ashraf 



-- 
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] SQLFORM.grid: sorting

2014-07-18 Thread Jacinto Parga
Hi, 

I solved it putting the foreing key format in the controller, before the 
grid:

def familia_manage():
*db.auth_user._format = '%(last_name)s %(first_name)s'*
fields=[db.t_familiares.f_nombre, 
db.t_familiares.f_apellidos,db.t_familiares.f_titular]
form = SQLFORM.grid(db.t_familiares, fields=fields )
return locals()

Where, in the table declaration:

db.t_familiares.f_titular.requires= 
(IS_IN_DB(db,'auth_user.id','%(last_name)s ''%(first_name)s'))

When I press the header I get it order by last_name instead of id.


El lunes, 21 de mayo de 2012 22:24:23 UTC+2, backseat escribió:

 Thanks Jim, I somehow missed the 'orderby' parameter to SQLFORM.grid 

 On Mon, 21 May 2012 13:11:31 -0700 (PDT), massimo@gmail.com 
 javascript: said: 

  foreign key. You can do a join. 

 Thanks Massimo; however, that's a little cryptic. Could you explain how a 
 join can be used to determine the sort order when I click on a 
 SQLFORM.grid header? 

 Thanks, 
 Keith 
 -- 
 You can have everything in life you want if you help enough other people 
 get what they want - Zig Ziglar. 

 Who did you help today? 


-- 
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: SQLFORM.grid redirects and access

2014-01-25 Thread Jacinto Parga
Hi, 

I have a similar issue:

Model:
db.define_table('t_familiares',
Field('f_parentesco', type='string', label=T('Parentesco'), requires = 
IS_IN_SET(['Conyuge', 'Hija','Hijo','Padre','Madre','Pareja'], 
zero=T('Elige uno'), error_message='Escoge una opción válida')),
Field('f_nombre', type='string', label=T('Nombre'), requires = 
IS_NOT_EMPTY()),
Field('f_apellidos', type='string', label=T('Apellidos'), requires = 
IS_NOT_EMPTY()),
Field('f_titular', db.auth_user, label=T('Titular de la Familia')),
auth.signature,
format='%(f_nombre)s' '%(f_apellidos)s',
migrate=settings.migrate)

db.t_familiares.f_titular.requires= (IS_IN_DB(db,'auth_user.id','%(first_name)s 
''%(last_name)s'))

Controller:
@auth.requires_membership('gestor')
def gestor_usuarios():
fields=[db.auth_user.id,db.auth_user.first_name,db.auth_
user.last_name,db.auth_user.email, db.auth_user.dni,db.auth_user.
f_numero_socio]
links = [lambda row: 
A('Familiares',_href=URL(gestor,familiares_socio_manage,args=[row.id],user_signature=True),
 
_class='btn', action='view')]
grid = SQLFORM.grid(db.auth_user, fields=fields, 
links=links, user_signature=True, details=True, deletable=True, editable= 
True)
return locals()

It works fine but, when I follow the link 'Familiares' I go to:

Controller:
##Seleccionamos los familiares de un socio en particular
@auth.requires_membership('gestor')
def familiares_socio_manage():
familiares =(db.t_familiares.f_titular==(request.args(0,cast=int)))
form = SQLFORM.grid(familiares,user_signature=True)
return locals()

*In this case the records are displayed right but the links of the grid: 
Wiew, Edit and Delete drive to a 404 ERROR NOT FOUND.*

I guess it has to be related to the user_signature value, because if I get 
it off the links I just get *NOT AUTHORIZED*

Any suggestion? Thanks

El sábado, 25 de agosto de 2012 15:52:17 UTC+2, lyn2py escribió:

 Hi Massimo,

 I picked Option(1). 
 They both have @auth.requires_membership('Admin') and user_signature=True 
 (the default setting)
 I used a logged-in account that has access to both functions.

 Both pages can be accessed individually, but cannot be accessed when 
 either link is used.

 I am using the latest trunk
 Version 2.00.0 (2012-08-24 23:47:44) dev



 On Saturday, August 25, 2012 9:04:13 PM UTC+8, Massimo Di Pierro wrote:

 You have two options:

 1) decorate your functions with @auth.requires_login() and user_signature 
 = True (default)
 2) leave the functions as they are and user_signature = False (no 
 protection)

 You cannot have a per user signature and at same time not require a 
 logged in user.



 On Saturday, 25 August 2012 06:53:11 UTC-5, lyn2py wrote:

 I have 2 SQLFORM.grids, they are:

 ##MODELS
 db.define_table('company', #each staff can only see the customers under 
 their account
 Field('company_name', 'string',length=255,requires=IS_NOT_EMPTY()),
 Field('description','text'),
 format='%(company_name)s'
 )

 db.define_table('employees', #each customer has their key contacts
 Field('company_id','reference company',writable=False,label='Company 
 Name'), 
 Field('first_name', 'string',length=255,requires=IS_NOT_EMPTY()),
 Field('last_name', 'string',length=255,requires=IS_NOT_EMPTY()),
 Field('role', 'string',length=255,requires=IS_NOT_EMPTY()),
 )

 ##CONTROLLER
 def company():
 grid=SQLFORM.grid(db.company.created_by==auth.user_id,links = 
 [lambda row: A('Add Employee',,_href=URL(default,employees,args='new')))
 return locals()

 def employees():
 grid=SQLFORM.grid(db.employees.created_by==auth.user_id,links = 
 [lambda row: A('View Company 
 Details',_href=URL(default,company,args=row.company_id)))
 return locals()

 The problem I have is, When I click on the LINK (either the *Add 
 Employee* or the *View Company Details* links), I am told Not 
 Authorized.
 I assume it has to do with user_signature.

 How can I use SQLFORM.grid with user-defined links and still keep 
 user_signature=True?

 If I am using it wrongly or misinterpret its correct use, please correct 
 me.

 Thank you!



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


[web2py] Re: web2py 2.4.7 admin Recent Tweets not loaded

2013-07-08 Thread Jacinto Parga
Thanks for your answer, 

no, I have already set* r=[]*

The error message is literaly:  *Unable to download because:** **'results'*

El viernes, 21 de junio de 2013 10:47:53 UTC+2, 黄祥 escribió:

 did you mean you got an error : 
 Unable to download because:
 local variable 'r' referenced before assignment

 best regards

 On Friday, June 21, 2013 3:39:53 PM UTC+7, Jacinto Parga wrote:

 I have got a similar error:

 Unable to download because:
 'results'

 And the tweets have been no longer loaded for several days.

 I have tried your solutions but they didn't work

 If you can help...

 El viernes, 31 de mayo de 2013 05:39:10 UTC+2, 黄祥 escribió:

 hi,

 just want to report that web2py 2.4.7 admin Recent Tweets not loaded.
 error:
 Unable to download because:
 local variable 'r' referenced before assignment

 applications/admin/controllers/default.py
 def twitter():
 session.forget()
 session._unlock(response)
 import gluon.tools
 import gluon.contrib.simplejson as sj
 try:
 if TWITTER_HASH:
 page = urllib.urlopen(
 http://search.twitter.com/search.json?q=%%40%s; % TWITTER_HASH).read()
 data = sj.loads(page, encoding=utf-8)['results']
 d = dict()
 *r = []*
 for e in data:
 d[e[id]] = e
 r = reversed(sorted(d))
 return dict(tweets=[d[k] for k in r])
 else:
 return 'disabled'
 except Exception, e:
 return DIV(T('Unable to download because:'), BR(), str(e))

 ref:
 https://groups.google.com/forum/?fromgroups#!topic/web2py/rtUZeamzXp8

 error is gone and also not showing any tweets

 if i'm not wrong twitter api had already deprecated, imho, if you want 
 to use twitter tweets please use the embeded one provide by twitter 
 (timelines, tweets, etc)

 ref:
 https://dev.twitter.com/

 please correct and forgive me if i'm wrong

 best regards



-- 

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




[web2py] Re: web2py 2.4.7 admin Recent Tweets not loaded

2013-07-08 Thread Jacinto Parga
Yes !! it is solved, thankyou!!!

El lunes, 8 de julio de 2013 19:08:26 UTC+2, Alan Etkin escribió:

 Thanks for your answer, 

 no, I have already set* r=[]*

 The error message is literaly:  *Unable to download because:** **
 'results'* 


 Probably your version of admin (and web2py) has a twitter loader that 
 broke because of the new twitter client authentication. You could solve the 
 problem by upgrading.


-- 

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




[web2py] Re: web2py 2.4.7 admin Recent Tweets not loaded

2013-06-21 Thread Jacinto Parga
I have got a similar error:

Unable to download because:
'results'

And the tweets have been no longer loaded for several days.

I have tried your solutions but they didn't work

If you can help...

El viernes, 31 de mayo de 2013 05:39:10 UTC+2, 黄祥 escribió:

 hi,

 just want to report that web2py 2.4.7 admin Recent Tweets not loaded.
 error:
 Unable to download because:
 local variable 'r' referenced before assignment

 applications/admin/controllers/default.py
 def twitter():
 session.forget()
 session._unlock(response)
 import gluon.tools
 import gluon.contrib.simplejson as sj
 try:
 if TWITTER_HASH:
 page = urllib.urlopen(
 http://search.twitter.com/search.json?q=%%40%s; % TWITTER_HASH).read()
 data = sj.loads(page, encoding=utf-8)['results']
 d = dict()
 *r = []*
 for e in data:
 d[e[id]] = e
 r = reversed(sorted(d))
 return dict(tweets=[d[k] for k in r])
 else:
 return 'disabled'
 except Exception, e:
 return DIV(T('Unable to download because:'), BR(), str(e))

 ref:
 https://groups.google.com/forum/?fromgroups#!topic/web2py/rtUZeamzXp8

 error is gone and also not showing any tweets

 if i'm not wrong twitter api had already deprecated, imho, if you want to 
 use twitter tweets please use the embeded one provide by twitter 
 (timelines, tweets, etc)

 ref:
 https://dev.twitter.com/

 please correct and forgive me if i'm wrong

 best regards


-- 

--- 
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: SQLFROM.smartgrid in GAE, query not supported

2013-06-18 Thread Jacinto Parga
Thanks!

El miércoles, 12 de junio de 2013 23:32:08 UTC+2, Niphlod escribió:

 from the book*

 Google NoSQL (Datastore)** does not allow joins, left joins, aggregates, 
 expression, OR involving more than one table, the ‘like’ operator searches 
 in text fields. 
 *
 tl;dr : no references allowed AFAIK.

 On Wednesday, June 12, 2013 10:07:01 AM UTC+2, Jacinto Parga wrote:

 Hi, 

 I have deployed a *SQLFORM.smartgrid* very simple book's example:

 *db.define_table('t_parent',Field('name'),format='%(name)s')
 db.define_table('child',Field('name'),Field('f_parent','reference 
 t_parent'))*

 Controller

 *@auth.requires_login()
 def index():
  db.child.f_parent.writable = False
  grid = 
 SQLFORM.smartgrid(db.t_parent,linked_tables=['child'],create=True, 
 editable=dict(t_parent=True,child=True))
  return dict(grid=grid)*

 In view:

 *{{=grid}}*

 It works fine in localhost, works fine in pythonanywhere (
 http://jparga.pythonanywhere.com/borrame/default/indexhttp://jparga.pythonanywhere.com/borrame/default/user/login?_next=/borrame/default/index
 )

 BUT ,in* GAE *it doesn't work and dysplay the following message:* Query 
 Not Supported: invalid filter: __key__ filter value must be a Key; received 
 None (a NoneType)*
 (http://web2gae.appspot.com/borrame/default/index/)

 I have tried adding several requirements to db.child.f_parent, like 
 IS_NOT_EMPTY, a default value and so on but it did'n work.

 Thanks for your help.



-- 

--- 
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] SQLFROM.smartgrid in GAE, query not supported

2013-06-12 Thread Jacinto Parga
Hi, 

I have deployed a *SQLFORM.smartgrid* very simple book's example:

*db.define_table('t_parent',Field('name'),format='%(name)s')
db.define_table('child',Field('name'),Field('f_parent','reference 
t_parent'))*

Controller

*@auth.requires_login()
def index():
 db.child.f_parent.writable = False
 grid = 
SQLFORM.smartgrid(db.t_parent,linked_tables=['child'],create=True, 
editable=dict(t_parent=True,child=True))
 return dict(grid=grid)*

In view:

*{{=grid}}*

It works fine in localhost, works fine in pythonanywhere (
http://jparga.pythonanywhere.com/borrame/default/indexhttp://jparga.pythonanywhere.com/borrame/default/user/login?_next=/borrame/default/index
)

BUT ,in* GAE *it doesn't work and dysplay the following message:* Query Not 
Supported: invalid filter: __key__ filter value must be a Key; received 
None (a NoneType)*
(http://web2gae.appspot.com/borrame/default/index/)

I have tried adding several requirements to db.child.f_parent, like 
IS_NOT_EMPTY, a default value and so on but it did'n work.

Thanks for your help.

-- 

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

2012-11-01 Thread Jacinto Parga
I think I have a silly misunderstood with  jQuery.post

I'm trying to store the latitude and longitude in a db.events table. I 
haven't found the right way to do this simple thing,

This is my view: 

{{left_sidebar_enabled,right_sidebar_enabled=False,True}}
{{extend 'layout.html'}}
h3View events/entry_event.html/h3
script
  
jQuery.post({'url':'{{=URL('events','entry_event')}}','data':'a='+position.coords.latitude
 
+ b + position.coords.longitude)});
/script
{{=form}}

{{block right_sidebar}}
{{=A(T(Review events), _href=URL('events'), _class='button', 
_style='margin-top: 1em;')}}
{{end}}

And this is the controller that does'nt work, of course

@auth.requires_login()
def entry_event():
returns a form where we can entry an event
form = crud.create(db.events)
db.events.latitude=request.post_vars('a')
db.events.longitude=request.post_vars('b')
return dict(form=form)

The thing is the event has got several fields you have to fill in the form, 
but the latitude and the longitude are suposed to be parameters we get from 
the browser.

The other way I have tried, but I don't like is, in the model:

Field('client_ip', default=current.request.client), # then I can use 
GeoIP

Would it be fine to set a default value to the latitude and longitude? How 
could it be? Would it be better than catching it from the browser?

Can you help me please,

Thanks in advance.


El domingo, 21 de octubre de 2012 00:42:15 UTC+2, Michael Gheith escribió:

 Hello web2py community!

 I have a question:

 I know how to get the user's geolocation:

 script
 if(navigator.geolocation) 
 {
 navigator.geolocation.getCurrentPosition(printLocation);

 function printLocation(position) 
 {
 alert(lat:  +position.coords.latitude +  lon:  + 
 position.coords.longitude);
 }
 }
 /script


 So my question is this:  what's the BEST way to get position.coords.latitude, 
 and position.coords.longitude to a controller function?



-- 





[web2py] Re: Geolocation

2012-10-26 Thread Jacinto Parga
Sorry, 

I didn't get it.

Could you please write the controller?

Thanks

El domingo, 21 de octubre de 2012 00:52:24 UTC+2, Massimo Di Pierro 
escribió:

 You can try something like

 jQuery.post({'url':'{{=URL('youraction')}}','data':'a='+position.coords.latitude
  
 + b + position.coords.longitude)});



 On Saturday, 20 October 2012 17:42:15 UTC-5, Michael Gheith wrote:

 Hello web2py community!

 I have a question:

 I know how to get the user's geolocation:

 script
 if(navigator.geolocation) 
 {
 navigator.geolocation.getCurrentPosition(printLocation);

 function printLocation(position) 
 {
 alert(lat:  +position.coords.latitude +  lon:  + 
 position.coords.longitude);
 }
 }
 /script


 So my question is this:  what's the BEST way to get 
 position.coords.latitude, and position.coords.longitude to a controller 
 function?



-- 





[web2py] Re: The web2py grid/crud plugin you've always dreamed about! Options

2012-10-19 Thread Jacinto Parga Fernández
I'm working with web2py 2.1.1 and I have the same problem with PowerGrid

What is then __init__.py  solution?

Thanks

El martes, 9 de agosto de 2011 11:45:52 UTC+2, peter escribió:

 I found the problem, it was caused by having something in _init_.py 
 Thanks 


 On Aug 8, 4:10 pm, peter peterchutchin...@gmail.com wrote: 
  And where does the custom_importer get its paths from, because they 
  seem different in some apps to in others. 
  So how can I check the paths or change them. 
  Thanks 
  
  On Aug 8, 1:08 pm, Bruno Rocha rochacbr...@gmail.com wrote: 
  
  
  
   it is imported by the web2py custom_importer 
  
   On Mon, Aug 8, 2011 at 8:26 AM, peter peterchutchin...@gmail.com 
 wrote: 
Let me ask the question the other way round. How come powergridapp 
does find the module powergrid. If I look at the current working 
directory, it is the web2py folder, and if I look at sys.path, it 
 does 
not have the applications folder in there, so how come the 
  
 from plugin_PowerGrid.PowerGrid import PowerGrid 
  
statement succeeds in finding the module when it is relative to the 
applications path? what path is it using to find the powergrid 
 module, 
and where does it get this path from? 
  
Thanks 
Peter 
  
On Aug 6, 6:01 pm, peter peterchutchin...@gmail.com wrote: 
 It is 1.98.2 
  
 On Aug 6, 5:28 pm, Bruno Rocha rochacbr...@gmail.com wrote: 
  
  What is your web2py version? 
  
  The plugin works only in 1.97+ 
  
 http://zerp.ly/rochacbruno 
  Em 06/08/2011 08:55, peter peterchutchin...@gmail.com 
 escreveu: 
  
   I have powergridapp working on my system, however when I added 
 the 
   powergrid plugin to my app I get 
  
   No module named plugin_PowerGrid.PowerGrid 
  
   Yet, the file organisation seems to be the same. I have 
   plugin_PowerGrid within my modules folder and PowerGrid.py 
 within 
that 
   folder. 
  
   Any help appreciated. 
   Thanks 
   Peter- Hide quoted text - 
  
  - Show quoted text -- Hide quoted text - 
  
 - Show quoted text - 
  
   -- 
  
   -- 
   Bruno Rocha 
   [ About me:http://zerp.ly/rochacbruno] 
   [ Aprenda a programar:http://CursoDePython.com.br] 
   [ O seu aliado nos cuidados com os animais:http://AnimalSystem.com.br] 

   [ Consultoria em desenvolvimento web:http://www.blouweb.com]- Hide 
 quoted text - 
  
   - Show quoted text -- Hide quoted text - 
  
  - Show quoted text -

-- 





[web2py] Re: powerTable AttributeError: 'DAL' object has no attribute 'virtual'

2012-10-17 Thread Jacinto Parga Fernández
Thanks so much!!

El lunes, 8 de octubre de 2012 22:15:58 UTC+2, Massimo Di Pierro escribió:

 :-)

 On Monday, 8 October 2012 12:53:27 UTC-5, Don_X wrote:

 BINGO ! - IT WORKS LIKE A CHARM MASSIMO !!! ...  

 Thank you ... now  I can study this properly so I can adapt it to my app !

 On Monday, October 8, 2012 1:49:09 PM UTC-4, Massimo Di Pierro wrote:

 Now the error is at a different line. The previous error has been fixed. 
 Now it is at line 215:


 try:
 _id = record[keycolumntbl][keycolumnfld]
 except KeyError:


 as before it should be

 try:
 _id = record[keycolumntbl][keycolumnfld]
 except (KeyError, AttributeError):



 On Monday, 8 October 2012 12:39:09 UTC-5, Don_X wrote:

 For a more detailed report .. I have openned up the last line 
 pertaining to the plugin_powertable.py below :



- 
Function argument list   

()

Code listing



20.
21.
22.
23.
24.
25.

26.
27.
28.
29.

table.showkeycolumn = False
table.extra = dict(
   
 details={'detailscallback':URL('myfunction.load')}
   )

table = table.create()


return locals()

   Variables
 
tableStorage {'keycolumn': 'product.id', 'extra': {
'...te': function plugin_powertable at 0xa762e144}table.create
function plugin_powertable   
-   

*File /home/www-data/web2py/applications/powertable/
models/plugin_powertable.py in plugin_powertable at line 811*
code
arguments
variables   
Function argument list


()
  Code listing 

806.
807.
808.
809.
810.
811.

812.
813.
814.
815.

ifunctions=str(ifunctions),

 searchcolumnjs=str(searchcolumnjs)
)
  ),
CSS,
PowerTable(),

)


plugins.powerTable.create = plugin_powertable

Variables
global PowerTableclass '__restricted__.PowerTable'
- 
 

*File /home/www-data/web2py/applications/powertable/
models/plugin_powertable.py in __init__ at line 215*
code
arguments
variables   

Function argument list


(self=__restricted__.PowerTable object)
  Code listing



210.
211.
212.
213.
214.
215.

216.
217.
218.
219.

else:
_title = T('Record %s' % str(rc+1))

#setting the id and key for every tr based on required 
 keycolumn
try:
_id = record[keycolumntbl][keycolumnfld]

except KeyError:
if virtualfields:
_id = record[sqlrows.colnames[0].split('.')[0]].id
else:


   Variables
 
 recordRow {'description': 'LCD TV', 'quantity': 34, '...ter 
object at 0xa757f98c, 'name': 'Television'}_idundefined
keycolumntbl'product'keycolumnfld'id'
- 

*File /home/www-data/web2py/gluon/dal.py in __getitem__ 
at line 6376*
code
arguments
variables  
Function argument list


(self=Row {'description': 'LCD TV', 'quantity': 34, 
'...ter object at 0xa757f98c, 'name': 'Television'}, 
key='product')
Code listing  

6371.
6372.
6373.
6374.
6375.
6376.

6377.
6378.
6379.
6380.

elif m:
try:
return ogetattr(self, m.group(1))[m.group(2)]
except (KeyError,AttributeError,TypeError):
key = m.group(2)
return ogetattr(self, key)


def __setitem__(self, key, value):
setattr(self, str(key), value)

 Variables
   selfRow {'description': 'LCD TV', 'quantity': 34, 
 '...ter 
object at 0xa757f98c, 'name': 'Television'}global ogetattrslot 
wrapper '__getattribute__' of 'object' objectskey'product'





--