[web2py] two web2py servers and sessions in redis

2020-05-07 Thread Yoel Benitez Fonseca
Got the following situation:

- Two applications released as lambda functions (A and B), each application 
in this scenary have his own web2py version, served with the same domain 
name behind an nginx proxy, for example A (example.com) and B 
(example.com/path_to_b).
- i wanted that B uses A as a CAS provider.
- both using the same REDIS server for sessions (the exact same settings in 
both applications/web2py instances):

from gluon.contrib.redis_utils import RConn
from gluon.contrib.redis_cache import RedisCache
from gluon.contrib.redis_session import RedisSession

redis_conection = RConn(
host=configuration.get('redis.host'),
port=configuration.get('redis.port'))

session.connect(request, response, db=RedisSession(redis_conection))

B keeps redirecting me to the A login page, after some heavy debugging I 
realized that the problem could be the sessions and tested using sessions 
in database for B and well it worked fine.

So the question is: two, separate, web2py instances can't share the same 
redis server ? i mean, in my case is not a lambda function with 2 
applications, each application in this scenary have his own web2py version 
- for reasons outside this discussion - and i wished to reuse the already 
deployed redis server. Is there some kind of conflict betwen each web2py 
instance?

-- 
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/736c78bf-6b2c-4d5a-9537-4d3c252b479f%40googlegroups.com.


[web2py] Packing application

2020-04-24 Thread Yoel Benitez Fonseca
how to programmatically package an application as in the admin app ? I
mean, obtain the .w2p package ?

-- 
Msc. Yoel Benítez Fonseca

-- 
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/CAFDb1rVW49Lmes6sLZafg%3DbhOgCdfgov8T7Y3mJcd6o0dQ5ZJQ%40mail.gmail.com.


[web2py] db.scheduler_task.enabled

2019-12-10 Thread Yoel Benitez Fonseca
what is the meaning of

*db.scheduler_task.enabled*

Can I use it to temporarily disable a task?

-- 
Msc. Yoel Benítez Fonseca

-- 
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/CAFDb1rXURNjMfC%2B-x7vGwCCScvkinjzVOZFb454G-jbe-V%3Df_A%40mail.gmail.com.


Re: [web2py] Re: rename request hostname

2019-11-12 Thread Yoel Benitez Fonseca
H!

El lun., 11 nov. 2019 a las 17:03, Dave S ()
escribió:

>
>
> On Monday, November 11, 2019 at 7:12:44 AM UTC-8, Yoel Benitez Fonseca
> wrote:
>>
>> h!
>>
>> Is it possible to change the hostname that comes in the form request  so
>> that outbound links have the hostname i want?
>>
>
> I think you want to look at routes.py, but I haven't tried this use case,
> so any details I could give you are in the book.
>


No, I know what my mistake is, some of the links are generated by *URL*,
using the *host* and *scheme* parameters. In case it serves anyone else,
all this is deploying the app as a lambda funsion on AWS with zappa with an
NGINX in front as a proxy.

I guess I will have to hard code  the host directly in the code.



>
>
>>
>> I have an app in an internal network that I want to make visible from the
>> outside with an nginx proxy, all relative links work correctly, this would
>> be the example of configuration in nginx:
>>
>> location ~* ^/(\w+)/static(?:/_[\d]+\.[\d]+\.[\d]+)?/(.*)$ {
>>  rewrite ^/(\w+)/static(?:/_[\d]+\.[\d]+\.[\d]+)?/(.*)$
>> /some-folder/statics/staging/$2 break;
>> proxy_ignore_headers Cache-Control;
>> add_header Cache-Control public;
>> add_header Cache-Control max-age=31536000; # seconds, one year
>> proxy_pass_request_headers  on;
>> proxy_pass https://some.internal.server.local;
>> }
>>
>> location ~* ^/(.*)$ {
>> rewrite ^/(.*)$ /staging/$1 break;
>> proxy_set_header Host "some.internal.server.local";
>> proxy_set_header X-Real-IP $remote_addr;
>> proxy_ssl_server_name on;
>> proxy_pass https://some.internal.server.local;
>> }
>>
>>
>> That works correctly for any relative link, the problem comes with
>> uploads, whose links are being generated for some reason including the
>> hostname:
>>
>> https://some.internal.server.local
>> /app/download/some.object.a051462ffdcb77a3.746d706c32417038422e6a7067.jpg
>>
>> and how it happens, i can't change the internal server name and need to
>> pass the proxy_set_header Host or I will not have access to that host... The
>> only thing I can think of is telling WEB2PY to use a fixed host name when
>> generating the links.
>>
>>
> /dps
>
>
>
>
>
> --
> 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/c747477d-0665-45ba-92f5-e2a87e2d1fca%40googlegroups.com
> <https://groups.google.com/d/msgid/web2py/c747477d-0665-45ba-92f5-e2a87e2d1fca%40googlegroups.com?utm_medium=email_source=footer>
> .
>


-- 
Msc. Yoel Benítez Fonseca

-- 
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/CAFDb1rVwfPpsSoAzyymWZdJG%2Bo6pOg9zP9ukNFkMJcZ%3DquzReA%40mail.gmail.com.


[web2py] rename request hostname

2019-11-11 Thread Yoel Benitez Fonseca
h!

Is it possible to change the hostname that comes in the form request  so 
that outbound links have the hostname i want?

I have an app in an internal network that I want to make visible from the 
outside with an nginx proxy, all relative links work correctly, this would 
be the example of configuration in nginx:

location ~* ^/(\w+)/static(?:/_[\d]+\.[\d]+\.[\d]+)?/(.*)$ {
 rewrite ^/(\w+)/static(?:/_[\d]+\.[\d]+\.[\d]+)?/(.*)$ 
/some-folder/statics/staging/$2 break;
proxy_ignore_headers Cache-Control;
add_header Cache-Control public;
add_header Cache-Control max-age=31536000; # seconds, one year
proxy_pass_request_headers  on;
proxy_pass https://some.internal.server.local;
}

location ~* ^/(.*)$ {
rewrite ^/(.*)$ /staging/$1 break;
proxy_set_header Host "some.internal.server.local";
proxy_set_header X-Real-IP $remote_addr;
proxy_ssl_server_name on;
proxy_pass https://some.internal.server.local;
}


That works correctly for any relative link, the problem comes with 
uploads, whose links are being generated for some reason including the 
hostname:

https://some.internal.server.local
/app/download/some.object.a051462ffdcb77a3.746d706c32417038422e6a7067.jpg

and how it happens, i can't change the internal server name and need to 
pass the proxy_set_header Host or I will not have access to that host... The 
only thing I can think of is telling WEB2PY to use a fixed host name when 
generating the links.

-- 
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/7488ff15-0039-4ee6-8623-3e974f368903%40googlegroups.com.


[web2py] Re: permissions question

2019-10-08 Thread Yoel Benitez Fonseca
After a dive in 

gluon/tools.py

And a lot of try and errors this is what i came up to:

https://gist.github.com/ybenitezf/5e66627c668813886f9da60f67aef5e9

maybe is not the best way

El viernes, 27 de septiembre de 2019, 15:55:47 (UTC-4), Yoel Benitez 
Fonseca escribió:
>
> h!
>
> With `auth.accessible_query` u get the rows accessible to a user, how to 
> do the inverse ?
>
> I want to know the users who have a given permission
>
> -- 
> Msc. Yoel Benítez Fonseca
>
>
>
>
>
>
>

-- 
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/45c5e977-f355-46d5-9b77-c8f30b83637f%40googlegroups.com.


[web2py] permissions question

2019-09-27 Thread Yoel Benitez Fonseca
h!

With `auth.accessible_query` u get the rows accessible to a user, how to do
the inverse ?

I want to know the users who have a given permission

-- 
Msc. Yoel Benítez Fonseca

-- 
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/CAFDb1rXz3zDd70s64-UcCmmkNDLuFqoeTBu3CL8nHB1PNddfAA%40mail.gmail.com.


Re: [web2py] github vs gitlab

2019-07-23 Thread Yoel Benitez Fonseca
H! Massimo,

I'am using web2py and a private gitlab for some time now in a project of my
own. Technically both provide you the same features, more or less. But, we
had some problems since the purchase of gitlab from google - i'm from Cuba,
and  when the purchase took place gitlab (the site and repositories) got
blocked by UUSS laws and we don't longer have access to it, I guess it's
something to keep in mind since that's means that some web2py users will
not have access to the code base.

github on the other hand allow us to keep accessing the public
repositories. Is there a technical reason for the change ?

El mar., 23 jul. 2019 a las 1:56, Massimo Di Pierro (<
massimo.dipie...@gmail.com>) escribió:

> I have some reasons to consider switching from github to gitlab for web3py
> (to be renamed) have to do with naming conflicts.
> Any opinions? pros? cons?
>
> --
> 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/b6746189-0a1f-4126-8f3e-4da1299bb854%40googlegroups.com
> 
> .
>


-- 
Msc. Yoel Benítez Fonseca

-- 
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/CAFDb1rWMy4fNq%3DqdwFv%2BB73ZqTPOUezTdm%2Bxznb3evePm9rNcg%40mail.gmail.com.


[web2py] Re: intercepting login & logout events

2019-06-18 Thread Yoel Benitez Fonseca
missed that one

El martes, 18 de junio de 2019, 2:25:18 (UTC-4), Annet escribió:
>
> Web2py has auth.settings I used them to solve your problem
>
>
> auth.settings.login_onaccept = lambda form: __on_login()
> auth.settings.logout_onlogout = lambda user: __on_logout()
>
> and then in the functions the task you want to perform, in my case 
> some set up things and messages, something like:
>
>
> def __on_login():
> # set up code
>
> # messages
> if auth.user.first_name:
> name = auth.user.first_name + ' '
> elif auth.user.title:
> name = auth.user.title + ' '
> if auth.user.familyNamePreposition:
> name += auth.user.familyNamePreposition + ' '
> name += auth.user.last_name
>
> session.messages_logged_out = 'You have successfully logged out, 
> goodbye %s' %(name)
> session.flash =  'You have successfully logged in, welcome %s' %(name)
>
> return None
>
>
> def __on_logout():
> if session.forced_logout:
> auth.messages.logged_out = session.forced_logged_out_message
> else:
> auth.messages.logged_out = session.messages_logged_out
>
> return None
>
>
> Kind regards,
>
> Annet
>

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


Re: [web2py] intercepting login & logout events

2019-06-17 Thread Yoel Benitez Fonseca
Vlad, in the book:

http://www.web2py.com/books/default/chapter/29/04/the-core#HTTP-and-redirect

And i can comment out +/- the code:

def user():

# just a way to ensure form allways have a value
form = CAT()

try:

# the call to auth can return a lot of things

# it can be a form (a login form for example or a registration form)

# it can raise a redirect - for exple if the login is correct

# it can be the login form with erros if the password is incorrect

# etc
form = auth()
except HTTP as e:
if e.status == 303'login' in request.args:
if ('login' in request.args) and auth.user:
# probably a success, the user has logged in
do_your_loging_event_here()

# ensuere u do the redirect, for example a raise shoul do it
elif 'logout' if request.args:
do_your_logout_event_here()

# give the form to the view, can be register form, login form, etc
return dict(form=form)



El lun., 17 jun. 2019 a las 10:31, Vlad () escribió:

> Yoel, where could I look up how this works about the exception 303?
> Because I don't understand that part at all - I am not aware of exception
> being raised, why, and how it works in the flow - could you please point me
> to the direction where it's explained?
>
> On Monday, June 17, 2019 at 10:16:58 AM UTC-4, Yoel Benitez Fonseca wrote:
>>
>> no, it is not.
>>
>> The first time the default/user is called - in the login process for
>> example - there not a HTTP(303) (redirect) exception, and the user get the
>> form.
>> The second time, in this scenery, the call to auth() will cause a
>> redirect (HTTP exception) and the user is effectively logged into the
>> system.
>>
>> The same goes for the logout, but there is not a form in the middle.
>>
>> El lun., 17 jun. 2019 a las 9:57, Vlad () escribió:
>>
>>> but isn't such a scenario catching a user in a process of logging in or
>>> logging out, but before actual login/logout?
>>>
>>> On Monday, June 17, 2019 at 9:44:10 AM UTC-4, Yoel Benitez Fonseca wrote:
>>>>
>>>> I think you can do it in the default/user function. Having in account
>>>> that the call to auth() probably raises a HTTP exceptiong in case of a
>>>> success. This example is only a proof of concept:
>>>>
>>>> def user():
>>>> form = CAT()
>>>>
>>>> try:
>>>> form = auth()
>>>> except HTTP as e:
>>>> if e.status == 303'login' in request.args:
>>>> if ('login' in request.args) and auth.user:
>>>> # probably a success, u can test if auth.user is o not None
>>>> do_your_loging_event_here()
>>>> elif 'logout' if request.args:
>>>> do_your_logout_event_here()
>>>>
>>>> return dict(form=form)
>>>>
>>>>
>>>>
>>>> El lun., 17 jun. 2019 a las 9:19, Vlad ()
>>>> escribió:
>>>>
>>>>> What would be the simplest way to intercept login and logout?
>>>>> (i.e. I'd like to perform some additional tasks when a user is logged
>>>>> in, and when a user is logged out.)
>>>>> web2py elegantly hides the functionality in default.user under
>>>>> form=auth() and {{=form}} and somehow I can't think of a simple way to be
>>>>> notified about successful login and logout actions...
>>>>>
>>>>> --
>>>>> 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/b9dbb7bb-4500-48b2-82fd-cd8ea644f1fe%40googlegroups.com
>>>>> <https://groups.google.com/d/msgid/web2py/b9dbb7bb-4500-48b2-82fd-cd8ea644f1fe%40googlegroups.com?utm_medium=email_source=footer>
>>>>> .
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>>
>>>>
>>&

Re: [web2py] intercepting login & logout events

2019-06-17 Thread Yoel Benitez Fonseca
no, it is not.

The first time the default/user is called - in the login process for
example - there not a HTTP(303) (redirect) exception, and the user get the
form.
The second time, in this scenery, the call to auth() will cause a redirect
(HTTP exception) and the user is effectively logged into the system.

The same goes for the logout, but there is not a form in the middle.

El lun., 17 jun. 2019 a las 9:57, Vlad () escribió:

> but isn't such a scenario catching a user in a process of logging in or
> logging out, but before actual login/logout?
>
> On Monday, June 17, 2019 at 9:44:10 AM UTC-4, Yoel Benitez Fonseca wrote:
>>
>> I think you can do it in the default/user function. Having in account
>> that the call to auth() probably raises a HTTP exceptiong in case of a
>> success. This example is only a proof of concept:
>>
>> def user():
>> form = CAT()
>>
>> try:
>> form = auth()
>> except HTTP as e:
>> if e.status == 303'login' in request.args:
>> if ('login' in request.args) and auth.user:
>> # probably a success, u can test if auth.user is o not None
>> do_your_loging_event_here()
>> elif 'logout' if request.args:
>> do_your_logout_event_here()
>>
>> return dict(form=form)
>>
>>
>>
>> El lun., 17 jun. 2019 a las 9:19, Vlad () escribió:
>>
>>> What would be the simplest way to intercept login and logout?
>>> (i.e. I'd like to perform some additional tasks when a user is logged
>>> in, and when a user is logged out.)
>>> web2py elegantly hides the functionality in default.user under
>>> form=auth() and {{=form}} and somehow I can't think of a simple way to be
>>> notified about successful login and logout actions...
>>>
>>> --
>>> 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/b9dbb7bb-4500-48b2-82fd-cd8ea644f1fe%40googlegroups.com
>>> <https://groups.google.com/d/msgid/web2py/b9dbb7bb-4500-48b2-82fd-cd8ea644f1fe%40googlegroups.com?utm_medium=email_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>> --
>> Msc. Yoel Benítez Fonseca
>>
>>
>>
>>
>>
>>
>> --
> 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/ee8abe78-346c-44dd-b8a6-e9b243e4eb90%40googlegroups.com
> <https://groups.google.com/d/msgid/web2py/ee8abe78-346c-44dd-b8a6-e9b243e4eb90%40googlegroups.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Msc. Yoel Benítez Fonseca

