Re: [web2py] LOAD() and auth.requires_login() - Nice "please login" message??

2013-03-28 Thread Yoel Benítez Fonseca
El 27/03/13 19:16, Brian M escribió:
> I have a page that is using LOAD() to pull in a form that requires the
> user to be logged-in (@auth.requires_login())  In previous versions of
> web2py if the user hadn't yet logged in they'd get the login screen
> within the LOAD()'s DIV and at least could get an idea of what they
> needed to do before proceeding, but now with the current version they
> just see "401 NOT AUTHORIZED" which just completely confuses my users.
>  It appears that this change was made in response to issue 832
> 
> in this commit
> .
>  Is there at least some way to specify my own message instead so it says
> something like "Please log-in" rather than "401 NOT AUTHORIZED"?

i prefer (in view):

{{if auth.user:}}
   {{=LOAD('default','whatever.load',args=[a,b,c],ajax=True)}}
{{else:}}

{{=T("You must login to do ...")}}

{{pass}}


--
Yoel.

-- 

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




Re: [web2py] Re: web2py app repository

2013-03-31 Thread Yoel Benítez Fonseca

On 31.3.2013 7:36 pm, Massimo Di Pierro wrote:
I will look at it asap. we need a site to post things like this. Can 
you
post it on github (which a description and a screenshot) and I will 
post a

link to it?


I can try, but as said in the previous mail i have no access to many 
things in Internet.



On Thursday, 28 March 2013 16:20:24 UTC-5, Yoel Benitez Fonseca wrote:


here's the application, sorry but I can only access the Internet via 
a

proxy server, github is out of my reach as many other things.

El 28/03/13 15:26, Massimo Di Pierro escribi�:

If you post it here it will be added to http://web2py.com/poweredby
If the source is public we can  add it to 
http://web2py.com/appliances

We need a better place where people can submit code, gets reviewed,
taged and published.

massimo

On Thursday, 28 March 2013 14:11:13 UTC-5, Yoel Benitez Fonseca 
wrote:


Is there any public repository where I can publish an 
application

made in web2py? ie something web2py specific.

--

---
You received this message because you are 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/groups/opt_out.







--
Yoel Benítez Fonseca
Tel: 573400

--

--- 
You received this message because you are subscribed to the Google Groups "web2py-users" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Scheluder for long tasks

2013-03-31 Thread Yoel Benítez Fonseca

I have some doubts about using Scheluder:

How would it be to run long not repetitive tasks? for example, video 
transcode. What parameters should I consider in the call to queue_task? 
Suppose I have to transcode a video and do two consecutive calls to 
queue_task, Will initiate the two tasks simultaneously or it wait to 
terminate the first to do the next?


--
Yoel Benítez Fonseca
Tel: 573400

--

--- 
You received this message because you are subscribed to the Google Groups "web2py-users" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Re: Scheluder for long tasks

2013-03-31 Thread Yoel Benítez Fonseca

On 31.3.2013 10:04 pm, Massimo Di Pierro wrote:
The point of the scheduler it that for every worker it runs one task 
at the

time. tasks are queued and picked up by worker. Each worker picks up a
task, and when completed (or failed) posts results, if necessary 
queues new

tasks, thank picks up the next task.

This is different from cron. cron always start tasks at scheduled 
times
even if other tasks are in execution. The cron model has the problem 
that
withut a limit to the number of concurrent tasks you can easily run 
out of

memory.


yep, this difference is clear, the problem for me is the duration of 
the task, transcoding videos should have big timeout.


thnks massimo


On Sunday, 31 March 2013 20:44:23 UTC-5, Yoel Benitez Fonseca wrote:


I have some doubts about using Scheluder:

How would it be to run long not repetitive tasks? for example, video
transcode. What parameters should I consider in the call to 
queue_task?

Suppose I have to transcode a video and do two consecutive calls to
queue_task, Will initiate the two tasks simultaneously or it wait to
terminate the first to do the next?

--
Yoel Benítez Fonseca
Tel: 573400



--
Yoel Benítez Fonseca
Tel: 573400

--

--- 
You received this message because you are subscribed to the Google Groups "web2py-users" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Re: Scheluder for long tasks

2013-04-03 Thread Yoel Benítez Fonseca

El 31.3.2013 11:44 pm, Massimo Di Pierro escribió:

You can choose the timeout when you queue a task.



is possible disable time_out in scheluder ? if time_out = 0 what will 
be the result ?




On Sunday, 31 March 2013 21:33:47 UTC-5, Yoel Benitez Fonseca wrote:


On 31.3.2013 10:04 pm, Massimo Di Pierro wrote:

The point of the scheduler it that for every worker it runs one task
at the
time. tasks are queued and picked up by worker. Each worker picks up 
a

task, and when completed (or failed) posts results, if necessary
queues new
tasks, thank picks up the next task.

This is different from cron. cron always start tasks at scheduled
times
even if other tasks are in execution. The cron model has the problem
that
withut a limit to the number of concurrent tasks you can easily run
out of
memory.


yep, this difference is clear, the problem for me is the duration of
the task, transcoding videos should have big timeout.

thnks massimo


On Sunday, 31 March 2013 20:44:23 UTC-5, Yoel Benitez Fonseca wrote:


I have some doubts about using Scheluder:

How would it be to run long not repetitive tasks? for example, 
video

transcode. What parameters should I consider in the call to
queue_task?
Suppose I have to transcode a video and do two consecutive calls to
queue_task, Will initiate the two tasks simultaneously or it wait 
to

terminate the first to do the next?

--
Yoel Benítez Fonseca
Tel: 573400



--
Yoel Benítez Fonseca
Tel: 573400



--
Yoel Benítez Fonseca
Tel: 573400

--

--- 
You received this message because you are subscribed to the Google Groups "web2py-users" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] scheduler init script

2013-04-04 Thread Yoel Benítez Fonseca

i have found this script in the web:


 /etc/init/web2py-scheluder.conf 
description "web2py task scheduler"
start on (local-filesystems and net-device-up IFACE=eth0)
stop on shutdown

respawn
exec sudo -u www-data python /home/www-data/web2py/web2py.py -K myapp
==

Is this the best way in ubuntu ?

Is necessary some aditional parameters to respawn ?
--
Yoel Benítez Fonseca
Tel: 573400

--

--- 
You received this message because you are subscribed to the Google Groups "web2py-users" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] another scheduler Q

2013-04-04 Thread Yoel Benítez Fonseca

i have this setup:

2 severs with the same web2py & app installed, each of then run a 
scheluder worker


the problem is that only one of then get jobs, and in 
db.scheluder_worker the one with do all the work is the only with true 
in is_ticker field, i just the 2 of em cooperate and pickup the 
available jobs.


P.D: got them in diferent's groups and randomly assing task to the 
groups.


--
Yoel Benítez Fonseca
Tel: 573400

--

--- 
You received this message because you are subscribed to the Google Groups "web2py-users" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Re: another scheduler Q

2013-04-05 Thread Yoel Benítez Fonseca

El 5.4.2013 6:47 am, Niphlod escribió:

what db are you using ?


postgres, is the same database shared between servers



On Friday, April 5, 2013 6:24:13 AM UTC+2, Yoel Benitez Fonseca wrote:


i have this setup:

2 severs with the same web2py & app installed, each of then run a
scheluder worker

the problem is that only one of then get jobs, and in
db.scheluder_worker the one with do all the work is the only with 
true

in is_ticker field, i just the 2 of em cooperate and pickup the
available jobs.

P.D: got them in diferent's groups and randomly assing task to the
groups.

--
Yoel Benítez Fonseca
Tel: 573400



--
Yoel Benítez Fonseca
Tel: 573400

--

--- 
You received this message because you are subscribed to the Google Groups "web2py-users" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Re: another scheduler Q

2013-04-05 Thread Yoel Benítez Fonseca

El 5.4.2013 2:57 pm, Niphlod escribió:
this is the second time the issue is posted and yet I can't find a way 
to
reproduce it It's true that I'm running two scheduler processes on 
the

same machine vs one scheduler on on machine and the other on another
separate one, but as far as the "assign" algorithm is concerned, as 
long as

there are two scheduler_workers rows, nothing should change.
Just as a proof, can you confirm that when you start two schedulers on 
the

same server you observe the same behaviour ?


somehow I solved it:

On each server the worker is started with a different group name and 
each task is assigned to a group name randomly chosen from those 
reported in the database:


with n server start the workers like this:

server1: python /home/www-data/web2py/web2py.py -K myapp  # group name 
main

server2: python /home/www-data/web2py/web2py.py -K myapp:srv2
server3: python /home/www-data/web2py/web2py.py -K myapp:srv3
...
serverN: python /home/www-data/web2py/web2py.py -K myapp:srvN


for a group name at random from the available:

def get_groups_names():
rows = db(db.scheduler_worker.id > 
0).select(db.scheduler_worker.group_names).as_list()