-- 
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/CAFDb1rUYzrXURyuVquS1n3Mgk%2B4T-2aVd%3DkV9c4cTveOigAh_A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] intercepting login & logout events

2019-06-17 Thread Yoel Benitez Fonseca
Got a syntax error there, sorry:

El lunes, 17 de junio de 2019, 9:44:10 (UTC-4), Yoel Benitez Fonseca 
escribió:
>
> I think you can do it in the default/user function. Having in account that 
> the call to auth() probably raises a HTTP exceptiong in case of a success. 
> This example is only a proof of concept:
>
> def user():
> form = CAT()
> 
> try:
> form = auth()
> except HTTP as e:
> if e.status == 303:
> if ('login' in request.args) and auth.user:
> # probably a success, u can test if auth.user is o not None
> do_your_loging_event_here() 
> elif 'logout' if request.args:
> do_your_logout_event_here()
> 
> return dict(form=form)
>
>
>
>

-- 
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/a9e81732-268c-43d4-b860-390f016d4de5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] intercepting login & logout events

2019-06-17 Thread Yoel Benitez Fonseca
I think you can do it in the default/user function. Having in account that
the call to auth() probably raises a HTTP exceptiong in case of a success.
This example is only a proof of concept:

def user():
form = CAT()

try:
form = auth()
except HTTP as e:
if e.status == 303'login' in request.args:
if ('login' in request.args) and auth.user:
# probably a success, u can test if auth.user is o not None
do_your_loging_event_here()
elif 'logout' if request.args:
do_your_logout_event_here()

return dict(form=form)



El lun., 17 jun. 2019 a las 9:19, Vlad () escribió:

> What would be the simplest way to intercept login and logout?
> (i.e. I'd like to perform some additional tasks when a user is logged in,
> and when a user is logged out.)
> web2py elegantly hides the functionality in default.user under form=auth()
> and {{=form}} and somehow I can't think of a simple way to be notified
> about successful login and logout actions...
>
> --
> 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/b9dbb7bb-4500-48b2-82fd-cd8ea644f1fe%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Msc. Yoel Benítez Fonseca

-- 
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/CAFDb1rWHRtiJE3x0Puedo8tP5Wjhz59e-%2BJ7%3D4UH1sXT7V0WiQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: login_bare not working

2018-12-11 Thread Yoel Benitez Fonseca
probably abastardi wants:

username, password = request.post_vars['username'], 
request.post_vars['password']
if not auth.user:
auth.login_bare(username, password)
What is that's for ... i can only guest...

On Dec 11 2018, at 11:58 am, Anthony  wrote:
> >
> >
> >
>
>
> What is the point of calling login_bare a second time after it has failed the 
> first time?
>
> >
> > What I click to fire off the "bare login" all I get is an empty web page
> >
> > that says "None"
> >
> >
>
>
> Presumably your controller is returning None, but hard to say what's 
> happening without the code.
>
> Anthony
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to web2py+unsubscr...@googlegroups.com 
> (mailto:web2py+unsubscr...@googlegroups.com).
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [web2py] Re: Current.db

2018-10-13 Thread Yoel Benitez Fonseca


On Oct 13 2018, at 9:39 am, Anthony  wrote:
>
> Yes, but in your post, you indicated that when adding db to current in the 
> model file, it must be done inside a function rather than at the top level of 
> the model file, and that is not true. In the model file, you can do:
>
> from gluon import current
> current.db = db
>
>
>
> There is no reason to put those two lines inside a function in the model and 
> then call the function.
It is true Anthony, but i have always considered as a good practice keeping the 
globals clean of unwanted imports and definitions, so in the models i tend to 
do:
def _():
# import's, vars, even define_table calls without
# poluting globals
...
_() # call the anonymous function
Witch i think is a great way to go around, i think.
>
> Anthony
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to web2py+unsubscr...@googlegroups.com 
> (mailto:web2py+unsubscr...@googlegroups.com).
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [web2py] Re: Current.db

2018-10-12 Thread Yoel Benitez Fonseca
h!

On Oct 12 2018, at 5:33 pm, Lovedie JC  wrote:
>
> Here is the origin of the problem.
> I have two apps, I noticed that one function was using data from a db of 
> another app. When I changed that, to pick data from the apps db that's when 
> the error started. when using back the previous db the error is not there. I 
> have tried to make several changes including renaming the db in vain.
>
>
>

That is more complicate, maybe you are encountering the error because there are 
to databases with separate datasets and your function was written for the first 
application ... you should read:
http://web2py.com/books/default/chapter/29/04/the-core#Cooperation
And rewrite the function in the module in a way that it be application agnostic.
> Now another thing is that the error is 'temporary' in that when I restart the 
> server, and click on clean, under 'manage' and then open the app the error 
> disappears.
> On Sat, 13 Oct 2018, 00:16 Yoel Benitez Fonseca  (mailto:ybenit...@gmail.com)> wrote:
> > Sorry Anthony but it seems to that the original question was about accesing 
> > db trough current, with is not set in current by default so my answer is 
> > about that's.
> >
> > You need to set current.db in a models an in a module:
> > from gluon import current
> > ...
> >
> > def my_module_resident_func():
> > db = current.db
> > auth = current.auth
> >
> > And there u go with access to any thing you can attach to current
> > On Oct 12 2018, at 5:08 pm, Anthony  > (mailto:abasta...@gmail.com)> wrote:
> > >
> > > On Friday, October 12, 2018 at 4:59:07 PM UTC-4, Yoel Benitez Fonseca 
> > > wrote:
> > > > In a model do, in db.py at the end if u can:
> > > >
> > > > def _():
> > > > from gluon import current
> > > >
> > > > current.db = db
> > > > current.auth = auth
> > > > _()
> > > >
> > > > Remember's the book says: don't import current into module level code.
> > >
> > > Putting the above code in a function in the model file is not necessary 
> > > -- a model is not a module. You can use current at the top level of a 
> > > model file, as models are executed per request.
> > >
> > > Anthony
> > > --
> > > Resources:
> > > - http://web2py.com
> > > - http://web2py.com/book (Documentation)
> > > - http://github.com/web2py/web2py (Source code)
> > > - https://code.google.com/p/web2py/issues/list (Report Issues)
> > > ---
> > > You received this message because you are subscribed to the Google Groups 
> > > "web2py-users" group.
> > > To unsubscribe from this group and stop receiving emails from it, send an 
> > > email to web2py+unsubscr...@googlegroups.com 
> > > (mailto:web2py+unsubscr...@googlegroups.com).
> > > For more options, visit https://groups.google.com/d/optout.
> > >
> >
> >
> >
> > --
> > Resources:
> > - http://web2py.com
> > - http://web2py.com/book (Documentation)
> > - http://github.com/web2py/web2py (Source code)
> > - https://code.google.com/p/web2py/issues/list (Report Issues)
> > ---
> > You received this message because you are subscribed to the Google Groups 
> > "web2py-users" group.
> > To unsubscribe from this group and stop receiving emails from it, send an 
> > email to web2py+unsubscr...@googlegroups.com 
> > (mailto:web2py+unsubscr...@googlegroups.com).
> > For more options, visit https://groups.google.com/d/optout.
>
>
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to web2py+unsubscr...@googlegroups.com 
> (mailto:web2py+unsubscr...@googlegroups.com).
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [web2py] Re: Current.db

2018-10-12 Thread Yoel Benitez Fonseca
Sorry Anthony but it seems to that the original question was about accesing db 
trough current, with is not set in current by default so my answer is about 
that's.

You need to set current.db in a models an in a module:
from gluon import current
...

def my_module_resident_func():
db = current.db
auth = current.auth
And there u go with access to any thing you can attach to current
On Oct 12 2018, at 5:08 pm, Anthony  wrote:
>
> On Friday, October 12, 2018 at 4:59:07 PM UTC-4, Yoel Benitez Fonseca wrote:
> > In a model do, in db.py at the end if u can:
> >
> > def _():
> > from gluon import current
> >
> > current.db = db
> > current.auth = auth
> > _()
> >
> > Remember's the book says: don't import current into module level code.
>
> Putting the above code in a function in the model file is not necessary -- a 
> model is not a module. You can use current at the top level of a model file, 
> as models are executed per request.
>
> Anthony
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to web2py+unsubscr...@googlegroups.com 
> (mailto:web2py+unsubscr...@googlegroups.com).
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [web2py] Re: Current.db

2018-10-12 Thread Yoel Benitez Fonseca
In a model do, in db.py at the end if u can:

def _():
from gluon import current
current.db = db
current.auth = auth
_()

Remember's the book says: don't import current into module level code.
On Oct 12 2018, at 12:04 pm, Lovedie JC  wrote:
>
> Yes.
> from gluon import *
> from gluon import current, DAL,field
>
>
> On Fri, 12 Oct 2018, 18:58 Leonel Câmara  (mailto:leonelcam...@gmail.com)> wrote:
> > Did you import current from gluon before doing 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 
> > (mailto:web2py+unsubscr...@googlegroups.com).
> > For more options, visit https://groups.google.com/d/optout.
>
>
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to web2py+unsubscr...@googlegroups.com 
> (mailto:web2py+unsubscr...@googlegroups.com).
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [web2py] web2py.test replacement

2018-10-12 Thread Yoel Benitez Fonseca
I have a local copy of that repository if u are interested. Also i'm working on 
a mayor project using the test system proposed by @viniciusban in his 
repository, also with our owm modifications.

Sent from Mailspring 
(https://link.getmailspring.com/link/1539357757.local-9f00e710-50e2-v1.4.2-f587b...@getmailspring.com/0?redirect=https%3A%2F%2Fgetmailspring.com%2F=d2ViMnB5QGdvb2dsZWdyb3Vwcy5jb20%3D),
 the best free email app for work
On Oct 12 2018, at 10:40 am, Bryan Chance  wrote:
>
> Does anyone know of a web2py.test replacement? The link I see everywhere is 
> for what looks to be a deleted repo:
> https://github.com/viniciusban/web2py.test
>
>
>
> --
> Resources:
> - http://web2py.com 
> (https://link.getmailspring.com/link/1539357757.local-9f00e710-50e2-v1.4.2-f587b...@getmailspring.com/1?redirect=http%3A%2F%2Fweb2py.com=d2ViMnB5QGdvb2dsZWdyb3Vwcy5jb20%3D)
> - http://web2py.com/book 
> (https://link.getmailspring.com/link/1539357757.local-9f00e710-50e2-v1.4.2-f587b...@getmailspring.com/2?redirect=http%3A%2F%2Fweb2py.com%2Fbook=d2ViMnB5QGdvb2dsZWdyb3Vwcy5jb20%3D)
>  (Documentation)
> - http://github.com/web2py/web2py 
> (https://link.getmailspring.com/link/1539357757.local-9f00e710-50e2-v1.4.2-f587b...@getmailspring.com/3?redirect=http%3A%2F%2Fgithub.com%2Fweb2py%2Fweb2py=d2ViMnB5QGdvb2dsZWdyb3Vwcy5jb20%3D)
>  (Source code)
> - https://code.google.com/p/web2py/issues/list 
> (https://link.getmailspring.com/link/1539357757.local-9f00e710-50e2-v1.4.2-f587b...@getmailspring.com/4?redirect=https%3A%2F%2Fcode.google.com%2Fp%2Fweb2py%2Fissues%2Flist=d2ViMnB5QGdvb2dsZWdyb3Vwcy5jb20%3D)
>  (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 
> (https://link.getmailspring.com/link/1539357757.local-9f00e710-50e2-v1.4.2-f587b...@getmailspring.com/5?redirect=mailto%3Aweb2py%2Bunsubscribe%40googlegroups.com=d2ViMnB5QGdvb2dsZWdyb3Vwcy5jb20%3D).
> For more options, visit https://groups.google.com/d/optout 
> (https://link.getmailspring.com/link/1539357757.local-9f00e710-50e2-v1.4.2-f587b...@getmailspring.com/6?redirect=https%3A%2F%2Fgroups.google.com%2Fd%2Foptout=d2ViMnB5QGdvb2dsZWdyb3Vwcy5jb20%3D).
>

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

2018-09-13 Thread Yoel Benitez Fonseca
h!

You can use SQLFORM.factory and custom forms in your views
(http://web2py.com/books/default/chapter/29/07/forms-and-validators#Custom-forms).

El jue., 13 sept. 2018 a las 9:34, elisha bere
() escribió:
>
> ok. thanks but is it safe ?
>
>
> On Thu, 13 Sep 2018 at 15:25, sandeep patel  wrote:
>>
>> You can use request.vars in your controller function you will get your form 
>> input values under the Storage class.
>>
>> Best
>>
>>
>>
>> On Thu, Sep 13, 2018 at 6:41 PM elisha bere  wrote:
>>>
>>> Hie,
>>>
>>> i would like to know how i can create a form in html and then get the input 
>>> as variables in my controls.
>>> NB: i already know how to create a form using SQLFORMS but i would like to 
>>> know if i can make a form in html and get values that i would use in my 
>>> logic
>>>
>>> --
>>> Resources:
>>> - http://web2py.com
>>> - http://web2py.com/book (Documentation)
>>> - http://github.com/web2py/web2py (Source code)
>>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>>> ---
>>> You received this message because you are subscribed to the Google Groups 
>>> "web2py-users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send an 
>>> email to web2py+unsubscr...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>
>> --
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> ---
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to web2py+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 
Msc. Yoel Benítez Fonseca

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


Re: [web2py] Re: How to go publick with web2py

2018-07-28 Thread Yoel Benitez Fonseca
no, you need nothing extra, checkout you antivirus and windows
firewall those 2 can't refuse your inbound connections.
El sáb., 28 jul. 2018 a las 8:28, Stavros Boletis
() escribió:
>
> i need one more answer..How i can do it on windows?? cause every answer i 
> find is for ubu or linux enviroemnt. When i execute web2py.exe i choose 
> public(0.0.0.0) and the port and it should work?? or i need to do smthng 
> extra ??
>
> 2018-07-26 16:53 GMT+03:00 Stavros Boletis :
>>
>> Thanks for your answer that was exactly what i was looking for..i ll try it 
>> soon and i ll inform you for any progress.
>>
>> Στις Πέμ, 26 Ιουλ 2018, 16:15 ο χρήστης 黄祥  
>> έγραψε:
>>>
>>> pardon, not sure what is exactly means go public, if you want web2py app 
>>> can be accessed from other pc's and network (lan), perhaps you can set your 
>>> web server to allow it access from outside
>>> e.g. using rocket (shipped with web2py)
>>> python web2py.py -i 0.0.0.0
>>> another thing is go public means in wan, you can use pythonanywhere or 
>>> something like that (heroku, amazon, google cloud)
>>> ref:
>>> http://web2py.com/books/default/chapter/29/13/deployment-recipes#Deploying-on-PythonAnywhere
>>>
>>> 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.
>
>
> --
> 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.



-- 
Msc. Yoel Benítez Fonseca

-- 
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: scheduler trouble

2018-07-09 Thread Yoel Benitez Fonseca
Can you try...cath the task code and send the notification on exception
base  from the task it self, or make other kind of task that can be
schelude fron the first to send the notification in case of failure?

El vie., 6 jul. 2018 a las 5:51, Manuele Pesenti ()
escribió:

> Hi Dave,
>
> thanks for your reply, I'm actually debugging but I found that the
> problem was a callback I added after scheduler_run update event in order
> to be advised by email for failed tasks.
>
> Is there a more correct way of doing it? Maybe should be a good feature
> for schduler.
>
> Cheers
>
>  Manuele
>
>
> On 06/07/2018 00:30, Dave S wrote:
> > Never happens to me, so I can only guess:\
> >
> > - you're waiting for a locked file ... IIRC, you're not using sqlite,
> > though, right?
> I'm using PostgreSQL
> > - you have a process that blocks waiting for results (like a response
> > from a remote system) and there are no results
> >
> > I think I can exclude things like seg faults, because those terminate
> > and would be logged as errors.
>
> --
> 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.
>


-- 
Msc. Yoel Benítez Fonseca

-- 
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] How to know if my code is execute by a scheduler ?

2018-06-22 Thread Yoel Benitez Fonseca
That is not documented on the book got it working on my own way.

Thanks
El mié., 30 may. 2018 a las 18:25, Bryan Chance () escribió:
>
> if request.is_scheduler:
> db.commit()
>
> source: https://groups.google.com/forum/#!topic/web2py/ZDoDGH7DNjY
>
> On Wed, May 30, 2018 at 9:53 AM, Yoel Benitez Fonseca  
> wrote:
>>
>> I have a code (insert or modify some values on tables) with can be called 
>> both from a scheduler task and the normal request based method, in the last 
>> db.commit is called by web2py.
>>
>> The problem is the same code won't commit the changes unless explicity 
>> db.commit if running on a scheluder task.
>>
>> --
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> ---
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to web2py+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 
Msc. Yoel Benítez Fonseca

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


[web2py] How to know if my code is execute by a scheduler ?

2018-05-30 Thread Yoel Benitez Fonseca
I have a code (insert or modify some values on tables) with can be called 
both from a scheduler task and the normal request based method, in the last 
db.commit is called by web2py.

The problem is the same code won't commit the changes unless explicity 
db.commit if running on a scheluder task.

-- 
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] Quick question... URL and scheduler...

2018-05-26 Thread Yoel Benitez Fonseca
H!

Got this task on a scheduler in with an email notification is geneted for
the users, the scheduler and the web server are not running on the same
host.

In the notificación i need to pass a link to the user, for example:


 some text


My question is ¿what hostname will be used takng in account that the
scheduler and the webserver don't live together?

-- 
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] list:reference and SQLFORM.grid

2018-04-21 Thread Yoel Benitez Fonseca
Is the grid search not working witch list:reference ?

for example:

db.define_table('thing',  Field('name', 'string'))
db.define_table('person', Field('name', 'string'), Field('things', 
'list:reference thing'))
db.person.things.requires = IS_IN_DB(db, 'thing.id', '%(name)s', 
multiple=True)

The things fild can't be search by the grid console ?

-- 
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: Pass a query from form to another function

2018-04-20 Thread Yoel Benitez Fonseca
Umm... sorry took long to answer, i have put on issue on PyDAL repo and a 
pull request with a posible fix:

https://github.com/web2py/pydal/pull/531

El martes, 10 de abril de 2018, 22:20:04 (UTC-4), Anthony escribió:
>
> On Tuesday, April 10, 2018 at 6:14:06 PM UTC-4, Yoel Benitez Fonseca wrote:
>>
>> Is this not working any more ?
>>
>> >>> q = (db.photo.id == 1)
>> >>> db(q.as_dict(flat=True)).select()
>>   File "", line unknown
>> SyntaxError: Operator not supported: eq
>>
>> That is in a web2py shell,i mean is the same thing passing around the 
>> query in the session as a dict, is not ?
>>
>
> Looks like it could be broken now. Feel free to file an issue with the 
> PyDAL repository.
>
> Anthony
>

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


[web2py] Re: Pass a query from form to another function

2018-04-10 Thread Yoel Benitez Fonseca
Is this not working any more ?

>>> q = (db.photo.id == 1)
>>> db(q.as_dict(flat=True)).select()
  File "", line unknown
SyntaxError: Operator not supported: eq

That is in a web2py shell,i mean is the same thing passing around the query 
in the session as a dict, is not ?

El miércoles, 7 de diciembre de 2016, 14:56:20 (UTC-5), Anthony escribió:
>
> On Wednesday, December 7, 2016 at 9:33:16 AM UTC-5, Marlysson Silva wrote:
>>
>> You can use sessions..
>>
>> session.content = query_search
>>
>
> A Query object can't be pickled to store it in the session, but you can 
> first convert to a dictionary:
>
> session.search_query = search_query.as_dict(flat=True)
>
> Then in the second function:
>
> db(session.search_query).select()
>
> Anthony
>

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


[web2py] compiling application ?

2018-02-27 Thread Yoel Benitez Fonseca
Is there a way of compiling a web2py application from the command line ?

-- 
Msc. Yoel Benítez Fonseca

-- 
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] _href to URL()

2018-02-24 Thread Yoel Benitez Fonseca
don't use URL at all, just do:

('TaC', False, A('TaC',
_href='https://static.domain.com/files/Terms_and_Conditions.pdf',
_target="_blank", vars=dict(attachment=True)))

If it gives an error call  the .xml() directly on A:

('TaC', False, A('TaC',
_href='https://static.domain.com/files/Terms_and_Conditions.pdf',
_target="_blank", vars=dict(attachment=True)).xml())

2018-02-24 12:18 GMT-05:00 'Annet' via web2py-users :
> I have the following link in a view:
>
> {{=A('TaC',
> _href='https://static.domain.com/files/Terms_and_Conditions.pdf',
> _target="_blank", vars=dict(attachment=True))}}
>
> I want to convert it to a menu item
>
> ('TaC', False, URL(???))
>
> How do I convert the _href to a URL()
>
>
> Kind regards
>
> Annet
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 
Msc. Yoel Benítez Fonseca

-- 
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: Resetting the database

2018-01-29 Thread Yoel Benitez Fonseca
I wan't to clean up my database trough an script with i want to use as a 
data generator for demo purposes it work's fine wth SQLite but with Mysql 
got a lot of error's:

def limpiar_db(db, models):
for m in models:
l("Limpiando tabla: {}".format(m))
db[m].truncate()
db.commit()

a_limpiar = [
'almacenamiento', 'perfil',
'movimiento_inventario', 'componente_modelo_producto',
'componente', 'modelo_producto',
'auth_permission', 'auth_membership', 'auth_user', 'auth_group',
]
limpiar_db(db, a_limpiar)


With mysql:

DEBUG:web2py.demo102017:Limpiando tabla: movimiento_inventario
DEBUG:web2py.demo102017:Limpiando tabla: componente_modelo_producto
DEBUG:web2py.demo102017:Limpiando tabla: componente
Traceback (most recent call last):
  File "/opt/web-apps/web2py/gluon/shell.py", line 274, in run
execfile(startfile, _env)
  File "applications/demo102017/private/generadordatos.py", line 150, in 

limpiar_db(db, a_limpiar)
  File "applications/demo102017/private/generadordatos.py", line 137, in 
limpiar_db
db[m].truncate()
  File "/opt/web-apps/web2py/gluon/packages/dal/pydal/objects.py", line 869, 
in truncate
return self._db._adapter.truncate(self, mode)
  File "/opt/web-apps/web2py/gluon/packages/dal/pydal/adapters/base.py", 
line 824, in truncate
self.execute(query)
  File "/opt/web-apps/web2py/gluon/packages/dal/pydal/adapters/__init__.py", 
line 67, in wrap
return f(*args, **kwargs)
  File "/opt/web-apps/web2py/gluon/packages/dal/pydal/adapters/base.py", 
line 412, in execute
rv = self.cursor.execute(command, *args[1:], **kwargs)
  File "/usr/lib64/python2.7/site-packages/MySQLdb/cursors.py", line 205, in 
execute
self.errorhandler(self, exc, value)
  File "/usr/lib64/python2.7/site-packages/MySQLdb/connections.py", line 36, 
in defaulterrorhandler
raise errorclass, errorvalue
OperationalError: (1701, 'Cannot truncate a table referenced in a foreign 
key constraint (`demo102017`.`componente_modelo_producto`, CONSTRAINT 
`componente_modelo_producto_ibfk_1` FOREIGN KEY (`componente`) REFERENCES 
`demo102017`.`componente` (`id`))')


 

El viernes, 21 de abril de 2017, 11:18:30 (UTC-4), Massimo Di Pierro 
escribió:
>
> In the case of sqlite it is easy enough to also delete the content of the 
> databases/ folder.
>
> On Sunday, 16 April 2017 09:37:11 UTC-5, Matthew J Watts wrote:
>>
>> I had to log out of my webapp before deleting the database data, 
>> otherwise i would get an error message
>>
>> cheers
>>
>> On Monday, November 14, 2011 at 1:38:15 AM UTC+1, Archibald Linx wrote:
>>>
>>> Dear Web2py users, 
>>>
>>> How can I reset the database of my Web2py project ? 
>>>
>>> Thanks, 
>>> Archibald
>>
>>

-- 
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] request.args(0) vs request.args[0]

2017-11-30 Thread Yoel Benitez Fonseca
thnks a lot

2017-11-30 6:36 GMT-05:00 Anthony <abasta...@gmail.com>:
> Note, request.args is an instance of the gluon.storage.List class. It has a
> __call__ method, so in addition to acting like a standard Python list, it
> can be called like a function.
>
> Anthony
>
>
> On Wednesday, November 29, 2017 at 7:10:19 PM UTC-5, Dave S wrote:
>>
>>
>>
>> On Wednesday, November 29, 2017 at 8:19:57 AM UTC-8, Massimiliano wrote:
>>>
>>> Try it without passing the args
>>>
>>> def test():
>>> print request.args(0) #return None
>>> print request.args[0] #fail
>>>
>>
>> That's "fail" as in "ticket issued", because of array bounds error.  Also,
>> on the grammar level, that's an array reference and the other is a function
>> ... and Anthony has posted about the additional parameters the function has.
>>
>> /dps
>>
>>> On Wed, Nov 29, 2017 at 5:16 PM, Yoel Benitez Fonseca <yben...@gmail.com>
>>> wrote:
>>>>
>>>> ¿What is the diff?
>>>>
>>>> --
>>>> Msc. Yoel Benítez Fonseca
>>>>
>>>> --
>>>> 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.
>>>
>>>
>>>
>>>
>>> --
>>> Massimiliano
>
> --
> 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.



-- 
Msc. Yoel Benítez Fonseca

-- 
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] request.args(0) vs request.args[0]

2017-11-29 Thread Yoel Benitez Fonseca
¿What is the diff?

-- 
Msc. Yoel Benítez Fonseca

-- 
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] PluginManager is not instantiated in the default scaffolding app

2017-11-27 Thread Yoel Benitez Fonseca
h!

This is web2py 2.16.1, in the book:

http://web2py.com/books/default/chapter/29/12/components-and-plugins#Plugin-manager

Says:

The plugins object is already instantiated in the default scaffolding
app in "models/db.py"

But creating an app from the admin the PluginManager object is no
where to be found.

-- 
Msc. Yoel Benítez Fonseca

-- 
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] list:string field length

2017-11-19 Thread Yoel Benitez Fonseca
I don't mean to set the length, i just wanted to know the DAL behavior
behind the scene. So, DAL translate 'string:list' to a list in
databases that natively support lists and to a TEXT field on normal
relational databases and hence set the length of the text field to the
default ?

2017-11-17 15:53 GMT-05:00 Donald McClymont :
> I don’t think you can set this but not sure why you would want to.  However 
> beware if testing the length of the field as I think if you only have 1 item 
> in the list then this is a string and you get the number of chars in the 
> string.  While if you have more than 1 you get the length of the list.  So 
> you may need to test the type before using length to ensure you get what you 
> expect.   I don’t know if this would be considered a bug or if it is still 
> the way it works but it was how it worked in 2.15.x and may have been a 
> change from 2.14.x.  I haven’t checked 2.16.1
>
> Donald
>
> --
> 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.



-- 
Msc. Yoel Benítez Fonseca

-- 
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] list:string field length

2017-11-17 Thread Yoel Benitez Fonseca
h!

I always wanted to ask: According the online book, it is recommended
to explicit set the length of  "string", "password" or "upload", but
what about list:string ?

-- 
Msc. Yoel Benítez Fonseca

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


Re: [web2py] Re: web2py 2.16.1 is OUT

2017-11-14 Thread Yoel Benitez Fonseca
Got some strange result after the updates... im ussing pytest for
testing and the was a test for a submit form with was working últil
the update, the model:

db.define_table(
'producto',
Field('nombre', 'string', length=50, unique=True, label='Nombre:'),
Field('tipo_producto_id', 'reference tipo_producto', label='Tipo:'),
Field('precio', 'float', label='Precio:'),
Field('descripcion', 'text', length=1250, label='Descripción:'),
Field('imagen', 'upload', label='Imagen:'),
Field('thumb', 'upload', writable=False, readable=False),
format='%(nombre)s')

The test will fail for db.tipo_producto_id allowing not in db
referenceuntil i got the to the code and explicity put the
validator:

db.producto.tipo_producto_id.requires = IS_IN_DB(
db, 'tipo_producto.id', '%(nombre)s'
)

idk what was that about... other models defined on the app and not
defining explicid validator work as usual.

2017-11-14 10:01 GMT-05:00 Massimo Di Pierro :
> check your models/menu.py you may have separators in the menu. The new
> layout does not support them.
>
>
> On Tuesday, 14 November 2017 02:22:51 UTC-6, 黄祥 wrote:
>>
>> Traceback (most recent call last):
>>   File "/Users/MacBookPro/project/python/web2py/gluon/restricted.py", line
>> 219, in restricted
>> exec(ccode, environment)
>>   File
>> "/Users/MacBookPro/project/python/web2py/applications/test/views/default/index.html",
>> line 60, in 
>>   File "/Users/MacBookPro/project/python/web2py/gluon/html.py", line 783,
>> in __getitem__
>> return self.components[i]
>> IndexError: list index out of range
>>
>> views/default/index.html
>> {{extend 'layout.html'}}
>> {{include 'templates/index/index.html'}}
>>
>> views/templates/index/index.html
>> {{=H1(T('Test'), _align = 'Center' ) }}
>>
>> code in traceback line 60 is italic and bold:
>> for _item in response.menu or []:
>> response.write('\n  ', escape=False)
>> if len(_item)<4 or not _item[3]:
>> response.write('\n  \n', escape=False)
>> response.write(_item[0])
>> response.write('\n  \n  ', escape=False)
>> else:
>> response.write('\n  \n
>> > aria-expanded="false">', escape=False)
>> response.write(_item[0])
>> response.write('\n\n
>> ', escape=False)
>> for _subitem in _item[3]:
>> response.write('\n  > href="', escape=False)
>> response.write(_subitem[2])
>> response.write('">', escape=False)
>> response.write(_subitem[0])
>> response.write('\n  ', escape=False)
>> pass
>> response.write('\n\n  \n
>> ', escape=False)
>> pass
>> response.write('\n  ', escape=False)
>> pass
>
> --
> 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.



-- 
Msc. Yoel Benítez Fonseca
Dpto. Informática. Redacción Adelante
http://www.adelante.cu/

-- 
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: Custom maintenance message

2017-10-20 Thread Yoel Benitez Fonseca
Nerver mind ... i have found app/static/503.html

now ¿how to include images and souch ?

2017-10-20 12:04 GMT-04:00 Yoel Benitez Fonseca <ybenit...@gmail.com>:
> hi !
>
> How can i make a custom 'Temporarily down for maintenance' page ?
>
> --
> Msc. Yoel Benítez Fonseca
> Dpto. Informática. Redacción Adelante
> http://www.adelante.cu/



-- 
Msc. Yoel Benítez Fonseca
Dpto. Informática. Redacción Adelante
http://www.adelante.cu/

-- 
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] Custom maintenance message

2017-10-20 Thread Yoel Benitez Fonseca
hi !

How can i make a custom 'Temporarily down for maintenance' page ?

-- 
Msc. Yoel Benítez Fonseca
Dpto. Informática. Redacción Adelante
http://www.adelante.cu/

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


[web2py] Web2py con CentOS 7 with apache 2.4

2017-10-06 Thread Yoel Benitez Fonseca
Anyone with a example apache config working ... I've been trying for 2
days and got nothing... the python coded is executed correct but my
static are either 403 or 404.. here is my apache config:

https://pastebin.com/uV0aEu0F

And the error log from apache:

[Fri Oct 06 17:52:38.698109 2017] [authz_core:error] [pid 15941:tid
140229217228544] [client 127.0.0.1:34980] AH01630: client denied by
server configuration: /opt/web-apps/web2py/applications/$1, referer:
https://.../examples/
[Fri Oct 06 17:52:38.928778 2017] [authz_core:error] [pid 15941:tid
140229217228544] [client 127.0.0.1:34980] AH01630: client denied by
server configuration: /opt/web-apps/web2py/applications/$1, referer:
https://.../examples/
[Fri Oct 06 17:52:38.931174 2017] [authz_core:error] [pid 15941:tid
140229217228544] [client 127.0.0.1:34980] AH01630: client denied by
server configuration: /opt/web-apps/web2py/applications/$1, referer:
https://.../examples/
[Fri Oct 06 17:52:39.154339 2017] [authz_core:error] [pid 15941:tid
140229217228544] [client 127.0.0.1:34980] AH01630: client denied by
server configuration: /opt/web-apps/web2py/applications/$1, referer:
https://.../examples/

The result, i can access the apps but without statics

-- 
Msc. Yoel Benítez Fonseca
Dpto. Informática. Redacción Adelante
http://www.adelante.cu/

-- 
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] Setup web2py on apache 2.4 along side with plex

2017-10-05 Thread Yoel Benitez Fonseca
Hi,

I got all setup and running except that static files are denied by apache (2.4):

this is my apache config:

--
  WSGIDaemonProcess web2py user=apache group=apache
  WSGIProcessGroup web2py
  WSGIScriptAlias / /opt/web-apps/web2py/wsgihandler.py
  WSGIPassAuthorization On

  
AllowOverride None
Order Allow,Deny
Deny from all

  Require all granted
  Allow from all

  

  AliasMatch ^/([^/]+)/static/(?:_[\d]+.[\d]+.[\d]+/)?(.*) /opt/web-apps/$

  
Options -Indexes
Require all granted
  

  
Deny from all
  

  
Deny from all
  
-

The apache config is managed by plex with allow including additional
configuration via 'vhost.conf' and 'vhost_ssl.conf'.


The web2py code is executed correctly but all access to statics files
is denied, anyone with a similar setup ?


-- 
Msc. Yoel Benítez Fonseca
Dpto. Informática. Redacción Adelante
http://www.adelante.cu/

-- 
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: weird issue with date field

2017-08-29 Thread Yoel Benitez Fonseca
umm.. should test it again ... thnk

2017-08-28 22:37 GMT-04:00 Peter :

> For what it's worth...
>
> I downloaded the latest,
>
> 2.15.3-stable+timestamp.2017.08.07.12.51.45
> (Running on Rocket 1.2.6, Python 2.7.12)
>
>
> pasted your code into db.py
>
> used crud.create in the controller (I know I should move on)
>
> created a view  (default)
> {{extend 'layout.html'}}
> This is the default/test_date.html template
> {{=BEAUTIFY(response._vars)}}
>
>
> and it worked ok...
>
>
>
>
> 
>
>
>
> 
>
>
>
> 
>
>
>
> 
>
>
> 
>
>
>
>
> checked the sqlite db  and entries appear normal...
>
> "1""my name""12345678901""2017-08-29""25.0""35.0"
> "2""my name""12345678902""2017-08-30""25.0""35.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.
>



-- 
Msc. Yoel Benítez Fonseca
Dpto. Informática. Redacción Adelante
http://www.adelante.cu/

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


Re: [web2py] Re: web2py 2.15.3 is OUT

2017-08-28 Thread Yoel Benitez Fonseca
Hi,

new copy of 2.15.3, create a model with a date Field - using SQLite,
in appadmin or a CRUD form the date widget don't show the year, just
the name of the day.

I come from 2.14.6, don't know if this is something related only to
2.15.3 or is that i'm missing something.

2017-08-27 21:13 GMT-04:00 Anthony :
> It's not clear how that would be related to response.js, as it appears the
> code returned via response.js is in fact being executed in the browser. It's
> hard to say what's going wrong in the browser without knowing more about the
> JS and what the DOM looks like at that point.
>
> Anthony
>
>
> On Sunday, August 27, 2017 at 8:16:19 PM UTC-4, 黄祥 wrote:
>>
>> it seems response.js have a different behaviour in new version
>> e.g. (the same code work well in 2.14.6)
>> ...
>> if form.process().accepted:
>> ...
>> target_response = "jQuery('#test .close').click();
>> jQuery('#test').get(0).reload()"
>> response.js =  target_response
>> #redirect(request.env.http_web2py_component_location, client_side =
>> True)
>>
>> in 2.14.6, after the form submited it automatically reload the web2py
>> component and the page still responding, while in the latest version the
>> modal is closed, the component data is reload with new value but the page is
>> not responding, just have the dark silouette of the page, the solution is
>> must refresh the page or append :
>> redirect(request.env.http_web2py_component_location, client_side = True)
>> is it normal or did i missed something in the latest version ?
>>
>> thanks and 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.



-- 
Msc. Yoel Benítez Fonseca
Dpto. Informática. Redacción Adelante
http://www.adelante.cu/

-- 
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] weird issue with date field