mylist = []
for row in rows: mylist.extend(row['group_names'])
tmp = set(mylist) #make it a set

return [item for item in tmp]

and to assign a task to a group:

...
scheduler.queue_task(some_task,
  ...,
  group_name=random.choice(get_groups_names())
)
...

After doing that, the WORKERS started working without problems and 
tasks are not waiting if there are WORKERS idle.



On Friday, April 5, 2013 8:47:58 PM UTC+2, Yoel Benitez Fonseca wrote:


El 5.4.2013 6:47 am, Niphlod escribió:

what db are you using ?


postgres, is the same database shared between servers



On Friday, April 5, 2013 6:24:13 AM UTC+2, Yoel Benitez Fonseca 
wrote:


i have this setup:

2 severs with the same web2py & app installed, each of then run a
scheluder worker

the problem is that only one of then get jobs, and in
db.scheluder_worker the one with do all the work is the only with
true
in is_ticker field, i just the 2 of em cooperate and pickup the
available jobs.

P.D: got them in diferent's groups and randomly assing task to the
groups.

--
Yoel Benítez Fonseca
Tel: 573400



--
Yoel Benítez Fonseca
Tel: 573400



--
Yoel Benítez Fonseca
Tel: 573400

--

--- 
You received this message because you are subscribed to the Google Groups "web2py-users" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Re: another scheduler Q

2013-04-05 Thread Yoel Benítez Fonseca
t;>>> i have this setup: 
> >>>> 
> >>>> 2 severs with the same web2py & app installed,
> each of then run a 
> >>>> scheluder worker 
> >>>> 
>     >>>> the problem is that only one of then get jobs,
> and in 
> >>>> db.scheluder_worker the one with do all the work
> is the only with 
> >>>> true 
>     >>>> in is_ticker field, i just the 2 of em cooperate
> and pickup the 
> >>>> available jobs. 
> >>>> 
> >>>> P.D: got them in diferent's groups and randomly
> assing task to the 
> >>>> groups. 
> >>>> 
> >>>> -- 
> >>>> Yoel Benítez Fonseca 
> >>>> Tel: 573400 
> >>>> 
> >> 
> >> -- 
> >> Yoel Benítez Fonseca 
> >> Tel: 573400 
> >> 
> 
> -- 
> Yoel Benítez Fonseca 
> Tel: 573400 
> 
> -- 
>  
> --- 
> You received this message because you are subscribed to the Google
> Groups "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  


-- 

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




[web2py] problem with gluon/contenttype.py

2013-04-06 Thread Yoel Benítez Fonseca

h!

I've been going crazy for hours with an error in Firefox, it simply did 
not want to play the ogg videos from the web2py server in my development 
environment.


Checking firefox web console found that the content-type associated 
with OGV is 'video/x-theora+ogg' and it should be 'video/ogg' [1].


As i changed gluon/contenttype.py firefox played ogv videos smoothly.

--
Yoel Benítez Fonseca
Tel: 573400


[1] 
https://developer.mozilla.org/en-US/docs/HTML/Supported_media_formats?redirectlocale=en-US&redirectslug=Media_formats_supported_by_the_audio_and_video_elements


--

--- 
You received this message because you are subscribed to the Google Groups "web2py-users" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Re: web2py 2.16.1 is OUT

2017-11-16 Thread Yoel Benítez Fonseca
Massimo, i have tried but can't reproduce the error, maybe this was my
bad.

Sorry for the trouble.

On Tue, 14 Nov 2017 11:33:15 -0800 (PST)
Massimo Di Pierro  wrote:

> Can you send me a simple app to reproduce the problem.
> 
> On Tuesday, 14 November 2017 12:20:03 UTC-6, Yoel Benitez Fonseca
> wrote:
> >
> > 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 > >> href="', escape=False) 
> > >> response.write(_item[2])   
> > >> response.write('">', escape=False)   
> > >> response.write(_item[0]) 
> > >> response.write('\n  \n  ',   
> > escape=False)   
> > >> else: 
> > >> response.write('\n  \n  > >> aria-haspopup="true" aria-expanded="false">', escape=False) 
> > >> response.write(_item[0]) 
> > >> response.write('\n > >> class="dropdown-menu">\n ', escape=False) 
> > >> for _subitem in _item[3]: 
> > >>     response.write('\n   > >> class="dropdown-item" 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.


Re: [web2py] Date widget seems boroken on 2.16.1

2018-01-04 Thread Yoel Benítez Fonseca
Go to the languages/*.py and search for a translatión of the date 
format. Also edit


web2py_ajax.html


It is posible have being edited/modified.

On Wed, Jan 3, 2018 at 12:20 PM, Carlos Cesar Caballero Díaz 
 wrote:
Hi guys, is just me, or the date widget seems broken on 2.16.1 (see 
attached image)?



Greetings.

--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- You received this message because you are subscribed to the 
Google Groups "web2py-users" group.
To unsubscribe from this group 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] Re: How to select row based on item ID or name

2018-01-04 Thread Yoel Benítez Fonseca

You can get algo a row by ID by:

row = db.model_name(ID)

Where ID stand for the actual record id.

On Thu, Jan 4, 2018 at 1:13 PM, Maurice Waka  
wrote:

Second option is better for me

On 4 Jan 2018 8:24 PM, "Dave S"  wrote:



On Wednesday, January 3, 2018 at 10:48:32 PM UTC-8, Maurice Waka 
wrote:







I have the following code for my DB:
dbmyhealth.define_table("health",
Field('name', 'string'),
	Field('definition', 'text', length= 
100,),
	Field('abnval', 'text', length= 
100,),
	Field('normval', 'text', length= 
100,),
	Field('administration', 'text', 
length= 100,),
	Field('screening', 'text', length= 
100,),
	Field('causes', 'text', length= 
100,),

migrate = False)

rows  = dbmyhealth().select(dbmyhealth.health.ALL)
for row in rows:
location0 = row.name
location1 = row.definition
location2 = row.abnvalinterpret
location3 = row.normvalinterpret
location4 = row.administration
location5 = row.screening
location6 = row.causes
corpus = [location1 , location2, location3, location4, 
location5, location6]


I want to select an item, including all the fields from the abnval 
to the causes,not randomly but based on the ID or the name. If I 
use the limitby constraint,I can get either the first, second, or 
last item based on the selection used. If I use the below code, I 
get only the first item, which is everything based on obesity. I 
want to select any item with every query using either an ID or the 
names below e.g.

A code like:
for row in rows:
if id == 2
code..
   corpus = [location1 , location2, location3, location4, 
location5, location6]in this case my corpus will have 
everything on cardiomyopathy using the table details below.


id name
0. diabetes
1. hypertension
2. cardiomyopathy
3. copd
4. obesity

So how do I code it to obtain my answer
Kind regards



Wouldn't that be either of

  rows = dbmyhealth(dbmyhealth.health.id == 2).select()



or (if you were doing more with the query)

  query = dbmyhealth.health.id == 2
  rows  = dbmyhealth(query).select()


?
(I didn't put in a first() because there's only 1 row with id == 2.)

http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Query--Set--Rows>

/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 a topic in 
the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit 
https://groups.google.com/d/topic/web2py/5DWqynKI_-g/unsubscribe.
To unsubscribe from this group and all its topics, send an email to 
web2py+unsubscr...@googlegroups.com.

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

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

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


--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups "web2py-users" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: {Disarmed} Re: [web2py] Date widget seems boroken on 2.16.1

2018-01-04 Thread Yoel Benítez Fonseca
no problem, it took me a time to get it right, sorry don't have enough 
time to put a PR.


On Thu, Jan 4, 2018 at 3:14 PM, Carlos Cesar Caballero Díaz 
 wrote:
Thanks Yoel, the issue is in the Welcome app Spanish translation, in 
the released 2.16.1 version and in the master branch, I will try to 
submit a PR with the fix asap.


Greetings.

El 04/01/18 a las 13:14, Yoel Benítez Fonseca escribió:
Go to the languages/*.py and search for a translatión of the date 
format. Also edit


web2py_ajax.html


It is posible have being edited/modified.

On Wed, Jan 3, 2018 at 12:20 PM, Carlos Cesar Caballero Díaz 
 wrote:
Hi guys, is just me, or the date widget seems broken on 2.16.1 (see 
attached image)?



Greetings.

--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- You received this message because you are subscribed to the 
Google Groups "web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, 
send an email to web2py+unsubscr...@googlegroups.com.
For more options, visit MailScanner ha detectado un intento de 
fraude en la siguiente página web "groups.google.com". No confíe 
en esta página web: MailScanner ha detectado un intento de fraude 
en la siguiente p�gina web "groups.google.com". No conf�e en 
esta p�gina web: 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 MailScanner ha detectado un intento de 
fraude en la siguiente página web "groups.google.com". No confíe 
en esta página web: MailScanner ha detectado un intento de fraude 
en la siguiente p�gina web "groups.google.com". No conf�e en 
esta p�gina web: https://groups.google.com/d/optout.


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

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


--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups "web2py-users" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] One form for multiple tables

2018-01-08 Thread Yoel Benítez Fonseca

I have a crear idea on how to use:

http://web2py.com/books/default/chapter/29/07/forms-and-validators#One-form-for-multiple-tables

But how to do the same for a edit form? Is posible to tell to 
SQLFORM.factory with are the current values of the fields ?


Until now what i do is:

- Copy the fields form the 2 tables to a list
- Set the values as default's for each field
- Do the process().accepted normally an updated each record manually.

regards, yoel.

--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups "web2py-users" group.

To unsubscribe from this group 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: compiling application ?

2018-02-28 Thread Yoel Benítez Fonseca

Thanks Anthony,

On Wed, Feb 28, 2018 at 10:04 AM, Anthony  wrote:
On Tuesday, February 27, 2018 at 6:26:10 PM UTC-5, Yoel Benitez 
Fonseca wrote:
Is there a way of compiling a web2py application from the command 
line ?


I don't think via the web2py command line, but it can be done 
programmatically via app_compile in gluon.admin or more directly via 
compile_application in gluon.compileapp.


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

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


--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups "web2py-users" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Unit testing apis

2018-03-07 Thread Yoel Benítez Fonseca

H!

checkout: https://github.com/viniciusban/web2py.test


On Wed, Mar 7, 2018 at 10:10 AM, Kevin Huang  wrote:


Hi all,


I'm relatively new to web2py, and still trying to find more 
resources, but i've hit a wall, and I'm not quite sure on this issue 
I'm working with:



So working with the "guide" from 
http://web2py.com/AlterEgo/default/show/260, I'm trying to create a 
few unit tests to test some RESTFUL api functions. However, while 
testing multiple test suites, it seems that the request information 
is carrying over somehow despite my attempts to make sure that I 
start with a new request object via setUp each time.


The tests will run just fine if they're alone in the suite, but 
running some of them after the other I was running into HTTP 400 
errors and during debugging I found out that the request data 
carrying over.


Some "sample" code to illustrate what I was trying to do...

import unittest
from gluon.globals import Request

# import api code
execfile("applications/appname/controllers/app_api.py", 
globals())class



# Test Put api
TestPutAPI(unittest.TestCase):

 def setUp(self):
   request = Request(env=[])  # new request, env must be set.

 def test_some_function(self):
   request.vars['var1'] = 1
   request.vars['var2'] = 2
   request.env.request_method = 'PUT'
   response = api() # call api

   self.assertEquals(response['result'], 'success')

  def tearDown(self):
   db.table.truncate()  # clean up db (nothing request related here)


# Test Post api
TestPostAPI(unittest.TestCase):

 def setUp(self):
   request = Request(env=[])  # new request

 def test_some_function(self):
   request.vars['var5'] = "asdf"
   request.vars['var6'] = 6
   request.env.request_method = 'POST'
   response = api() # call api

   self.assertEquals(response['result'], 'success')

 def tearDown(self):
   db.table.truncate()  # clean up db (nothing request related here)


# Run tests
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestPutAPI))
suite.addTest(unittest.makeSuite(TestPostAPI))

unittest.TextTestRunner(verbosity=2).run(suite)


Is my entire approach to unit testing wrong? I know there's a lot a 
mention of doctests being recommended, also that the line request = 
Request() recommended by the original article also being wrong (or 
simply out of date), but I'm also unsure of how the request and api 
call is being processed in this scenario. Earlier I tried doing 2 
calls to the same api in one test function and found that web2py (and 
this unittest) simply could not overwrite the request function - if 
that made any sense (it didn't, and didn't work).


Anyone have any pointers?

Thank you,
KH


--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google 
Groups "web2py-users" group.
To unsubscribe from this group 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] Unit testing apis

2018-03-07 Thread Yoel Benítez Fonseca
idk if that is the right way... i'm using this approach in on of my 
projects and at the moment the only problem i have is with the memory 
usage or the slow access with a file base sqlite database for the tests.


On Wed, Mar 7, 2018 at 1:08 PM, António Ramos  
wrote:

Next chapter in web2py book

Pytest your app the right way

2018-03-07 18:02 GMT+00:00 Yoel Benítez Fonseca 
:

H!

checkout: https://github.com/viniciusban/web2py.test



On Wed, Mar 7, 2018 at 10:10 AM, Kevin Huang  
wrote:


Hi all,


I'm relatively new to web2py, and still trying to find more 
resources, but i've hit a wall, and I'm not quite sure on this 
issue I'm working with:



So working with the "guide" from 
http://web2py.com/AlterEgo/default/show/260, I'm trying to create a 
few unit tests to test some RESTFUL api functions. However, while 
testing multiple test suites, it seems that the request information 
is carrying over somehow despite my attempts to make sure that I 
start with a new request object via setUp each time.


The tests will run just fine if they're alone in the suite, but 
running some of them after the other I was running into HTTP 400 
errors and during debugging I found out that the request data 
carrying over.


Some "sample" code to illustrate what I was trying to do...

import unittest
from gluon.globals import Request

# import api code
execfile("applications/appname/controllers/app_api.py", 
globals())class



# Test Put api
TestPutAPI(unittest.TestCase):

 def setUp(self):
   request = Request(env=[])  # new request, env must be set.

 def test_some_function(self):
   request.vars['var1'] = 1
   request.vars['var2'] = 2
   request.env.request_method = 'PUT'
   response = api() # call api

   self.assertEquals(response['result'], 'success')

  def tearDown(self):
   db.table.truncate()  # clean up db (nothing request related here)


# Test Post api
TestPostAPI(unittest.TestCase):

 def setUp(self):
   request = Request(env=[])  # new request

 def test_some_function(self):
   request.vars['var5'] = "asdf"
   request.vars['var6'] = 6
   request.env.request_method = 'POST'
   response = api() # call api

   self.assertEquals(response['result'], 'success')

 def tearDown(self):
   db.table.truncate()  # clean up db (nothing request related here)


# Run tests
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestPutAPI))
suite.addTest(unittest.makeSuite(TestPostAPI))

unittest.TextTestRunner(verbosity=2).run(suite)


Is my entire approach to unit testing wrong? I know there's a lot a 
mention of doctests being recommended, also that the line request = 
Request() recommended by the original article also being wrong (or 
simply out of date), but I'm also unsure of how the request and api 
call is being processed in this scenario. Earlier I tried doing 2 
calls to the same api in one test function and found that web2py 
(and this unittest) simply could not overwrite the request function 
- if that made any sense (it didn't, and didn't work).


Anyone have any pointers?

Thank you,
KH


--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google 
Groups "web2py-users" group.
To unsubscribe from this group 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.


--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups "web2py-users" group.

To unsubscribe from this group 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] Is there a typo !? uploadfs

2018-03-27 Thread Yoel Benítez Fonseca

h!

In the book, 
http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Field-constructor


Says:

"uploadfs allows you specify a different file system where to upload 
files, including an Amazon S3 storage or a remote SFTP storage. This 
option requires PyFileSystem installed. uploadfs must point to 
PyFileSystem. uploadfs



widget must be one of the available widget objects, including custom 
widgets,..."



At the end is 'must point to PyFileSystem.uploadfs' or 'must point to 
PyFileSystem' and the last '. uploadfs' don't belongs there ?



regards,
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] updating pydal in web2py from git repo

2018-03-28 Thread Yoel Benítez Fonseca

h!

How long takes the changes from pydal to be in the web2py git repo... 
following the README.md from web2py:



git clone --recursive https://github.com/web2py/web2py.git


This is OK, but now it need a change already in the master granch of 
pydal, ¿how can i update the pydal submodule?


--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups "web2py-users" group.

To unsubscribe from this group 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: updating pydal in web2py from git repo

2018-03-30 Thread Yoel Benítez Fonseca
h! for this of you who don't are to experienced with git, for updating 
your git clone of the web2py:


git pull --recurse-submodules

This will update gluon/packages/dal to

On Wed, Mar 28, 2018 at 1:18 PM, Yoel Benítez Fonseca 
 wrote:

h!

How long takes the changes from pydal to be in the web2py git repo... 
following the README.md from web2py:



git clone --recursive https://github.com/web2py/web2py.git


This is OK, but now it need a change already in the master granch of 
pydal, ¿how can i update the pydal submodule?




--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups "web2py-users" group.

To unsubscribe from this group 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] Forcing the translation of a text

2016-12-10 Thread Yoel Benítez Fonseca
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 ?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group 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 Benítez Fonseca
On Sun, 11 Dec 2016 15:32:41 -0800 (PST)
Marlysson Silva  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 ? 
> >  
> 

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