2017-08-28 Thread Yoel Benitez Fonseca
hi, i got a new copy of the lasted stable web2py from web2py.com, put
in this simple model:

tbl = db.define_table(
"productos",
Field('nombre', 'string', length=100, label='Nombre'),
Field('codigo', 'string', length=30, label='Código'),
Field('fecha_caducidad', 'date', label='Fecha caducidad'),
Field('precio_compra', 'double', label='Precio compra'),
Field('precio_venta', 'double', label='Precio venta'),
)

tbl.nombre.requires = [IS_NOT_EMPTY()]
tbl.codigo.requires = [IS_NOT_EMPTY(), IS_LENGTH(11)]
tbl.fecha_caducidad.requires = IS_DATE()
tbl.precio_venta.requires.append(IS_NOT_EMPTY())
tbl.precio_compra.requires.append(IS_NOT_EMPTY())


And when testing the 'date' field in the page, with the default
widget, ignored the years putting instead the day name and 1900 as the
year.

¿is there something a'm missing? with 2.14.6 that dont happen.

I have tried with the format parameter in the validator with the same results.

-- 
Msc. Yoel Benítez Fonseca
Dpto. Informática. Redacción Adelante
http://www.adelante.cu/

-- 
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] w2p appliance

2017-03-01 Thread Yoel Benitez Fonseca
H!

How can i add my app to the appliances list (http://www.web2py.com/appliances)?

My project live on https://github.com/ybenitezf/nstock, is a work on
progress. I thought I would make some money with it but things have
not turned out as I wanted. I pretend to continue working on it
anyway.

-- 
Yoel Benítez Fonseca
http://redevil.cubava.cu/
$ python -c "import 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.


Re: [web2py] Re: How to limit the size of uploads?

2017-01-30 Thread Yoel Benitez Fonseca
my bad.

2017-01-28 17:14 GMT-05:00 Leonel Câmara :
> No Yoel, if he uses my second tip, which is change the webserver
> configuration, the webserver will readily block the client after the limit
> is reached and before the upload is finished.
>
> --
> 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.



-- 
Yoel Benítez Fonseca
http://redevil.cubava.cu/
$ python -c "import 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.


Re: [web2py] Re: How to limit the size of uploads?

2017-01-28 Thread Yoel Benitez Fonseca
Yea but theres two tips form Leonel implied that the client already
have send data to the server with is what tomc514 is trying to avoid.

2017-01-28 9:54 GMT-05:00 Leonel Câmara :
> You can use the IS_LENGTH validator, then usually people place max body size
> on the webserver configuration, for instance in nginx you can use
> client_max_body_size 50m; and that would limit uploads to 50 MB
>
> --
> 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.



-- 
Yoel Benítez Fonseca
http://redevil.cubava.cu/
$ python -c "import 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.


Re: [web2py] Re: How do I add labels and text field dynamically in web2py and saved them into database.

2017-01-28 Thread Yoel Benitez Fonseca
think he wants to add fields on-the-fly to the database based on user input.

2017-01-27 23:30 GMT-05:00 Massimo Di Pierro :
> sorry do not understand
>
>
> On Friday, 20 January 2017 18:42:22 UTC-6, Corden Naraga wrote:
>>
>> Scenario: I have a Terms option ranging from 1-6. If I select 3, 3 labels
>> and 3 text fields will be generated to the form and can be saved to the
>> database.
>>
>> eg:
>> - Terms: 3
>> - Result:
>> Label1 TextFieldDate1 TextFieldValue1
>> Label2 TextFieldDate2 TextFieldValue2
>> Label3 TextFieldDate3 TextFieldValue3
>>
>> Just found the same scenario with jquery, but want to insert into mysl or
>> postgresql database.
>>
>> 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.



-- 
Yoel Benítez Fonseca
http://redevil.cubava.cu/
$ python -c "import 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.


Re: [web2py] Re: User group blocked in China

2017-01-28 Thread Yoel Benitez Fonseca
i'm a email user, don't use - almost never - the GG web UI. Works find with me.

2017-01-27 23:39 GMT-05:00 Massimo Di Pierro :
> willing to help with this. but moving the group out of google group is a lot
> of work. If you can think of a different solution let me know.
>
>
> On Tuesday, 24 January 2017 21:19:16 UTC-6, Ben Lawrence wrote:
>>
>> Hi
>> I am in China for 3 weeks and suddenly realized this awesome user group is
>> now blocked! So up comes the VPN tunnel... But for our Chinese comrades,
>> would you consider  moving the group to web2py.com ?
>> regards
>> Ben
>
> --
> 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.



-- 
Yoel Benítez Fonseca
http://redevil.cubava.cu/
$ python -c "import 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.


Re: [web2py] Web2py conditional models

2017-01-28 Thread Yoel Benitez Fonseca
this for example:

https://github.com/yotech/agis/blob/master/app/agis/modules/agiscore/db/grupo.py

Not a complete correct example, but can pin/ping the idea

2017-01-28 9:05 GMT-05:00 Yoel Benitez Fonseca <ybenit...@gmail.com>:
> sorry on 1.- sould say:
>
> 1.- Pass your models definitions to modules and packages on ``modules``
>
> 2017-01-28 9:04 GMT-05:00 Yoel Benitez Fonseca <ybenit...@gmail.com>:
>> I have being there :-/ ... what i do was:
>>
>> 1.- Pass your models definitions to models and packages on ``modules``
>> 2.- In the modules put each table definition on a method, for example:
>>
>> define_tables():
>> db = current.db
>> if not hasattr(db, 'some_table'):
>> db.define_table('some_table', )
>>
>> 3.- then whenever a some_other_table depends on some_table, in the
>> module corresponding to some_other_table you import the corresponding
>> define_tables of some_table and call it to ensure it get defined
>> before some_other_table references it.
>> 4.- use conditional models, and in the conditional model of a given
>> controller you import and call only the one you need.
>>
>> This way, the imports and define_tables ensure the table definitions
>> precedences and work out the needed for you the downside of
>> passing models definitions  to modules is that u need to reload the
>> complete web2py instance... hence, if you are running it trough apache
>> it must be restarted for changes to refresh.
>>
>> Regards,
>>
>>
>> 2017-01-26 7:28 GMT-05:00 Bentorey Hernández Cruz <bentore...@gmail.com>:
>>> Hi all,
>>> I have a question related to table definitions in modules. I'm working
>>> in an app that has more than a hundred tables and I noticed that even using
>>> lazy tables it took too much for browsing the site.
>>> I decided to move some of the tables to a module and call them on
>>> demand, and the performance improved a lot.
>>> The problem is if there's any way to define new tables from the module.
>>>
>>>Whatever I do, I get the error:
>>>
>>>   ProgrammingError: ('ERROR', '42P01', 'relation "test_t" does not exist')
>>>
>>> Definition of test_t in module
>>>>
>>>> from gluon import *
>>>> from gluon.dal import Field
>>>> def defineTEST(db):
>>>> if 'test_t' not in db:
>>>> db.define_table('test_t',
>>>> Field('bid', 'reference b_t', ondelete='CASCADE'),
>>>> Field('date', 'date'),
>>>> migrate=app_settings.migrate)
>>>
>>>
>>> Code added to 10dbmodel.py in models:
>>>>
>>>> from app.modules import defineTEST
>>>> defineTEST(db)
>>>
>>>
>>>And the table is not created.
>>>
>>> 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/d/optout.
>>
>>
>>
>> --
>> Yoel Benítez Fonseca
>> http://redevil.cubava.cu/
>> $ python -c "import this"
>
>
>
> --
> Yoel Benítez Fonseca
> http://redevil.cubava.cu/
> $ python -c "import this"



-- 
Yoel Benítez Fonseca
http://redevil.cubava.cu/
$ python -c "import 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.


Re: [web2py] Web2py conditional models

2017-01-28 Thread Yoel Benitez Fonseca
sorry on 1.- sould say:

1.- Pass your models definitions to modules and packages on ``modules``

2017-01-28 9:04 GMT-05:00 Yoel Benitez Fonseca <ybenit...@gmail.com>:
> I have being there :-/ ... what i do was:
>
> 1.- Pass your models definitions to models and packages on ``modules``
> 2.- In the modules put each table definition on a method, for example:
>
> define_tables():
> db = current.db
> if not hasattr(db, 'some_table'):
> db.define_table('some_table', )
>
> 3.- then whenever a some_other_table depends on some_table, in the
> module corresponding to some_other_table you import the corresponding
> define_tables of some_table and call it to ensure it get defined
> before some_other_table references it.
> 4.- use conditional models, and in the conditional model of a given
> controller you import and call only the one you need.
>
> This way, the imports and define_tables ensure the table definitions
> precedences and work out the needed for you the downside of
> passing models definitions  to modules is that u need to reload the
> complete web2py instance... hence, if you are running it trough apache
> it must be restarted for changes to refresh.
>
> Regards,
>
>
> 2017-01-26 7:28 GMT-05:00 Bentorey Hernández Cruz <bentore...@gmail.com>:
>> Hi all,
>> I have a question related to table definitions in modules. I'm working
>> in an app that has more than a hundred tables and I noticed that even using
>> lazy tables it took too much for browsing the site.
>> I decided to move some of the tables to a module and call them on
>> demand, and the performance improved a lot.
>> The problem is if there's any way to define new tables from the module.
>>
>>Whatever I do, I get the error:
>>
>>   ProgrammingError: ('ERROR', '42P01', 'relation "test_t" does not exist')
>>
>> Definition of test_t in module
>>>
>>> from gluon import *
>>> from gluon.dal import Field
>>> def defineTEST(db):
>>> if 'test_t' not in db:
>>> db.define_table('test_t',
>>> Field('bid', 'reference b_t', ondelete='CASCADE'),
>>> Field('date', 'date'),
>>> migrate=app_settings.migrate)
>>
>>
>> Code added to 10dbmodel.py in models:
>>>
>>> from app.modules import defineTEST
>>> defineTEST(db)
>>
>>
>>And the table is not created.
>>
>> 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/d/optout.
>
>
>
> --
> Yoel Benítez Fonseca
> http://redevil.cubava.cu/
> $ python -c "import this"



-- 
Yoel Benítez Fonseca
http://redevil.cubava.cu/
$ python -c "import 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.


Re: [web2py] Web2py conditional models

2017-01-28 Thread Yoel Benitez Fonseca
I have being there :-/ ... what i do was:

1.- Pass your models definitions to models and packages on ``modules``
2.- In the modules put each table definition on a method, for example:

define_tables():
db = current.db
if not hasattr(db, 'some_table'):
db.define_table('some_table', )

3.- then whenever a some_other_table depends on some_table, in the
module corresponding to some_other_table you import the corresponding
define_tables of some_table and call it to ensure it get defined
before some_other_table references it.
4.- use conditional models, and in the conditional model of a given
controller you import and call only the one you need.

This way, the imports and define_tables ensure the table definitions
precedences and work out the needed for you the downside of
passing models definitions  to modules is that u need to reload the
complete web2py instance... hence, if you are running it trough apache
it must be restarted for changes to refresh.

Regards,


2017-01-26 7:28 GMT-05:00 Bentorey Hernández Cruz :
> Hi all,
> I have a question related to table definitions in modules. I'm working
> in an app that has more than a hundred tables and I noticed that even using
> lazy tables it took too much for browsing the site.
> I decided to move some of the tables to a module and call them on
> demand, and the performance improved a lot.
> The problem is if there's any way to define new tables from the module.
>
>Whatever I do, I get the error:
>
>   ProgrammingError: ('ERROR', '42P01', 'relation "test_t" does not exist')
>
> Definition of test_t in module
>>
>> from gluon import *
>> from gluon.dal import Field
>> def defineTEST(db):
>> if 'test_t' not in db:
>> db.define_table('test_t',
>> Field('bid', 'reference b_t', ondelete='CASCADE'),
>> Field('date', 'date'),
>> migrate=app_settings.migrate)
>
>
> Code added to 10dbmodel.py in models:
>>
>> from app.modules import defineTEST
>> defineTEST(db)
>
>
>And the table is not created.
>
> 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/d/optout.



-- 
Yoel Benítez Fonseca
http://redevil.cubava.cu/
$ python -c "import 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.


Re: [web2py] How to limit the size of uploads?

2017-01-28 Thread Yoel Benitez Fonseca
to be a little more precise validate it on both sides

2017-01-28 8:51 GMT-05:00 Yoel Benitez Fonseca <ybenit...@gmail.com>:
> think u can makeup it with js on client side. I mean, use custom form
> and validated the upload size on client side:
>
> http://stackoverflow.com/questions/1601455/how-to-check-file-input-size-with-jquery
>
> hope this help u out.
>
> 2017-01-22 18:22 GMT-05:00  <tomc...@gmail.com>:
>> Does anyone know how to limit the size of an upload without accepting
>> the entire upload and then measuring its' size? I'm transferring data
>> in the body of an http request. However I want to place a limit on its' size
>> so that the server can't be attacked by someone maliciously sending
>> huge files to the server.
>>
>> Is there a way to do this in Web2Py? Or is this something that should
>> be done in the configuration of the web server (in this case I'm just
>> using the out-of-the-box Rocket server).
>>
>> I believe someone asked this question before, about 5 years ago,
>> but I couldn't find any answer to 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.
>
>
>
> --
> Yoel Benítez Fonseca
> http://redevil.cubava.cu/
> $ python -c "import this"



-- 
Yoel Benítez Fonseca
http://redevil.cubava.cu/
$ python -c "import 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.


Re: [web2py] How to limit the size of uploads?

2017-01-28 Thread Yoel Benitez Fonseca
think u can makeup it with js on client side. I mean, use custom form
and validated the upload size on client side:

http://stackoverflow.com/questions/1601455/how-to-check-file-input-size-with-jquery

hope this help u out.

2017-01-22 18:22 GMT-05:00  :
> Does anyone know how to limit the size of an upload without accepting
> the entire upload and then measuring its' size? I'm transferring data
> in the body of an http request. However I want to place a limit on its' size
> so that the server can't be attacked by someone maliciously sending
> huge files to the server.
>
> Is there a way to do this in Web2Py? Or is this something that should
> be done in the configuration of the web server (in this case I'm just
> using the out-of-the-box Rocket server).
>
> I believe someone asked this question before, about 5 years ago,
> but I couldn't find any answer to 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.



-- 
Yoel Benítez Fonseca
http://redevil.cubava.cu/
$ python -c "import 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.


Re: [web2py] Upload Video

2016-12-16 Thread Yoel Benitez Fonseca
I don't see wy your upload field is not accepting video files.

El dic. 15, 2016 4:51 PM, "David"  escribió:

> What does RTFM mean?
>
> *db:*
>
>> db.define_table('post',
>>
>>Field('page_id','reference the_page'),
>>
>>Field('your_name', 'string'),
>>
>> Field('video','upload', requires=IS_NOT_EMPTY()),
>>
>> Field('body', 'string'),
>>
>>Field('created_on','datetime', default=request.now),
>>
>>Field('created_by', 'string'),
>>
>>Field('poster' , 'reference auth_user'))
>>
>> db.post.page_id.readable=db.post.page_id.writable=False
>
> db.post.created_by.readable=db.post.created_by.writable=False
>
> db.post.created_on.readable=db.post.created_on.writable=False
>
>
>
>>
>
> *controller : irrelevant code has been omitted *
>
>> @auth.requires_login()
>>
>> @auth.requires(db(db.auth_user.bank>=199).select())
>>
>> def show():
>>
>> db.post.your_name.readable=db.post.your_name.writable=False
>>
>> this_page = db.the_page(request.args(0,cast=int)) or
>>> redirect(URL('index'))
>>
>> db.post.page_id.default = this_page.id
>>
>> pagecomments = db(db.post.page_id==this_page.id).select()
>>
>> form = SQLFORM(db.post).process()
>>
>> if form.accepted:
>>
>> db.auth_user.update_or_insert(db.auth_user.id == auth.user.id,
>>
>>bank=0)
>>
>> response.flash= T("Form Accepted.")
>>
>> elif form.errors:
>>
>> response.flash= T("Error. Please try again")
>>
>> return dict(page=this_page, comments=pagecomments, form=form)
>>
>>
>>>
> *view: irrelevant code has been omitted*
>
>> 
>>
>> Comments
>>
>> 
>>
>> {{for post in comments:}}
>>
>> 
>>
>> {{=post.poster}}: {{=post.body}}
>>
>> {{=post.video}}
>>
>> {{pass}}
>>
>> 
>>
>> 
>>
>> Comment
>>
>> {{=form}}
>>
>> 
>>
>> 
>>
>> 
>>
>> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [web2py] Upload Video

2016-12-15 Thread Yoel Benitez Fonseca
Yes u can.

And not, "The normal "upload" type in db only lets me choose an image"
don't do that - RTFM:

http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#More-on-uploads

You are probably including some code from examples and using a image
validator for the upload field.. and pls post your code or else no
body will help.



2016-12-14 20:27 GMT-05:00 David :
> How can I upload a video and display it in a view from the db?
>
>
> The normal "upload" type in db only lets me choose an image
>
> I have tried these links:
>
> http://www.reddit.com/r/Python/comments/1r7v23/audio_streaming_app_in_web2py_from_scratch/
> https://groups.google.com/forum/#!topic/web2py/B1l_RfCYpXA
> https://groups.google.com/forum/#!searchin/web2py/upload$20video$20%7Csort:relevance/web2py/nV64Vbjc-48/63f7wN5QnEsJ
>
> --
> 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.



-- 
Yoel Benítez Fonseca
http://redevil.cubava.cu/
$ python -c "import 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.


Re: [web2py] Re: Forcing the translation of a text

2016-12-12 Thread Yoel Benitez Fonseca
It was my fault, all the time. I forgot that theres is some code in my
model with create the new record before the segment i have share in
this thread.

Sorry for the time.

2016-12-12 9:43 GMT-05:00 Yoel Benitez Fonseca <ybenit...@gmail.com>:
> This not worked for me, the idea was to insert a folder record with
> the name in the user language, hence translating "My Dashboard" to
> anything if we got a translation string for that language.
>
> Apart from that part, all the texts are being  translated without any
> problem, u
>
>
>
> 2016-12-12 9:09 GMT-05:00 Yoel Benítez Fonseca <ybenit...@gmail.com>:
>> On Sun, 11 Dec 2016 15:32:41 -0800 (PST)
>> Marlysson Silva <marlyss...@gmail.com> wrote:
>>
>>> You can overrride programatically the language getting accepted
>>> language header from client using :
>>>
>>> language = response.headers['Accept-Language'].lower()
>>>
>>> T.force(language)
>>
>> I think got what is wrong, the controller in particular with execute my
>> code was on a ajax request, i have tested on a normal request and it do
>> what is suppose to do.
>>
>> Thanks folks, i'll test setting is programatically.
>>
>>>
>>> Em sábado, 10 de dezembro de 2016 11:18:46 UTC-3, Yoel Benitez
>>> Fonseca escreveu:
>>> >
>>> > Hi, folks, this is in my controller:
>>> >
>>> >
>>> > if not dash_list:
>>> > # create a new dashboard
>>> > d_id = db.dashboard.insert(
>>> > name=T('My Dashboard', lazy=False), item_list=[])
>>> > query = (db.dashboard.id > 0)
>>> > query &= (db.dashboard.created_by == auth.user.id)
>>> > dash_list = db(query).select(db.dashboard.ALL)
>>> > auth.add_permission(0, 'owner', db.dashboard, d_id)
>>> >
>>> > The logic is simple, if there is not a dashboard create one called
>>> > "My dashboard". The problem comes from not English users, they get
>>> > the same name.
>>> >
>>> > I have verified the languages files, and the accepted language
>>> > header, all is fine, in the shell it work's correctly - prior
>>> > setting the language oc.
>>> >
>>> > Some idea ?
>>> >
>>>
>>
>
>
>
> --
> Yoel Benítez Fonseca
> http://redevil.cubava.cu/
> $ python -c "import this"



-- 
Yoel Benítez Fonseca
http://redevil.cubava.cu/
$ python -c "import 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.


Re: [web2py] Re: Forcing the translation of a text

2016-12-12 Thread Yoel Benitez Fonseca
This not worked for me, the idea was to insert a folder record with
the name in the user language, hence translating "My Dashboard" to
anything if we got a translation string for that language.

Apart from that part, all the texts are being  translated without any
problem, u



2016-12-12 9:09 GMT-05:00 Yoel Benítez Fonseca <ybenit...@gmail.com>:
> On Sun, 11 Dec 2016 15:32:41 -0800 (PST)
> Marlysson Silva <marlyss...@gmail.com> wrote:
>
>> You can overrride programatically the language getting accepted
>> language header from client using :
>>
>> language = response.headers['Accept-Language'].lower()
>>
>> T.force(language)
>
> I think got what is wrong, the controller in particular with execute my
> code was on a ajax request, i have tested on a normal request and it do
> what is suppose to do.
>
> Thanks folks, i'll test setting is programatically.
>
>>
>> Em sábado, 10 de dezembro de 2016 11:18:46 UTC-3, Yoel Benitez
>> Fonseca escreveu:
>> >
>> > Hi, folks, this is in my controller:
>> >
>> >
>> > if not dash_list:
>> > # create a new dashboard
>> > d_id = db.dashboard.insert(
>> > name=T('My Dashboard', lazy=False), item_list=[])
>> > query = (db.dashboard.id > 0)
>> > query &= (db.dashboard.created_by == auth.user.id)
>> > dash_list = db(query).select(db.dashboard.ALL)
>> > auth.add_permission(0, 'owner', db.dashboard, d_id)
>> >
>> > The logic is simple, if there is not a dashboard create one called
>> > "My dashboard". The problem comes from not English users, they get
>> > the same name.
>> >
>> > I have verified the languages files, and the accepted language
>> > header, all is fine, in the shell it work's correctly - prior
>> > setting the language oc.
>> >
>> > Some idea ?
>> >
>>
>



-- 
Yoel Benítez Fonseca
http://redevil.cubava.cu/
$ python -c "import 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.


Re: [web2py] This is not working as expected. Please correct this.

2016-11-28 Thread Yoel Benitez Fonseca
Instead of:

form3 = SQLFORM.factory(Field('ddate','date', label='Enter a date')).process()
if form3.accepted:
k=form3.vars.ddate.day()
redirect(URL('readings', 'check', args=[k,k,k]))

Do:

form3 = SQLFORM.factory(Field('ddate','date', label='Enter a date')).process()
if form3.accepted:
print form3.vars.ddate
k=form3.vars.ddate.day()
print k
redirect(URL('readings', 'check', args=[k,k,k]))


And see what is shown in your shell

2016-11-28 12:24 GMT-05:00 Mike Stephenson <raghib@iiits.in>:
> I am not getting the day of the month
>
> On Monday, November 28, 2016 at 10:47:13 PM UTC+5:30, Yoel Benitez Fonseca
> wrote:
>>
>> and what value are u getting on 'k', the day of month i suppose !?
>>
>> 2016-11-28 9:56 GMT-05:00 Mike Stephenson <raghi...@iiits.in>:
>> > form3 = SQLFORM.factory(Field('ddate','date', label='Enter a
>> > date')).process()
>> > if form3.accepted:
>> > k=form3.vars.ddate.day()
>> > redirect(URL('readings', 'check', args=[k,k,k]))
>> >
>> > K doesn't read value as expected.
>> >
>> > --
>> > 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.
>>
>>
>>
>> --
>> Yoel Benítez Fonseca
>> http://redevil.cubava.cu/
>> $ python -c "import 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.



-- 
Yoel Benítez Fonseca
http://redevil.cubava.cu/
$ python -c "import 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.


Re: [web2py] This is not working as expected. Please correct this.

2016-11-28 Thread Yoel Benitez Fonseca
and what value are u getting on 'k', the day of month i suppose !?

2016-11-28 9:56 GMT-05:00 Mike Stephenson :
> form3 = SQLFORM.factory(Field('ddate','date', label='Enter a
> date')).process()
> if form3.accepted:
> k=form3.vars.ddate.day()
> redirect(URL('readings', 'check', args=[k,k,k]))
>
> K doesn't read value as expected.
>
> --
> 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.



-- 
Yoel Benítez Fonseca
http://redevil.cubava.cu/
$ python -c "import 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.


Re: [web2py] Re: vue.js

2016-10-12 Thread Yoel Benitez Fonseca
i miss the time of only server-side  :-(

2016-10-12 13:21 GMT-04:00 Anthony :
>>
>> In react you simple do:
>>
>> 
>
>
> You don't simply do that in React. The above assumes you have created a
> React component that takes "url" and "pollinterval" props and then after
> being mounted starts making periodic Ajax requests and updates the state
> after each fetch. Of course, you can do the same thing in Vue -- just make a
> component that takes those same two props and set up the Ajax polling inside
> the "mounted" lifecycle hook (and update a "comments" data property on each
> fetch, which will trigger a re-render). It might look something like:
>
> 
>
> Anthony
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 
Yoel Benítez Fonseca
http://redevil.cubava.cu/
$ python -c "import 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.


Re: [web2py] Re: vue.js

2016-10-12 Thread Yoel Benitez Fonseca
i don't  get it... i have been reading vue.js docs and a lot of
examples and don't see the way of it... suppose, for example, i want
to use the comment plugin example with vue, so that i can LOAD the
plugin into the web2py getting a form for post comment's and a list of
comment... how to keep loading new comment from the database without
reloading the page ?

In react you simple do:



what is the way in Vue, i don't want use react.


2016-10-12 3:26 GMT-04:00 icodk :
> I tried the scaffolding example. it is missing the appconfig.ini (used my
> own) and nothing (visibly) happen when entering good as the place holder
> suggests.
> Is it working as expected?
>
>
>
> On Sunday, September 25, 2016 at 5:25:51 AM UTC+2, Massimo Di Pierro wrote:
>>
>> I am becoming a huge fan of vue.js. Any other user here?
>
> --
> 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.



-- 
Yoel Benítez Fonseca
http://redevil.cubava.cu/
$ python -c "import 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.


Re: [web2py] vue.js

2016-10-11 Thread Yoel Benitez Fonseca
thanks that give some ideas

2016-10-11 11:29 GMT-04:00 Anthony :
> On Tuesday, October 11, 2016 at 10:59:11 AM UTC-4, Marlysson Silva wrote:
>>
>> Until now , https://github.com/web2py/scaffold
>
>
> In particular, check out
> https://github.com/web2py/scaffold/blob/master/views/default/main.html and
> https://github.com/web2py/scaffold/blob/master/static/js/main-vue.js.
>
> Anthony
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 
Yoel Benítez Fonseca
http://redevil.cubava.cu/
$ python -c "import 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.


Re: [web2py] vue.js

2016-10-11 Thread Yoel Benitez Fonseca
any example out there with vue.js and web2py ?

2016-09-24 23:25 GMT-04:00 Massimo Di Pierro :
> I am becoming a huge fan of vue.js. Any other user here?
>
> --
> 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.



-- 
Yoel Benítez Fonseca
http://redevil.cubava.cu/
$ python -c "import 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.


Re: [web2py] Re: field in list test

2016-09-20 Thread Yoel Benitez Fonseca
Thanks Anthony ... I'm sorry say but can not remember for what i
needed that code snippet  thanks  any way.. is good to know that
stuff.

2016-09-16 17:02 GMT-04:00 Anthony <abasta...@gmail.com>:
> This is a quirk of Field objects. Field inherits from Expression, and the
> __eq__ method of Expression returns a Query object (rather than testing for
> equality and returning a boolean). So, if you do something like myfield ==
> some_object, you do not actually get a test of whether myfield is equivalent
> to some_object. Instead, you just get a Query object, which apparently
> evaluates to True in the code Python uses to check for the existence of an
> element in a list. It works this way so you can create DAL queries using the
> db.mytable.myfield == some_value syntax.
>
> If you want to check for a field in a list, consider instead storing the
> field names:
>
> f = db.item.id
> fields = [f.name]
> f.name in fields
>
> Or using your current code, you can do:
>
> any(field is f for field in fields)
>
> Above, field == f would result in the same problem, but field is f avoids
> the creation of the Query object.
>
> Anthony
>
>
> On Friday, September 16, 2016 at 12:41:28 PM UTC-4, Yoel Benitez Fonseca
> wrote:
>>
>> Does this make sense to you?
>>
>> In [1]: fields = list()
>>
>> In [2]: f = db.item.id
>>
>> In [3]: f in fields
>> Out[3]: False
>>
>> In [4]: fields.append(f)
>>
>> In [5]: f in fields
>> Out[5]: True
>>
>> In [6]: f = db.item.headline
>>
>> In [7]: f in fields
>> Out[7]: True
>>
>> I mean, the last value of 'f' is a fields object but a different one.
>>
>> --
>> Yoel Benítez Fonseca
>> http://redevil.cubava.cu/
>> $ python -c "import 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.



-- 
Yoel Benítez Fonseca
http://redevil.cubava.cu/
$ python -c "import 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.


Re: [web2py] Re: Alternative IDEs?

2016-09-20 Thread Yoel Benitez Fonseca
Atom +1

El sep 19, 2016 9:56 AM, "Philip Kilner"  escribió:

> Hi,
>
> On 19/09/16 12:36, Jurgis Pralgauskis wrote:
>
>> What are people mostly using for W2P dev?
>>
>
> I'm currently using Atom and Cloud 9.
>
> To be honest, I'm getting on better with Cloud 9, but need to the paid
> version for my use case. It looks as though I will go for that and go 100%
> Chromebook soon.
>
> I'd be curious to know if anyone else in the web2py community is going
> this route? (All Chromebook I mean, rather Cloud 9 specifically)
>
>
> --
>
> Regards,
>
> PhilK
>
>
> 'a bell is a cup...until it is struck'
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> --- You received this message because you are subscribed to the Google
> Groups "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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


[web2py] field in list test

2016-09-16 Thread Yoel Benitez Fonseca
Does this make sense to you?

In [1]: fields = list()

In [2]: f = db.item.id

In [3]: f in fields
Out[3]: False

In [4]: fields.append(f)

In [5]: f in fields
Out[5]: True

In [6]: f = db.item.headline

In [7]: f in fields
Out[7]: True

I mean, the last value of 'f' is a fields object but a different one.

-- 
Yoel Benítez Fonseca
http://redevil.cubava.cu/
$ python -c "import 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.


Re: [web2py] Cannot Create Table Named "Items" - Already Exists

2016-09-01 Thread Yoel Benitez Fonseca
i don't know of "items" but "item" is not a keyword for Python or
Web2py ... i'm using it right now in one of my projects:

db.define_table('item',
# item metadata
Field('provider', 'string', length=100, default=''),
Field('provider_service', 'string'),
Field('pubstatus', 'string', length=10, default='usable'),
Field('embargoed', 'datetime', default=None),



2016-09-01 17:11 GMT-04:00 Niphlod :
> items isn't a roblem for check_reserved.
>
> On Thursday, September 1, 2016 at 10:14:47 PM UTC+2, Richard wrote:
>>
>>
>> http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer?search=reserved+word#Reserved-keywords
>>
>> Do you have it in your connection string?
>>
>> You should be notified that it a mysql reserved word...
>>
>> If not... Have you change database? New empty database sound like you
>> restart database from scratch... web2py keep track of migration of models
>> you have to migrate=false fake_migrate=true then back to migrate=true to
>> allow web2py to sync with the database...
>>
>>
>> http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer?search=fake_migrate#migrate--fake_migrate
>>
>> Richard
>>
>> On Thu, Sep 1, 2016 at 3:52 PM, Brian Boatright  wrote:
>>>
>>> Is "items" a keyword for Python or Web2py? I'm using mysql and having
>>> web2py models file define a new table named "items" but it gives me an error
>>> that says the table already exists.
>>>
>>> If I change the name of the table to something like "items2" in the
>>> models.py file it works.
>>>
>>> The mysql database is empty of tables before this is run and I've
>>> confirmed there is no items table before it tries to run the models.py file.
>>> I can create a table manually named items so it isn't specific to MySQL
>>> database.
>>>
>>> Thanks for 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+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.



-- 
Yoel Benítez Fonseca
http://redevil.cubava.cu/
$ python -c "import 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: custom update form multiple tables and list:string

2016-08-30 Thread Yoel Benitez Fonseca
Solved in some extend:

The problem is that each widget is initialized with the record values on 
the SQLFORM constructor if any, in the case you need to pre-populate the 
form 
(http://web2py.com/books/default/chapter/29/07/forms-and-validators#Pre-populating-the-form)
 
it work flawless for all the other fields except for 'list:string', in my 
case the 'keywords' field.

I'm getting around the problem using defaults, in the controller:

def edit():
item = db.item(request.args(0))
concrete_item = db.concrete_item(item_id=item.id)
fields = []
# before adding the the fields
db.item.keywords.default = item.keywords
# ---
for f in item:
fields.append(f)
for f in concrete_item:
fields.append(f)

form = SQLFORM.factory(*fields)
# put values to form fields
for f in db.item:
   form.vas[f.name] = item[f.name]
for f in db.concrete_item:
   form.vas[f.name] = concrete_item[f.name]
   
if form.proccess().accepted:
# here call update_record, etc.
pass

return dict(form=form)




El lunes, 29 de agosto de 2016, 14:24:19 (UTC-4), Yoel Benitez Fonseca 
escribió:
>
> h!
>
> i got 2 tables, i need to make one update form for both, let's say they 
> are:
>
> -
> db.define_table("item",
> ...
> Field('keywords', 'list:string', ...)
> ...
> )
> db.define_table('concrete_item',
> Field('item_id', 'reference item'),
> ...
> )
>
>
> -
> In the controller:
> -
> def edit():
> item = db.item(request.args(0))
> concrete_item = db.concrete_item(item_id=item.id)
> fields = []
> for f in item:
> fields.append(f)
> for f in concrete_item:
> fields.append(f)
>
> form = SQLFORM.factory(*fields)
> # put values to form fields
> for f in db.item:
>form.vas[f.name] = item[f.name]
> for f in db.concrete_item:
>form.vas[f.name] = concrete_item[f.name]
>
> if form.proccess().accepted:
> # here call update_record, etc.
> pass
>
> return dict(form=form)
>
>
> -
>
> The problem is with the keywords field, when the form is rendered in the 
> view it don't show the current value for the field. Meanwhile if i just 
> make the update form for only one table:
>
> 
> def edit()
> item = db.item(request.args(0))
>
> form = SQLFORM.factory(db.item, record=item)
> return dict(form=form)
>
>
> 
>
> The keywords field show the current values. Can any1 help me with this ?
>
> -- 
> Yoel Benítez Fonseca
> http://redevil.cubava.cu/
> $ python -c "import 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.


Re: [web2py] Best way to pre-populate a database on start-up

2016-08-30 Thread Yoel Benitez Fonseca
You can use a .CSV file. What i have used to do is:

1.- Define the tables that are being pre-populate.
2.- Insert all the data with appadmin.
3.- Using the appadmin export the data to a .CSV (db_colors.csv) file
and put it in the private folder of your app.
4.- Do the same thing you are doing except for:

db.color.import_from_csv_file(
   open(os.path.join(request.folder, os.path.join('private',
'db_colors.csv')), 'r')
)

5.- done.



2016-08-30 9:34 GMT-04:00 Ben Lawrence :
> At the moment to pre-populate a database, I place this in the db.py model
> file:
>
> db.define_table('color',
> Field('name','string'),
> Field('code','string'),
> format='%(name)s')
> if db(db.color).isempty():
> # create instance of table
> for k,v in
> dict(lime="#00FF00",red="#FF",black="#00",orange="#FFA500",\
> blue="#FF", yellow="#00", fuchsia="#FF00FF",
> aqua="#00",\
> maroon="#80", green="#008000", navy="#80", olive="#808000",\
> purple="#800080", teal="#008080", gray="#808080",
> silver="#C0C0C0").items():
> db.color.insert(name=k,code=v)
>
>
>
> I wonder if this is the best way to pre-populate a database?
>
> thanks,
> Ben
>
> --
> 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.



-- 
Yoel Benítez Fonseca
http://redevil.cubava.cu/
$ python -c "import 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] custom update form multiple tables and list:string

2016-08-29 Thread Yoel Benitez Fonseca
h!

i got 2 tables, i need to make one update form for both, let's say they are:

-
db.define_table("item",
...
Field('keywords', 'list:string', ...)
...
)
db.define_table('concrete_item',
Field('item_id', 'reference item'),
...
)
-
In the controller:
-
def edit():
item = db.item(request.args(0))
concrete_item = db.concrete_item(item_id=item.id)
fields = []
for f in item:
fields.append(f)
for f in concrete_item:
fields.append(f)

form = SQLFORM.factory(*fields)
# put values to form fields
for f in db.item:
   form.vas[f.name] = item[f.name]
for f in db.concrete_item:
   form.vas[f.name] = item[f.name]

if form.proccess().accepted:
# here call update_record, etc.
pass

return dict(form=form)
-

The problem is with the keywords field, when the form is rendered in the
view it don't show the current value for the field. Meanwhile if i just
make the update form for only one table:


def edit()
item = db.item(request.args(0))

form = SQLFORM.factory(db.item, record=item)
return dict(form=form)


The keywords field show the current values. Can any1 help me with this ?

-- 
Yoel Benítez Fonseca
http://redevil.cubava.cu/
$ python -c "import 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.


Re: [web2py] Re: sidebar

2016-03-28 Thread Yoel Benitez Fonseca
I'm using a structure similar to `response.menu` to generate my
sidebar, in that way you can have general items inserted in your
sidebar and customize it later.

2016-03-27 19:11 GMT-04:00, 黄祥 :
> pls try in your view :
> {{right_sidebar_enabled = True}}
>
> {{block right_sidebar}}
> {{include 'default/right_sidebar.html'}}
> {{end}}
>
> {{extend 'layout.html'}}
>
> 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.
>


-- 
Yoel Benítez Fonseca
http://redevil.cubava.cu/
$ python -c "import 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.


Re: [web2py] Re: python Script

2016-02-11 Thread Yoel Benitez Fonseca
also [1]:

...
python web2py.py -S app -M -R applications/app/private/myscript.py -A a b c

where -S app tells web2py to run "myscript.py" as "app", -M tells
web2py to execute models, and -A a b c passes optional command line
arguments sys.argv=['applications/app/private/myscript.py','a','b','c']
to "myscript.py".
...

I have used this method for complex data migrations.

[1] 
http://web2py.com/books/default/chapter/29/04/the-core#Running-tasks-in-the-background

2016-02-10 18:42 GMT-05:00, Dave S :
> On Wednesday, February 10, 2016 at 2:01:52 PM UTC-8, snehalash...@gmail.com
>
> wrote:
>>
>> can we write the python script inweb2py
>>
>
> There are 2 answers to this.  Web2Py depends on a Python installation.  (In
>
> Windows, it's own copy is packaged with Web2py).  You can run ordinary
> Python scripts in that Python enviornment.  But also, Web2Py provides an
> "application-aware" shell enviornment  for running scripts, which can also
> run ordinary Python scripts or it can be used to run scripts that know
> about your application's models and modules.
>
> For a more complete description of this, Chapters 1 and 3 of the book are
> good places to start; Chapter 2 provides a quick introduction to Python.
> 
>
> /dps
>
>
> --
> 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.
>


-- 
Yoel Benítez Fonseca
http://redevil.cubava.cu/
$ python -c "import 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.


Re: [web2py] overwrite installed app

2016-01-28 Thread Yoel Benitez Fonseca
I think that the overwriting feature is fine just as it's right now... I
have one application on production server and I can update it merging the
update with the old version without troubling my self with backups for
upload files, for example.

In my models definition modules - with is the way i prefer - i ask if db
has or not the table, for example:

if not hasattr (db, 'person'):
db. define_table ('person', ... )
On Jan 28, 2016 12:51 PM, "Annet"  wrote:

I just uploaded and installed a packed application overwriting an
installed app. The problem is that this procedure does not
remove the files form the old app that are not in the new app.

I had a model file named 76_resume.py which I renamed 78_resume.py
this resulted in an error ticket about already existing tables.

Why doesn't web2py remove the files that are no longer there when
I overwrite an app?


Kind regards,

Annet

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

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


Re: [web2py] how to get old version

2016-01-05 Thread Yoel Benitez Fonseca
¿clone recursive? ummm.. and what happen if i want on old version for
windows ? there is not an FTP or so out there with the old versions !?

2016-01-05 10:40 GMT-05:00, Richard Vézina <ml.richard.vez...@gmail.com>:
> clone recursive... it explained... depend if you need previous pyDAL
> version or not, you shouldn't need clone recursive for previous pyDAL
> version...
>
> Richard
>
> On Tue, Jan 5, 2016 at 9:38 AM, Yoel Benitez Fonseca <ybenit...@gmail.com>
> wrote:
>
>> but on github u don't get the submodules
>>
>> 2016-01-04 11:29 GMT-05:00, Richard Vézina <ml.richard.vez...@gmail.com>:
>> > Github!
>> >
>> > Richard
>> >
>> > On Mon, Jan 4, 2016 at 11:23 AM, Yoel Benitez Fonseca <
>> ybenit...@gmail.com>
>> > wrote:
>> >
>> >> h!, how can i get the old versions of web2py, on
>> >> http://web2py.com/init/default/download u can only get the latest but
>> >> i want one concrete version.
>> >>
>> >> --
>> >> Yoel Benítez Fonseca
>> >> http://redevil.cubava.cu/
>> >> $ python -c "import 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.
>> >>
>> >
>> > --
>> > 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.
>> >
>>
>>
>> --
>> Yoel Benítez Fonseca
>> http://redevil.cubava.cu/
>> $ python -c "import 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.
>>
>
> --
> 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.
>


-- 
Yoel Benítez Fonseca
http://redevil.cubava.cu/
$ python -c "import 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.


Re: [web2py] Re: how to get old version

2016-01-05 Thread Yoel Benitez Fonseca
thanks anthony

2016-01-05 12:36 GMT-05:00, Anthony <abasta...@gmail.com>:
> Not sure how far back they go, but you can go to:
>
> http://www.web2py.com/examples/static/x.x.x/web2py_[platform].zip
>
> where x.x.x is the version and [platform] is "win", "osx", or "src".
>
> Anthony
>
> On Monday, January 4, 2016 at 11:24:02 AM UTC-5, Yoel Benitez Fonseca
> wrote:
>>
>> h!, how can i get the old versions of web2py, on
>> http://web2py.com/init/default/download u can only get the latest but
>> i want one concrete version.
>>
>> --
>> Yoel Benítez Fonseca
>> http://redevil.cubava.cu/
>> $ python -c "import 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.
>


-- 
Yoel Benítez Fonseca
http://redevil.cubava.cu/
$ python -c "import 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.


Re: [web2py] how to get old version

2016-01-05 Thread Yoel Benitez Fonseca
but on github u don't get the submodules

2016-01-04 11:29 GMT-05:00, Richard Vézina <ml.richard.vez...@gmail.com>:
> Github!
>
> Richard
>
> On Mon, Jan 4, 2016 at 11:23 AM, Yoel Benitez Fonseca <ybenit...@gmail.com>
> wrote:
>
>> h!, how can i get the old versions of web2py, on
>> http://web2py.com/init/default/download u can only get the latest but
>> i want one concrete version.
>>
>> --
>> Yoel Benítez Fonseca
>> http://redevil.cubava.cu/
>> $ python -c "import 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.
>>
>
> --
> 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.
>


-- 
Yoel Benítez Fonseca
http://redevil.cubava.cu/
$ python -c "import 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] how to get old version

2016-01-04 Thread Yoel Benitez Fonseca
h!, how can i get the old versions of web2py, on
http://web2py.com/init/default/download u can only get the latest but
i want one concrete version.

-- 
Yoel Benítez Fonseca
http://redevil.cubava.cu/
$ python -c "import 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.


Re: [web2py] Re: web2py 2.13.1 is OUT

2015-12-19 Thread Yoel Benitez Fonseca
sorry, in the console it works, its seems to be my problem

2015-12-19 17:27 GMT-05:00, Yoel Benitez Fonseca <ybenit...@gmail.com>:
> i have upgrade to this version and the are some issues, for example
> IS_UPPER validator stopped working...
>
> 2015-12-19 12:48 GMT-05:00, Raul Monares <r...@tarkus.mx>:
>> Excellent !!
>>
>> On Thursday, December 17, 2015 at 11:31:38 PM UTC-7, Massimo Di Pierro
>> wrote:
>>>
>>> CHANGELOG
>>>
>>> ## 2.13.1
>>>
>>>
>>> - fixed oauth2 renew token, thanks dokime7
>>>
>>> - fixed add_membership, del_membership, add_membership IntegrityError
>>> (when auth.enable_record_versioning)
>>>
>>> - allow passing unicode to template render
>>>
>>> - allow IS_NOT_IN_DB to work with custom primarykey, thanks timmyborg
>>>
>>> - allow HttpOnly cookies
>>>
>>> - added fabfile.py
>>>
>>> - french pluralizaiton rules, thanks Mathieu Clabaut
>>>
>>> - fixed bug in redirect to cas service, thanks Fernando González
>>>
>>> - allow deploying to pythonanywhere from the web2py admin that you're
>>> running locally, thanks Leonel
>>>
>>> - better tests
>>>
>>> - many more bug fixes
>>>
>>
>> --
>> 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.
>>
>
>
> --
> Yoel Benítez Fonseca
> http://redevil.cubava.cu/
> $ python -c "import this"
>


-- 
Yoel Benítez Fonseca
http://redevil.cubava.cu/
$ python -c "import 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.


Re: [web2py] Re: web2py 2.13.1 is OUT

2015-12-19 Thread Yoel Benitez Fonseca
i have upgrade to this version and the are some issues, for example
IS_UPPER validator stopped working...

2015-12-19 12:48 GMT-05:00, Raul Monares :
> Excellent !!
>
> On Thursday, December 17, 2015 at 11:31:38 PM UTC-7, Massimo Di Pierro
> wrote:
>>
>> CHANGELOG
>>
>> ## 2.13.1
>>
>>
>> - fixed oauth2 renew token, thanks dokime7
>>
>> - fixed add_membership, del_membership, add_membership IntegrityError
>> (when auth.enable_record_versioning)
>>
>> - allow passing unicode to template render
>>
>> - allow IS_NOT_IN_DB to work with custom primarykey, thanks timmyborg
>>
>> - allow HttpOnly cookies
>>
>> - added fabfile.py
>>
>> - french pluralizaiton rules, thanks Mathieu Clabaut
>>
>> - fixed bug in redirect to cas service, thanks Fernando González
>>
>> - allow deploying to pythonanywhere from the web2py admin that you're
>> running locally, thanks Leonel
>>
>> - better tests
>>
>> - many more bug fixes
>>
>
> --
> 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.
>


-- 
Yoel Benítez Fonseca
http://redevil.cubava.cu/
$ python -c "import 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] getting db from a row

2015-12-15 Thread Yoel Benitez Fonseca
hi ! suppose i get a row form a query in a function, is there any way
of extract the database connection used to get the row form it ?
row._db ? row.db ?

-- 
Yoel Benítez Fonseca
http://redevil.cubava.cu/
$ python -c "import 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.


Re: [web2py] Write in database from modules

2015-12-04 Thread Yoel Benitez Fonseca
In module1.py:

def myfunction(var1=2):
db = current.db
db.table1.insert(F1=var1)
db.commit() # if this call is not a part of a HTTP request
return



2015-12-04 9:39 GMT-05:00, Aydin S :
> This might be asked before and I already found a similar question in here:
> https://groups.google.com/forum/#!topic/web2py/0k0Fvw6fmb8
> but this seemed a bit confusing. How to write on database from within a
> module?
> I have a table defined in db.py (model) as follows:
> db.define_table('Table1',
> Field('F1', 'integer'))
>
> Now I have a variable var1 in the module module1.py that I want to write it
>
> into F1.
>
> var1=2
>
> Is this similar approach to read a variable from database in a module?
>
>
>
> --
> 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.
>


-- 
Yoel Benítez Fonseca
http://redevil.cubava.cu/
$ python -c "import 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.


Re: [web2py] Personalize order reading Model File

2015-12-04 Thread Yoel Benitez Fonseca
What i do is put model definition on modules - not models - for
example i have a module for person (person.py) and a module for state
(state.py) each have a define_table function. Then in my models some
where i can import then in pretended order:

import person
import state

person.define_table()
state.define_table()

U can make it to import only the needed models but that's other topic.

2015-12-04 10:29 GMT-05:00, Alessio Varalta
:
> I have a model with multiple files, my problem is that I have this file
>
> 1-model_layer_ruolo
> 2_model_layer_scheda
> 3_model_esercizio
>
> But web2py ignore the number and execute like first file 3_model_esercizio
> there is the possibility to define the order of reading?
>
> --
> 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.
>


-- 
Yoel Benítez Fonseca
http://redevil.cubava.cu/
$ python -c "import 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.


Re: [web2py] Re: Write in database from modules

2015-12-04 Thread Yoel Benitez Fonseca
Anthony, I see the advantage of passing db as a parameter to the code
on modules and not relaying to much on current, but what happen when u
can't control the parameters, for example i have a custom Exporter for
a grid in a module:

class MyExporter(ExportClass):
...

on a controller:

exports = dict(xml=False, html=False, csv_with_hidden_cols=False,
csv=False, tsv_with_hidden_cols=False, tsv=False,
json=False, EXT=(MyExporter, 'EXT'),
)
grid = SQLFORM.grid(db.Table1, csv=True, exportclasses=exports)

when configuring the grid i can only give the name of the class, and
it only get the rows on the grid, what if i want to include more data
from my database ? Is there a way around to get access to db other
than current ?



2015-12-04 11:12 GMT-05:00, Anthony :
> In your module, you could have something like:
>
> def insert_record(db):
> db.Table1.insert(F1=var2)
>
> And from a model or controller:
>
> from mymodule import insert_record
> insert_record(db)
>
> Anthony
>
>
> On Friday, December 4, 2015 at 9:39:35 AM UTC-5, Aydin S wrote:
>>
>> This might be asked before and I already found a similar question in here:
>>
>> https://groups.google.com/forum/#!topic/web2py/0k0Fvw6fmb8
>> but this seemed a bit confusing. How to write on database from within a
>> module?
>> I have a table defined in db.py (model) as follows:
>> db.define_table('Table1',
>> Field('F1', 'integer'))
>>
>> Now I have a variable var1 in the module module1.py that I want to write
>> it into F1.
>>
>> var1=2
>>
>> Is this similar approach to read a variable from database in a module?
>>
>>
>>
>>
>
> --
> 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.
>


-- 
Yoel Benítez Fonseca
http://redevil.cubava.cu/
$ python -c "import 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] fields and table definition on modules

2015-11-17 Thread Yoel Benitez Fonseca
h! all,

Suppose i have this code in a app module:

---
from gluon import *

m_fields = list()

fld_name = Field('name', 'string')
fld_categ = Field('categ_id', 'reference categories')

m_fields.append(fld_name)
m_fields.append(fld_categ)

def define_table():
if not hasattr(db, 'my_model'):
db.define_table('my_model', *m_fields)
db.commit()
---

the function define_table() of this module es called from db.py so
that the table get defined, but i'm getting on error:

 SELECT categories.name, categories.id
FROM categories WHERE (categories.id IS NOT NULL) ORDER BY
categories.name, categories.id;

My question is: having my fields define at module level have anything
to do with this error ?

-- 
Msc. Yoel Benítez Fonseca
Especialista en TI
http://redevil.cubava.cu/
Tel.: (53 32)284701

-- 
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: fields and table definition on modules

2015-11-17 Thread Yoel Benitez Fonseca
sorry Anthony, it is just an adaptation of my original code:

---
from gluon import *
import categ_model

m_fields = list()

fld_name = Field('name', 'string')
fld_categ = Field('categ_id', 'reference categories')

m_fields.append(fld_name)
m_fields.append(fld_categ)

def define_table():
db = current.db
categ_model.define_table()
if not hasattr(db, 'my_model'):
db.define_table('my_model', *m_fields)
db.commit()
---

'categ_model' is a module with the same scheme that this one, i have
tracked down the error and its seems to happen when the options widget
is constructed. It may be that my error has nothing to do with the
module declaration.

2015-11-17 11:54 GMT-05:00, Anthony :
>
>>
>> def define_table():
>> if not hasattr(db, 'my_model'):
>> db.define_table('my_model', *m_fields)
>> db.commit()
>>
>
> The above refers to "db", but that is not defined anywhere. Where does that
>
> come from? Note, you cannot define objects such as db at the top level of a
>
> module, because they will only be defined once in the thread where the
> module is first imported. Instead, you should pass the db object to the
> function when it is called, or possibly add db to the current object and
> import the current object in your module.
>
> Also, I don't think you should need the db.commit(), as you are not
> manipulating any data here.
>
> Anthony
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Msc. Yoel Benítez Fonseca
Especialista en TI
http://redevil.cubava.cu/
Tel.: (53 32)284701

-- 
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: fields and table definition on modules

2015-11-17 Thread Yoel Benitez Fonseca
Side question: in a module, like in this example, i don't need to call
commit() for the table to be created ?

2015-11-17 12:29 GMT-05:00, Yoel Benitez Fonseca <ybenit...@gmail.com>:
> sorry Anthony, it is just an adaptation of my original code:
>
> ---
> from gluon import *
> import categ_model
>
> m_fields = list()
>
> fld_name = Field('name', 'string')
> fld_categ = Field('categ_id', 'reference categories')
>
> m_fields.append(fld_name)
> m_fields.append(fld_categ)
>
> def define_table():
> db = current.db
> categ_model.define_table()
> if not hasattr(db, 'my_model'):
> db.define_table('my_model', *m_fields)
> db.commit()
> ---
>
> 'categ_model' is a module with the same scheme that this one, i have
> tracked down the error and its seems to happen when the options widget
> is constructed. It may be that my error has nothing to do with the
> module declaration.
>
> 2015-11-17 11:54 GMT-05:00, Anthony <abasta...@gmail.com>:
>>
>>>
>>> def define_table():
>>> if not hasattr(db, 'my_model'):
>>> db.define_table('my_model', *m_fields)
>>> db.commit()
>>>
>>
>> The above refers to "db", but that is not defined anywhere. Where does
>> that
>>
>> come from? Note, you cannot define objects such as db at the top level of
>> a
>>
>> module, because they will only be defined once in the thread where the
>> module is first imported. Instead, you should pass the db object to the
>> function when it is called, or possibly add db to the current object and
>> import the current object in your module.
>>
>> Also, I don't think you should need the db.commit(), as you are not
>> manipulating any data here.
>>
>> Anthony
>>
>> --
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to web2py+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> --
> Msc. Yoel Benítez Fonseca
> Especialista en TI
> http://redevil.cubava.cu/
> Tel.: (53 32)284701
>


-- 
Msc. Yoel Benítez Fonseca
Especialista en TI
http://redevil.cubava.cu/
Tel.: (53 32)284701

-- 
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: fields and table definition on modules

2015-11-17 Thread Yoel Benitez Fonseca
Thanks, both of u... aw i have solved my issue ... thanks

2015-11-17 14:43 GMT-05:00, Niphlod <niph...@gmail.com>:
> BTW for uber-technical: every backend EXCEPT postgresql commits
> automatically when asked to alter the structure of the db (being it table
> creation or whatever else) implicitely. Also, web2py's commits
> "explicitely" for every "structure modification".
>
> On Tuesday, November 17, 2015 at 8:35:02 PM UTC+1, Anthony wrote:
>>
>> On Tuesday, November 17, 2015 at 12:35:31 PM UTC-5, Yoel Benitez Fonseca
>> wrote:
>>>
>>> Side question: in a module, like in this example, i don't need to call
>>> commit() for the table to be created ?
>>>
>>
>> This may depend on the RDBMS, but I think in general you don't need to
>> commit a create table. In any case, you shouldn't need to do any commits
>> as
>> long as the operations are done during a web2py HTTP request, as all
>> requests are wrapped in a transaction and committed at the end of the
>> request. This applies to operations done in modules (as long as the code
>> is
>> called as part of an HTTP request). You need to explicitly call
>> db.commit()
>> only when operating outside of a request, such as in the shell or a
>> script.
>>
>> Anthony
>>
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Msc. Yoel Benítez Fonseca
Especialista en TI
http://redevil.cubava.cu/
Tel.: (53 32)284701

-- 
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] PyCharm license for web2py dev - who wants?

2015-10-16 Thread Yoel Benitez Fonseca
+1

2015-10-16 9:42 GMT-04:00, Richard Vézina :
> For the one that want to try PyCharm "Professional" there is the EAP
> (earlie access program), you can use the next version of PyCharm before the
> official release... Most of the time these build are pretty stable...
>
> Richard
>
> On Thu, Oct 15, 2015 at 6:31 PM, Jack Kuan  wrote:
>
>> +1 Would love to give it a try. 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.
>>
>
> --
> 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.
>


-- 
Msc. Yoel Benítez Fonseca
Especialista en TI
http://redevil.cubava.cu/
Tel.: (53 32)284701

-- 
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: Autocomplete widget don't respect other values in request.vars

2015-09-20 Thread Yoel Benitez Fonseca
As Anthony suggested in the workarounds:

--

city_widget = SQLFORM.widgets.autocomplete(request, db.city.name,
id_field=db.city.id)
city_widget.url = URL(args=request.args, vars=request.get_vars)
db.person.city.widget = city_widget
--

turn to another problem, this is the content of request.vars for the
callback from autocomplete:



It should be:



As you can see, autocomplete just add his parameters to the url
assuming there are no other.

2015-09-20 9:01 GMT-04:00, Yoel Benitez Fonseca <ybenit...@gmail.com>:
> Thank's Antony for the replay, i'll create the issue.
>
> The error in the code come from my adaptation of the real code to the
> example posted in my original question.
>
> The reason I ask is because I have already taken account of these
> three possible workarounds and i think we can do better.
>
> 2015-09-19 16:09 GMT-04:00, Anthony <abasta...@gmail.com>:
>> It won't always be desirable to preserve the original query string
>> because
>> the Ajax callback is not really requesting the original parent page but
>> instead merely using the original action to access the autocomplete
>> functionality. However, it would probably be a good idea to add an option
>> to the autocomplete widget allowing the query string to be preserved, so
>> you should submit a github issue about this (link back to this thread).
>>
>> For now, though, there are three possible workarounds:
>>
>>1. Because the URL args are preserved, you can put the step in a URL
>> arg
>>
>>instead of a "step" variable in the query string.
>>2. You can store the step in the session rather than in the URL (not
>>good for bookmarking).
>>3. You can manipulate the widget after it has been instantiated
>> (haven't
>>
>>tried it, but I think it should work):
>>
>> city_widget = SQLFORM.widgets.autocomplete(request, db.city.name,
>> id_field=db.city.id)
>> city_widget.url = URL(args=request.args, vars=request.get_vars)
>> db.person.city.widget = city_widget
>>
>> Also, note that there is an error in your code -- you are assigning the
>> widget to db.person.city rather than to db.person.city.widget.
>>
>> Anthony
>>
>> On Saturday, September 19, 2015 at 11:05:52 AM UTC-4, Yoel Benitez
>> Fonseca
>> wrote:
>>>
>>> hi! i have been struggling with a annoying bug, i got a this in a
>>> controller:
>>>
>>> ---
>>> def some_function():
>>> if not request.vars.step:
>>> redirect(URL('some_function', vars=dict(step=1)))
>>> # 
>>> # a lot of stuff in the middle
>>> # 
>>> if request.vars.step = '3':
>>> db.person.city = SQLFORM.widgets.autocomplete(request,
>>> db.city.name, id_field=db.city.id)
>>> form = SQLFORM.factory(db.person):
>>> if form.process().accepted:
>>> # do some stuff
>>> pass
>>> # more stuff...
>>> ---
>>>
>>> The problem is that the autocomplete callback overwrite anything in
>>> request.vars and only left his own parameter _autocomplete_city_name,
>>> is this the intended behavior ? i mean for me it have more sense that
>>> the autocomplete callback add what it need and leave the others things
>>> in place.
>>>
>>> --
>>> Msc. Yoel Benítez Fonseca
>>> Especialista en TI
>>> http://redevil.cubava.cu/
>>> Tel.: (53 32)284701
>>>
>>
>> --
>> 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.
>>
>
>
> --
> Msc. Yoel Benítez Fonseca
> Especialista en TI
> http://redevil.cubava.cu/
> Tel.: (53 32)284701
>


-- 
Msc. Yoel Benítez Fonseca
Especialista en TI
http://redevil.cubava.cu/
Tel.: (53 32)284701

-- 
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: Autocomplete widget don't respect other values in request.vars

2015-09-20 Thread Yoel Benitez Fonseca
Thank's Antony for the replay, i'll create the issue.

The error in the code come from my adaptation of the real code to the
example posted in my original question.

The reason I ask is because I have already taken account of these
three possible workarounds and i think we can do better.

2015-09-19 16:09 GMT-04:00, Anthony <abasta...@gmail.com>:
> It won't always be desirable to preserve the original query string because
> the Ajax callback is not really requesting the original parent page but
> instead merely using the original action to access the autocomplete
> functionality. However, it would probably be a good idea to add an option
> to the autocomplete widget allowing the query string to be preserved, so
> you should submit a github issue about this (link back to this thread).
>
> For now, though, there are three possible workarounds:
>
>1. Because the URL args are preserved, you can put the step in a URL arg
>
>instead of a "step" variable in the query string.
>2. You can store the step in the session rather than in the URL (not
>good for bookmarking).
>3. You can manipulate the widget after it has been instantiated (haven't
>
>tried it, but I think it should work):
>
> city_widget = SQLFORM.widgets.autocomplete(request, db.city.name,
> id_field=db.city.id)
> city_widget.url = URL(args=request.args, vars=request.get_vars)
> db.person.city.widget = city_widget
>
> Also, note that there is an error in your code -- you are assigning the
> widget to db.person.city rather than to db.person.city.widget.
>
> Anthony
>
> On Saturday, September 19, 2015 at 11:05:52 AM UTC-4, Yoel Benitez Fonseca
> wrote:
>>
>> hi! i have been struggling with a annoying bug, i got a this in a
>> controller:
>>
>> ---
>> def some_function():
>> if not request.vars.step:
>> redirect(URL('some_function', vars=dict(step=1)))
>> # 
>> # a lot of stuff in the middle
>> # 
>> if request.vars.step = '3':
>> db.person.city = SQLFORM.widgets.autocomplete(request,
>> db.city.name, id_field=db.city.id)
>> form = SQLFORM.factory(db.person):
>> if form.process().accepted:
>> # do some stuff
>> pass
>> # more stuff...
>> ---
>>
>> The problem is that the autocomplete callback overwrite anything in
>> request.vars and only left his own parameter _autocomplete_city_name,
>> is this the intended behavior ? i mean for me it have more sense that
>> the autocomplete callback add what it need and leave the others things
>> in place.
>>
>> --
>> Msc. Yoel Benítez Fonseca
>> Especialista en TI
>> http://redevil.cubava.cu/
>> Tel.: (53 32)284701
>>
>
> --
> 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.
>


-- 
Msc. Yoel Benítez Fonseca
Especialista en TI
http://redevil.cubava.cu/
Tel.: (53 32)284701

-- 
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] Autocomplete widget don't respect other values in request.vars

2015-09-19 Thread Yoel Benitez Fonseca
hi! i have been struggling with a annoying bug, i got a this in a controller:

---
def some_function():
if not request.vars.step:
redirect(URL('some_function', vars=dict(step=1)))
# 
# a lot of stuff in the middle
# 
if request.vars.step = '3':
db.person.city = SQLFORM.widgets.autocomplete(request,
db.city.name, id_field=db.city.id)
form = SQLFORM.factory(db.person):
if form.process().accepted:
# do some stuff
pass
# more stuff...
---

The problem is that the autocomplete callback overwrite anything in
request.vars and only left his own parameter _autocomplete_city_name,
is this the intended behavior ? i mean for me it have more sense that
the autocomplete callback add what it need and leave the others things
in place.

-- 
Msc. Yoel Benítez Fonseca
Especialista en TI
http://redevil.cubava.cu/
Tel.: (53 32)284701

-- 
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: ImportError: No module named

2015-09-08 Thread Yoel Benitez Fonseca
just to be sure i'm always importing modules with full quote:

from applecations.myapp.modules import XXX

just to be sure

2015-09-08 9:34 GMT-04:00, Leonel Câmara :
> Ohh and it should be:
> from form import Form
>
> --
> 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.
>


-- 
Msc. Yoel Benítez Fonseca
Especialista en TI
http://redevil.cubava.cu/
Tel.: (53 32)284701

-- 
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] Action when file streaming finishes

2015-09-04 Thread Yoel Benitez Fonseca
if it a temporary file create by os.tmpfile() you don't need to care
about deleting it, the system will take care of everything for you.

--
Yoel

2015-09-04 8:32 GMT-04:00, desta :
> Hello,
>
> When the client clicks on a specific link, a temporary file is created by a
>
> controller which is then downloaded (using the `response.stream`). I want
> to delete the file after the download finishes.
>
> Could you please share any suggestions?
>
> 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/d/optout.
>


-- 
Msc. Yoel Benítez Fonseca
Especialista en TI
http://redevil.cubava.cu/
Tel.: (53 32)284701

-- 
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: protect a row in SQLFORM.grid

2015-08-16 Thread Yoel Benitez Fonseca
ummm looking in the online manual now i see that missed this
couple of lines:

...
deletable, editable and details are usually boolean values but they
can be functions which take the row object and decide whether to
display the corresponding button or not.
...

my bad,

thanks

2015-08-16 9:14 GMT-04:00, Yoel Benitez Fonseca ybenit...@gmail.com:
 Anthony,

 Can this method be applied to deletable parameter ? i'll test it aw.

 My problem is that i got a dataset where there are rows that can't be
 deleted by users, but all the other rows can and must be editable and
 deletable, at first my work around was to implement my own grid
 factory managing the 'delete' and 'edit' links and disabling both on
 the special cases.

 thanks for the replays,

 2015-08-15 22:22 GMT-04:00, Anthony abasta...@gmail.com:
 On Saturday, August 15, 2015 at 9:30:09 PM UTC-4, 黄祥 wrote:

 i think you can do the query and put it on the grid signature
 e.g.
 @auth.requires_login()
 def test():
 query = db(db.test.id == 3).select()
 editable = False if query
 deletable = False if query
 grid = SQLFORM.grid(db.test, editable = editable, deletable =
 deletable)
 return locals()


 That won't help, as it will prevent all records from being edited as long
 as there is any record in the table with an id of 3 (whether or not that
 record is even included in the current page of the table).

 Instead, the editable argument can be a function that takes a Row
 object
 and decides whether that particular row should be editable:

 grid = SQLFORM.grid(..., editable=lambda row: row.id != 3)

 The above will allow all rows to be edited except the one with id==3. Of
 course, the function can be made more complex to satisfy any conditions.

 Anthony




 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.



 --
 Msc. Yoel Benítez Fonseca
 Especialista en TI
 Redacción Adelante
 Tel.: (53 32)284701



-- 
Msc. Yoel Benítez Fonseca
Especialista en TI
Redacción Adelante
Tel.: (53 32)284701

-- 
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: protect a row in SQLFORM.grid

2015-08-16 Thread Yoel Benitez Fonseca
Anthony,

Can this method be applied to deletable parameter ? i'll test it aw.

My problem is that i got a dataset where there are rows that can't be
deleted by users, but all the other rows can and must be editable and
deletable, at first my work around was to implement my own grid
factory managing the 'delete' and 'edit' links and disabling both on
the special cases.

thanks for the replays,

2015-08-15 22:22 GMT-04:00, Anthony abasta...@gmail.com:
 On Saturday, August 15, 2015 at 9:30:09 PM UTC-4, 黄祥 wrote:

 i think you can do the query and put it on the grid signature
 e.g.
 @auth.requires_login()
 def test():
 query = db(db.test.id == 3).select()
 editable = False if query
 deletable = False if query
 grid = SQLFORM.grid(db.test, editable = editable, deletable =
 deletable)
 return locals()


 That won't help, as it will prevent all records from being edited as long
 as there is any record in the table with an id of 3 (whether or not that
 record is even included in the current page of the table).

 Instead, the editable argument can be a function that takes a Row object
 and decides whether that particular row should be editable:

 grid = SQLFORM.grid(..., editable=lambda row: row.id != 3)

 The above will allow all rows to be edited except the one with id==3. Of
 course, the function can be made more complex to satisfy any conditions.

 Anthony




 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.



-- 
Msc. Yoel Benítez Fonseca
Especialista en TI
Redacción Adelante
Tel.: (53 32)284701

-- 
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] Application Seperation

2015-08-15 Thread Yoel Benitez Fonseca
It seems a good idea, since both are two separated domains, however u
can make both applications cooperate through API or if they are
installed in the same server y simply can import modules form the
others applications.

See [1] for examples.


[1] http://web2py.com/books/default/chapter/29/10/services

2015-08-13 14:16 GMT-04:00, Jon jonathan.colbert...@gmail.com:
 Hey guys,

 I have a quick question about the separation of functionality provided by
 web2py. Right now I'm working on creating an application for processing
 data that then sends back a graph to users for data analysis.

 My question stems from my desire to add additional functionality in the
 form of a wiki to store the results that individual researchers have come
 up with so they can collaborate together on various problems. Because of
 the potential complexity of both systems, I was wondering if it would be
 better to separate the wiki from the data analysis and create two different

 apps.

 Thanks in advance!

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



-- 
Msc. Yoel Benítez Fonseca
Especialista en TI
Redacción Adelante
Tel.: (53 32)284701

-- 
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] error importing module

2015-08-15 Thread Yoel Benitez Fonseca
Idk what are u doing but to me its seem to be a little dangerous to
give root permissions to the www-data user.

If you are doing some kind of system administrative application you
should probably be better using the rocked webserver - included with
web2py - rather apache or any other webserver.

--


2015-08-14 13:47 GMT-04:00, Matheus Suffi matheus.suff...@gmail.com:
 good Morning,

 I am importing a module called python- iptables, However When I run a
 Function In this module Returns mean  error saying I must be root to
 perform this function.

 already changed permission Execution and changed the owner Archive  However

 www-data STILL NOT Works

 I wonder if there is a way to call imports OS Passing parameters of sudo OR

 IF There Some plug-in that similar MAKE THIS SERVICE Listing / Register IPs

 in Chains

 Error details:


 ...
 S'Traceback (most recent call last):\n  File
 /var/www/web2py/gluon/restricted.py, line 212, in restricted\nexec
 ccode in environment\n  File
 /var/www/web2py/applications/admanager/controllers/funcional.py, line
 1072, in module\n  File /var/www/web2py/gluon/globals.py, line 194, in
 lambda\nself._caller = lambda f: f()\n  File
 /var/www/web2py/gluon/tools.py, line 3022, in f\nreturn action(*a,
 **b)\n  File
 /var/www/web2py/applications/admanager/controllers/funcional.py, line
 1026, in show_iptables\ntable = iptc.Table(iptc.Table.FILTER)\n  File
 /usr/local/lib/python2.7/dist-packages/iptc/ip4tc.py, line 1530, in
 __new__\nobj._init(name, autocommit)\n  File
 /usr/local/lib/python2.7/dist-packages/iptc/ip4tc.py, line 1546, in
 _init\nself.refresh()\n  File
 /usr/local/lib/python2.7/dist-packages/iptc/ip4tc.py, line 1583, in
 refresh\nself.strerror()))\nIPTCError: can\'t initialize filter:
 Permission denied (you must be root)\n'
 p242

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



-- 
Msc. Yoel Benítez Fonseca
Especialista en TI
Redacción Adelante
Tel.: (53 32)284701

-- 
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] protect a row in SQLFORM.grid

2015-08-15 Thread Yoel Benitez Fonseca
hello !

Is possible protect a row in a grid, i mean a specific row with
certain value or Id ?

-- 
Msc. Yoel Benítez Fonseca
Especialista en TI
Redacción Adelante
Tel.: (53 32)284701

-- 
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 different classes for add and edit forms

2015-08-10 Thread Yoel Benitez Fonseca
you can tell when u are editing or creating by the args passed in 
request.args, for example in the view:

{{if 'edit' in request.args:}}
  // do something
{{elif 'new' in request.args:}}
  // do other thing
{{pass}}



El lunes, 10 de agosto de 2015, 12:13:53 (UTC-4), Najtsirk escribió:

 Hello,

 is it possible to assign different classes for add and edit forms in 
 SQLFORM.grid?

 A this point there is no difference between them so I cannot use proper 
 CSS selectors for JS.

 Best,
 Najtsirk


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


  1   2   >