Re: [web2py] Re: web3py

2016-01-14 Thread Ron Chatterjee
Last line I read it as "feel free to share opinion" so I did! lol.



On Thursday, January 14, 2016 at 10:06:20 AM UTC-5, Richard wrote:
>
> Hello Ron,
>
> I think what you ask may be possible, but I think the discussion is stock 
> at a privous stage... Also, try to go read the whole thread on 
> web2py-developpers group as Massimo's mention to not split this 
> discussion...
>
> Richard
>
> On Thu, Jan 14, 2016 at 9:35 AM, Ron Chatterjee  > wrote:
>
>> Can there be some sought of converter that that takes a .w2p file and 
>> spits out .w3p file? I bet its lot of work and testing requires. I am sure 
>> it cant b 100% accurate prolly.
>>
>> --
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> ---
>> You received this message because you are 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.


Re: [web2py] simple update of an cache.ram python dict

2016-01-14 Thread Richard Vézina
This is true for any other cache except cache.ram right?

If so, there is no gain with cache.redis the way I use it...

@Anthony, are you sure about the issue with uwsgi/nginx and cache.ram dict
update?

I guess, I should start to look at how to get rid of these global dict
while not degrading system performance. There surely place where I use
these global vars that wouldn't suffer from a little query to the backend,
but for grid where the performance was the greatest or simplifying code was
acheive with those it will be difficult to stop using them...

Thanks

Richard


On Thu, Jan 14, 2016 at 10:39 AM, Anthony  wrote:

> So, my main issue with both cache.ram and cache.redis is that new id
>> representation never get added to the dict "permanently". In case of
>> cache.ram, the issue may come from what Anthony explain because I use
>> uwsgi/nginx. But I have made some test with redis and the issue still
>> there, but may still be there for a differents reasons, I don't know. I
>> mean if I update the Redis cached dict from shell, and I try to retrieve
>> the representation passing the key to the dict it works, but it looks like
>> this only works in shell. In case of Redis, I may have to recompute the
>> whole dict base on what you explain, which will not provide any performance
>> improvement if it the case, because what I try to prevent it exactly the
>> creation of the dictionary which requires a lot of computing for nothing
>> each time a new record get created. There maybe something I don't
>> understand about how to refresh Redis cache or in what you explained.
>>
>
> The point is that when you retrieve something cached anywhere but RAM, you
> are getting a *copy* of the object. If you then update that copy in your
> Python code, that does nothing to update the value that is stored in the
> cache. So, if you want to update the cached value, you have to explicitly
> put the new copy of the entire object back into the cache.
>
> 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] Re: How do I select and output multiple checkboxes

2016-01-14 Thread Richard Vézina
multiple=True in IS_IN_SET() validator should help...

Richard

On Thu, Jan 14, 2016 at 11:57 AM, Ron Chatterjee 
wrote:

> Where in the book I find this info?
>
>
> On Thursday, January 14, 2016 at 11:56:51 AM UTC-5, Ron Chatterjee wrote:
>>
>> Here is an example in picture.
>>
>>
>>
>> On Wednesday, January 13, 2016 at 4:23:11 PM UTC-5, Ron Chatterjee wrote:
>>>
>>> *Model:*
>>>
>>> db.define_table('mytable',
>>> Field('name', type='list:string',requires=IS_IN_SET
>>> (('True','False')),
>>>   widget=SQLFORM.widgets.checkboxes.widget))
>>>
>>>
>>> *Controller:*
>>>
>>>
>>> def index():
>>> variables = []
>>> form = SQLFORM(db.mytable).process()
>>> if form.accepted:
>>> #comments from that particular blog post
>>> variables = form.vars.name
>>> return dict(form = form,variables = variables )
>>>
>>>
>>> *View:*
>>>
>>> {{extend 'layout.html'}}
>>> {{=form}}
>>> {{=variables}}
>>>
>>>
>>>
>>> I can only output true or false. I want to select and output True and
>>> False both. How?
>>>
>>>
>>> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group 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] Re: web2pyslices again

2016-01-14 Thread Mirek Zvolský
Yes. Anthony.
Today the INSTALL (from web2py admin - install application) works.
So I don't know what to think.
Maybe somebody has made some repair?
Maybe there is some caching? If I change "Short description" (example) - I 
don't see any change in the text too.

Criticism .. you are true of course.
However I am realy tired from Web2pyslices.
I want make something for the community too (at this time this plugin). But 
I don't want faith many many hours with web2pyslices interface.

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

2016-01-14 Thread Mirek Zvolský
Hi,
does any repository for plugin_wiki exist ?
Thanks.

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


[web2py] Re: How can we use variables like session.variable1 inside the html email body?

2016-01-14 Thread Niphlod
'%s' % variable

http://learnpythonthehardway.org/book/ex5.html

On Thursday, January 14, 2016 at 5:31:33 AM UTC+1, aston...@gmail.com wrote:
>
> Thats not html message @Niphlod
> here
> How to display value of here if here is variable

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

2016-01-14 Thread António Ramos
if you dont like web2pyslices wait until you see the appliances..

http://www.web2py.com/appliances
many dont work...

2016-01-14 8:13 GMT+00:00 Mirek Zvolský :

> Yes. Anthony.
> Today the INSTALL (from web2py admin - install application) works.
> So I don't know what to think.
> Maybe somebody has made some repair?
> Maybe there is some caching? If I change "Short description" (example) - I
> don't see any change in the text too.
>
> Criticism .. you are true of course.
> However I am realy tired from Web2pyslices.
> I want make something for the community too (at this time this plugin).
> But I don't want faith many many hours with web2pyslices interface.
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group 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] Re: Hide form field

2016-01-14 Thread desta
Thanks Massimo. I tried what you suggested but they are still visible.

I was able to achieve what I want using:
form = SQLFORM.factory(hidden=dict(year='', month=''))



On Thursday, January 14, 2016 at 7:40:29 AM UTC+2, Massimo Di Pierro wrote:
>
> form = SQLFORM.factory(
>   Field('year', label='Year'),
>   Field('month', label='Month'),
>   hidden=dict(fieldname='field value'))
>
>
> On Wednesday, 13 January 2016 11:21:11 UTC-6, desta wrote:
>>
>> Thank you Anthony for the help.
>>
>> I am not sure how to use this though. Reading the documentation I 
>> construct my form as follows:
>>
>> form = SQLFORM.factory(
>>   Field('year', label='Year'),
>>   Field('month', label='Month'))
>>
>> How do I apply the hidden part you described?
>>
>> Thanks again.
>>
>>
>> On Wednesday, January 13, 2016 at 6:55:05 PM UTC+2, Anthony wrote:
>>>
>>> SQLFORM.factory(..., hidden=dict(fieldname='field value'))
>>>
>>> Anthony
>>>
>>> On Wednesday, January 13, 2016 at 11:35:57 AM UTC-5, desta wrote:

 I am generating a form using SQLFORM.factory() and I would like to 
 create a hidden field. I tried doing this by setting readable and writable 
 to False, but the field dissapears from HTML.

 Is there a way to make it hidden but still accessible in HTML as I want 
 to set its value with Javascript.

 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.


[web2py] This jquery conditional form at pg 505 in book doesn't work. What's the problem?

2016-01-14 Thread aston . ribat
db = DAL('sqlite://db.db')
db.define_table('taxpayer',
Field('name'),
Field('married', 'boolean'),
Field('spouse'))

def conditionalform():
form = SQLFORM(db.taxpayer)
if form.process().accepted:
response.flash = 'record inserted'
return locals()


{{extend 'layout.html'}}
{{=form}}

jQuery(document).ready(function(){
jQuery('#taxpayer_spouse__row').hide();
jQuery('#taxpayer_married').change(function(){
if(jQuery('#taxpayer_married').attr('checked'))
jQuery('#taxpayer_spouse__row').show();
else jQuery('#taxpayer_spouse__row').hide();});
});


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group 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: This jquery conditional form at pg 505 in book doesn't work. What's the problem?

2016-01-14 Thread aston . ribat
I am using the latest web2py version

On Thursday, January 14, 2016 at 2:58:00 PM UTC+5:30, aston...@gmail.com 
wrote:
>
> db = DAL('sqlite://db.db')
> db.define_table('taxpayer',
> Field('name'),
> Field('married', 'boolean'),
> Field('spouse'))
>
> def conditionalform():
> form = SQLFORM(db.taxpayer)
> if form.process().accepted:
> response.flash = 'record inserted'
> return locals()
>
>
> {{extend 'layout.html'}}
> {{=form}}
> 
> jQuery(document).ready(function(){
> jQuery('#taxpayer_spouse__row').hide();
> jQuery('#taxpayer_married').change(function(){
> if(jQuery('#taxpayer_married').attr('checked'))
> jQuery('#taxpayer_spouse__row').show();
> else jQuery('#taxpayer_spouse__row').hide();});
> });
> 
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group 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: This jquery conditional form at pg 505 in book doesn't work. What's the problem?

2016-01-14 Thread Val K
Hi!
Try to replace *.attr('checked')*   with  *.prop('checked')*

On Thursday, January 14, 2016 at 12:32:46 PM UTC+3, aston...@gmail.com 
wrote:
>
> I am using the latest web2py version
>
> On Thursday, January 14, 2016 at 2:58:00 PM UTC+5:30, aston...@gmail.com 
> wrote:
>>
>> db = DAL('sqlite://db.db')
>> db.define_table('taxpayer',
>> Field('name'),
>> Field('married', 'boolean'),
>> Field('spouse'))
>>
>> def conditionalform():
>> form = SQLFORM(db.taxpayer)
>> if form.process().accepted:
>> response.flash = 'record inserted'
>> return locals()
>>
>>
>> {{extend 'layout.html'}}
>> {{=form}}
>> 
>> jQuery(document).ready(function(){
>> jQuery('#taxpayer_spouse__row').hide();
>> jQuery('#taxpayer_married').change(function(){
>> if(jQuery('#taxpayer_married').attr('checked'))
>> jQuery('#taxpayer_spouse__row').show();
>> else jQuery('#taxpayer_spouse__row').hide();});
>> });
>> 
>>
>>

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

2016-01-14 Thread Val K
Hi!
See IS_DATETIME 

 
validator in the web2py book


On Thursday, January 14, 2016 at 4:49:17 AM UTC+3, Lorenzo Zonca wrote:
>
> Goodmorning  to everyone. 
>
> Through a field "date " with calendar of a CRUD , how can I store a date 
> with this syntax 
>
> eg . Monday, 2 May - 2016 ( day - number of day - month - year ) 
>
>
> 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.


[web2py] Re: This jquery conditional form at pg 505 in book doesn't work. What's the problem?

2016-01-14 Thread aston . ribat
thanks, it worked

On Thursday, January 14, 2016 at 3:41:26 PM UTC+5:30, Val K wrote:
>
> Hi!
> Try to replace *.attr('checked')*   with  *.prop('checked')*
>
> On Thursday, January 14, 2016 at 12:32:46 PM UTC+3, aston...@gmail.com 
> wrote:
>>
>> I am using the latest web2py version
>>
>> On Thursday, January 14, 2016 at 2:58:00 PM UTC+5:30, aston...@gmail.com 
>> wrote:
>>>
>>> db = DAL('sqlite://db.db')
>>> db.define_table('taxpayer',
>>> Field('name'),
>>> Field('married', 'boolean'),
>>> Field('spouse'))
>>>
>>> def conditionalform():
>>> form = SQLFORM(db.taxpayer)
>>> if form.process().accepted:
>>> response.flash = 'record inserted'
>>> return locals()
>>>
>>>
>>> {{extend 'layout.html'}}
>>> {{=form}}
>>> 
>>> jQuery(document).ready(function(){
>>> jQuery('#taxpayer_spouse__row').hide();
>>> jQuery('#taxpayer_married').change(function(){
>>> if(jQuery('#taxpayer_married').attr('checked'))
>>> jQuery('#taxpayer_spouse__row').show();
>>> else jQuery('#taxpayer_spouse__row').hide();});
>>> });
>>> 
>>>
>>>

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

2016-01-14 Thread Val K
hidden=dict(...) - just *extra *hidden fields, it doesn't change attributes 
of any Field(...) 

On Thursday, January 14, 2016 at 12:20:22 PM UTC+3, desta wrote:
>
> Thanks Massimo. I tried what you suggested but they are still visible.
>
> I was able to achieve what I want using:
> form = SQLFORM.factory(hidden=dict(year='', month=''))
>
>
>
> On Thursday, January 14, 2016 at 7:40:29 AM UTC+2, Massimo Di Pierro wrote:
>>
>> form = SQLFORM.factory(
>>   Field('year', label='Year'),
>>   Field('month', label='Month'),
>>   hidden=dict(fieldname='field value'))
>>
>>
>> On Wednesday, 13 January 2016 11:21:11 UTC-6, desta wrote:
>>>
>>> Thank you Anthony for the help.
>>>
>>> I am not sure how to use this though. Reading the documentation I 
>>> construct my form as follows:
>>>
>>> form = SQLFORM.factory(
>>>   Field('year', label='Year'),
>>>   Field('month', label='Month'))
>>>
>>> How do I apply the hidden part you described?
>>>
>>> Thanks again.
>>>
>>>
>>> On Wednesday, January 13, 2016 at 6:55:05 PM UTC+2, Anthony wrote:

 SQLFORM.factory(..., hidden=dict(fieldname='field value'))

 Anthony

 On Wednesday, January 13, 2016 at 11:35:57 AM UTC-5, desta wrote:
>
> I am generating a form using SQLFORM.factory() and I would like to 
> create a hidden field. I tried doing this by setting readable and 
> writable 
> to False, but the field dissapears from HTML.
>
> Is there a way to make it hidden but still accessible in HTML as I 
> want to set its value with Javascript.
>
> 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.


[web2py] Can you please correct this for me?

2016-01-14 Thread aston . ribat
now go back

to go back i am using request.enc.referer but it is saying:
invalid function (default/http)


please tell me the corrected version for it

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


[web2py] Re: web3py

2016-01-14 Thread Ron Chatterjee
Can there be some sought of converter that that takes a .w2p file and spits out 
.w3p file? I bet its lot of work and testing requires. I am sure it cant b 100% 
accurate prolly. 

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

2016-01-14 Thread Niphlod
plugin_wiki has been largely superseeded by auth.wiki.

On Thursday, January 14, 2016 at 9:16:00 AM UTC+1, Mirek Zvolský wrote:
>
> Hi,
> does any repository for plugin_wiki exist ?
> 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.


Re: [web2py] simple update of an cache.ram python dict

2016-01-14 Thread Richard Vézina
Yes, this may be an option (update whole dict in Redis)... Mean time I get
rid of them, if I can succeed in that...

:)

Thanks Anthony.

Richard

On Thu, Jan 14, 2016 at 12:06 PM, Anthony  wrote:

> On Thursday, January 14, 2016 at 11:12:12 AM UTC-5, Richard wrote:
>>
>> This is true for any other cache except cache.ram right?
>>
>
> Right. cache.ram works because it doesn't have to pickle a Python object
> and put it into external storage (and therefore create a fresh copy of the
> stored object via unpickling at retrieval time). Rather, it simply stores a
> pointer to the existing Python object within the current Python process. Of
> course, this limits cache.ram to a single process, so if your app is being
> served by multiple processes, each will have its own version of cache.ram.
>
>
>> If so, there is no gain with cache.redis the way I use it...
>>
>
> Well, the gain with Redis is that it will actually work, though you will
> have to adjust your code to save the whole dictionary back to the cache
> upon update.
>
>
>> @Anthony, are you sure about the issue with uwsgi/nginx and cache.ram
>> dict update?
>>
>
> I think so. You might try configuring uwsgi to run a single process with
> multiple threads instead of using multiple processes. Not sure how that
> will impact performance.
>
>
>> I guess, I should start to look at how to get rid of these global dict
>> while not degrading system performance. There surely place where I use
>> these global vars that wouldn't suffer from a little query to the backend,
>> but for grid where the performance was the greatest or simplifying code was
>> acheive with those it will be difficult to stop using them...
>>
>
> Is it really a problem to write the whole dictionary to Redis? How often
> are updates happening?
>
> 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] simple update of an cache.ram python dict

2016-01-14 Thread Anthony

>
> So, my main issue with both cache.ram and cache.redis is that new id 
> representation never get added to the dict "permanently". In case of 
> cache.ram, the issue may come from what Anthony explain because I use 
> uwsgi/nginx. But I have made some test with redis and the issue still 
> there, but may still be there for a differents reasons, I don't know. I 
> mean if I update the Redis cached dict from shell, and I try to retrieve 
> the representation passing the key to the dict it works, but it looks like 
> this only works in shell. In case of Redis, I may have to recompute the 
> whole dict base on what you explain, which will not provide any performance 
> improvement if it the case, because what I try to prevent it exactly the 
> creation of the dictionary which requires a lot of computing for nothing 
> each time a new record get created. There maybe something I don't 
> understand about how to refresh Redis cache or in what you explained.
>

The point is that when you retrieve something cached anywhere but RAM, you 
are getting a *copy* of the object. If you then update that copy in your 
Python code, that does nothing to update the value that is stored in the 
cache. So, if you want to update the cached value, you have to explicitly 
put the new copy of the entire object back into the cache.

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: Field Type Data

2016-01-14 Thread Lorenzo Zonca
Thank you, but my problem is not this.

i need to calculate this syntax example:

now is '14/01/2016' 
I want to be converted automatically to the format 'wednesday  14/01/2016'

simply calculate the day ( sunday - monday  ecc. )

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


[web2py] Re: How do I select and output multiple checkboxes

2016-01-14 Thread Ron Chatterjee
Here is an example in picture.



On Wednesday, January 13, 2016 at 4:23:11 PM UTC-5, Ron Chatterjee wrote:
>
> *Model:*
>
> db.define_table('mytable',
> Field('name', type='list:string',requires=IS_IN_SET 
> (('True','False')),
>   widget=SQLFORM.widgets.checkboxes.widget))
>
>
> *Controller:*
>
>
> def index():
> variables = []
> form = SQLFORM(db.mytable).process()
> if form.accepted:
> #comments from that particular blog post
> variables = form.vars.name
> return dict(form = form,variables = variables )
>
>
> *View:*
>
> {{extend 'layout.html'}}
> {{=form}}
> {{=variables}}
>
>
>
> I can only output true or false. I want to select and output True and 
> False both. How?
>
>
>

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

2016-01-14 Thread Richard Vézina
@Niphold, I just send a PR with improvements mainly docstring and PEP8 over
cache redis contrib...

:D

Richard

On Thu, Jan 14, 2016 at 11:12 AM, Richard Vézina <
ml.richard.vez...@gmail.com> wrote:

> This is true for any other cache except cache.ram right?
>
> If so, there is no gain with cache.redis the way I use it...
>
> @Anthony, are you sure about the issue with uwsgi/nginx and cache.ram dict
> update?
>
> I guess, I should start to look at how to get rid of these global dict
> while not degrading system performance. There surely place where I use
> these global vars that wouldn't suffer from a little query to the backend,
> but for grid where the performance was the greatest or simplifying code was
> acheive with those it will be difficult to stop using them...
>
> Thanks
>
> Richard
>
>
> On Thu, Jan 14, 2016 at 10:39 AM, Anthony  wrote:
>
>> So, my main issue with both cache.ram and cache.redis is that new id
>>> representation never get added to the dict "permanently". In case of
>>> cache.ram, the issue may come from what Anthony explain because I use
>>> uwsgi/nginx. But I have made some test with redis and the issue still
>>> there, but may still be there for a differents reasons, I don't know. I
>>> mean if I update the Redis cached dict from shell, and I try to retrieve
>>> the representation passing the key to the dict it works, but it looks like
>>> this only works in shell. In case of Redis, I may have to recompute the
>>> whole dict base on what you explain, which will not provide any performance
>>> improvement if it the case, because what I try to prevent it exactly the
>>> creation of the dictionary which requires a lot of computing for nothing
>>> each time a new record get created. There maybe something I don't
>>> understand about how to refresh Redis cache or in what you explained.
>>>
>>
>> The point is that when you retrieve something cached anywhere but RAM,
>> you are getting a *copy* of the object. If you then update that copy in
>> your Python code, that does nothing to update the value that is stored in
>> the cache. So, if you want to update the cached value, you have to
>> explicitly put the new copy of the entire object back into the cache.
>>
>> 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] simple update of an cache.ram python dict

2016-01-14 Thread Anthony
On Thursday, January 14, 2016 at 11:12:12 AM UTC-5, Richard wrote:
>
> This is true for any other cache except cache.ram right?
>

Right. cache.ram works because it doesn't have to pickle a Python object 
and put it into external storage (and therefore create a fresh copy of the 
stored object via unpickling at retrieval time). Rather, it simply stores a 
pointer to the existing Python object within the current Python process. Of 
course, this limits cache.ram to a single process, so if your app is being 
served by multiple processes, each will have its own version of cache.ram.
 

> If so, there is no gain with cache.redis the way I use it...
>

Well, the gain with Redis is that it will actually work, though you will 
have to adjust your code to save the whole dictionary back to the cache 
upon update.
 

> @Anthony, are you sure about the issue with uwsgi/nginx and cache.ram dict 
> update?
>

I think so. You might try configuring uwsgi to run a single process with 
multiple threads instead of using multiple processes. Not sure how that 
will impact performance.
 

> I guess, I should start to look at how to get rid of these global dict 
> while not degrading system performance. There surely place where I use 
> these global vars that wouldn't suffer from a little query to the backend, 
> but for grid where the performance was the greatest or simplifying code was 
> acheive with those it will be difficult to stop using them...
>

Is it really a problem to write the whole dictionary to Redis? How often 
are updates happening?

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] trouble with embeding youtube

2016-01-14 Thread Hans Soflao
I am trying to embed a youtube video into the view; I do not know why it 
does not work at all; I thought it is as simple as just the following code:

  http://www.youtube.com/blabla;>
   

What is my error? 
It looks like the view gets the fram but does not show the video at all.

Does this need to be in the controller level? I was thinking whatever html 
capability is out there web2py has them too.

Thanks for the help

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


[web2py] Manually uploading a file from FieldStorage

2016-01-14 Thread Lou C
Hey, I am trying to manually upload a file from a request without using 
SQLFORMS, as this is is done through a REST client. This is is what I have 
so far:

id = db.image.insert(file = 
db.image.file.store(request.vars.profile_pic.file,request.vars.profile_pic.filename))


This works, but fails to upload the BLOB, and only uploads the filename? 
Calling the link generated, only downloads an empty file.

I also have tried this


stream = open(request.vars.profile_pic.file.read(),'rb')
id = db.image.insert(file = 
db.image.file.store(stream,request.vars.profile_pic.filename))


This gives the error of argument 1 must be encoded string without NULL bytes, 
not str


By the way, my application is running on GAE, and my client is a mobile 
application that sends the data through HTTP request.

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


[web2py] Re: web2py is giving me wrong time when I am using request.now for datetime. How to get time a/c as GMT?

2016-01-14 Thread Anthony
On Thursday, January 14, 2016 at 4:16:41 PM UTC-5, Gael Princivalle wrote:
>
> Ok, thank you Massimo good information, I'll not use it anymore.
> I tried it because I've got difficulties to set the datetime of my new 
> webfaction server as I want.
>

You can still change the timezone of your server and even use Python to do 
it, but no need to do it on every request within your app 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.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: Can website visitors update my languages files?

2016-01-14 Thread Michael Wolfe
OK. So the framework is updating the languages files in my app based on
translations in other apps (e.g., admin and appadmin)?

But only if a website visitor requests a page in that language, correct?

So I'm imagining the following algorithm:

- website visitor with a 'pl' language preference visits my site
- goes to a page with T("Hello")
- web2py looks for /myapp/languages/pl.py
- web2py looks for "Hello" in that file
- can't find it, so it checks /appadmin/languages/pl.py
- finds a translation in that file
- updates /myapp/languages/pl.py with this translation
- shows visitor the translated text

Is that about right?
On Jan 14, 2016 5:34 PM, "Anthony"  wrote:

> web2py comes with many phrases already translated (e.g., those used in
> admin and appadmin):
>
>
> https://github.com/web2py/web2py/blob/master/applications/welcome/languages/ru.py#L13
>
> Anthony
>
> On Thursday, January 14, 2016 at 3:40:47 PM UTC-5, mwolfe02 wrote:
>>
>> That makes sense.  I guess my question is where do the translations
>> themselves come from?  For example, the following two lines were *added* to
>> the Russian translation file:
>>
>> '%s rows deleted': '%s строк удалено',
>> '%s rows updated': '%s строк изменено',
>>
>> I certainly did not add in the Cyrillic characters in the above lines.
>> So where did they come from?
>>
>> There are some lines that were just changed from their hex code to the
>> Unicode characters (e.g., "\xd0\x98\xd0\xb7\xd0\xbc" to "Изм").  That I can
>> understand.  It's the brand new translations that I was surprised by.
>> Could they be coming from the languages files in the example app?
>>
>> Thanks,
>> Mike
>>
>> On Thu, Jan 14, 2016 at 3:32 PM, Anthony  wrote:
>>
>>> The first time a visitor requesting a particular language hits the app,
>>> any T() items not yet in the associated translation file will be added
>>> automatically for later translation.
>>>
>>> Anthony
>>>
>>>
>>> On Thursday, January 14, 2016 at 2:41:04 PM UTC-5, mwolfe02 wrote:

 I've got a live web2py application under Mercurial version control.
 When I did my latest commit, I noticed there were several changes to the
 following two files (the Polish and Russian translation files):

 /languages/pl.py
 /languages/ru-ru.py

 I did not make these changes.  The changes look like they could be
 legitimate and perhaps automated.  For example, here are the first few
 lines of the ru-ru.py diff (I removed some characters and replaced them
 with {...} to limit the amount of noise:


 @@ -1,87 +1,91 @@
 -# coding: utf8
 +# -*- coding: utf-8 -*-
  {
 -'"update" is an optional expression like "field1=\'newvalue\'". You
 cannot update or delete the results of a JOIN':
 '"\xd0\x98\xd0{...}\xd1\x8c.',
 +'"update" is an optional expression like "field1=\'newvalue\'". You
 cannot update or delete the results of a JOIN': '"Изм{...}ть.',
 +'%s rows deleted': '%s строк удалено',
 +'%s rows updated': '%s строк изменено',
  '%Y-%m-%d': '%Y-%m-%d',
  '%Y-%m-%d %H:%M:%S': '%Y-%m-%d %H:%M:%S',


 So what could have caused these changes?  Does web2py itself do
 something that would cause this?  Google Translate?  Website visitors?
 Apache?

 Are there security considerations I should be aware of?

 As far as I know, I have not done anything to modify the default
 Translation behavior of my app.

 Thanks in advance to anyone who can enlighten me,
 Mike Wolfe

>>> --
>>> Resources:
>>> - http://web2py.com
>>> - http://web2py.com/book (Documentation)
>>> - http://github.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/46XERxrdvts/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 a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/46XERxrdvts/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)
--- 

Re: [web2py] simple update of an cache.ram python dict

2016-01-14 Thread Richard Vézina
I don't understand something... I have this :

```python
def set_dict_test():
if 'dict123' not in globals():
print 'dict123 not in globals : %s' % str('dict123' not in
globals())
global dict123
dict123 = cache.ram('dict123', lambda: {1: 1, 2: 2, 3: 3},
time_expire=None)
# dict123 = {1: 1, 2: 2, 3: 3}
else:
print 'no dict creation'
print dict123

set_dict_test()
# dict123 = cache.ram('dict123', lambda: {1: 1, 2: 2, 3: 3},
time_expire=None)
print 'AFTER function call... dict123 in globals : %s' % str('dict123'
in globals())
print dict123
```

What I don't understand is why each time set_dict_test() is call dict123 is
never in globals().

If I don't use cache.ram dict123 is in globals() and function return the
else: part of the function...

It the same for cache.redis()

Richard

On Thu, Jan 14, 2016 at 3:47 PM, Richard Vézina  wrote:

> Forget about last message I was making a mistake in my print statments
>
> On Thu, Jan 14, 2016 at 3:40 PM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>> There is something I don't understand... I put a couple of print
>> statments to see if my cached vars was in globals() and I discover that my
>> var was never there...
>>
>> I am lost completly... If it pass throught my "if" my dict will be
>> recreated each request...
>>
>> :(
>>
>> Richard
>>
>> On Thu, Jan 14, 2016 at 12:13 PM, Richard Vézina <
>> ml.richard.vez...@gmail.com> wrote:
>>
>>> Yes, this may be an option (update whole dict in Redis)... Mean time I
>>> get rid of them, if I can succeed in that...
>>>
>>> :)
>>>
>>> Thanks Anthony.
>>>
>>> Richard
>>>
>>> On Thu, Jan 14, 2016 at 12:06 PM, Anthony  wrote:
>>>
 On Thursday, January 14, 2016 at 11:12:12 AM UTC-5, Richard wrote:
>
> This is true for any other cache except cache.ram right?
>

 Right. cache.ram works because it doesn't have to pickle a Python
 object and put it into external storage (and therefore create a fresh copy
 of the stored object via unpickling at retrieval time). Rather, it simply
 stores a pointer to the existing Python object within the current Python
 process. Of course, this limits cache.ram to a single process, so if your
 app is being served by multiple processes, each will have its own version
 of cache.ram.


> If so, there is no gain with cache.redis the way I use it...
>

 Well, the gain with Redis is that it will actually work, though you
 will have to adjust your code to save the whole dictionary back to the
 cache upon update.


> @Anthony, are you sure about the issue with uwsgi/nginx and cache.ram
> dict update?
>

 I think so. You might try configuring uwsgi to run a single process
 with multiple threads instead of using multiple processes. Not sure how
 that will impact performance.


> I guess, I should start to look at how to get rid of these global dict
> while not degrading system performance. There surely place where I use
> these global vars that wouldn't suffer from a little query to the backend,
> but for grid where the performance was the greatest or simplifying code 
> was
> acheive with those it will be difficult to stop using them...
>

 Is it really a problem to write the whole dictionary to Redis? How
 often are updates happening?

 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.


[web2py] Re: This app gives me authentication issue. Why?

2016-01-14 Thread Ron Chatterjee
default.py

On Thursday, January 14, 2016 at 6:25:45 PM UTC-5, Dave S wrote:
>
>
>
> On Wednesday, January 13, 2016 at 12:46:25 PM UTC-8, Ron Chatterjee wrote:
>>
>> Using this app. When I try to chat gives me authentication issue. Any 
>> thoughts?
>>
>
> Which controllers do you think we should be looking at?
>
> /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.


Re: [web2py] Re: Can website visitors update my languages files?

2016-01-14 Thread Anthony
web2py comes with many phrases already translated (e.g., those used in 
admin and appadmin):

https://github.com/web2py/web2py/blob/master/applications/welcome/languages/ru.py#L13

Anthony

On Thursday, January 14, 2016 at 3:40:47 PM UTC-5, mwolfe02 wrote:
>
> That makes sense.  I guess my question is where do the translations 
> themselves come from?  For example, the following two lines were *added* to 
> the Russian translation file:
>
> '%s rows deleted': '%s строк удалено',
> '%s rows updated': '%s строк изменено',
>
> I certainly did not add in the Cyrillic characters in the above lines.  So 
> where did they come from?
>
> There are some lines that were just changed from their hex code to the 
> Unicode characters (e.g., "\xd0\x98\xd0\xb7\xd0\xbc" to "Изм").  That I can 
> understand.  It's the brand new translations that I was surprised by.  
> Could they be coming from the languages files in the example app?
>
> Thanks,
> Mike
>
> On Thu, Jan 14, 2016 at 3:32 PM, Anthony  wrote:
>
>> The first time a visitor requesting a particular language hits the app, 
>> any T() items not yet in the associated translation file will be added 
>> automatically for later translation.
>>
>> Anthony
>>
>>
>> On Thursday, January 14, 2016 at 2:41:04 PM UTC-5, mwolfe02 wrote:
>>>
>>> I've got a live web2py application under Mercurial version control.  
>>> When I did my latest commit, I noticed there were several changes to the 
>>> following two files (the Polish and Russian translation files):
>>>
>>> /languages/pl.py
>>> /languages/ru-ru.py
>>>
>>> I did not make these changes.  The changes look like they could be 
>>> legitimate and perhaps automated.  For example, here are the first few 
>>> lines of the ru-ru.py diff (I removed some characters and replaced them 
>>> with {...} to limit the amount of noise:
>>>
>>>
>>> @@ -1,87 +1,91 @@
>>> -# coding: utf8
>>> +# -*- coding: utf-8 -*-
>>>  {
>>> -'"update" is an optional expression like "field1=\'newvalue\'". You 
>>> cannot update or delete the results of a JOIN': 
>>> '"\xd0\x98\xd0{...}\xd1\x8c.',
>>> +'"update" is an optional expression like "field1=\'newvalue\'". You 
>>> cannot update or delete the results of a JOIN': '"Изм{...}ть.',
>>> +'%s rows deleted': '%s строк удалено',
>>> +'%s rows updated': '%s строк изменено',
>>>  '%Y-%m-%d': '%Y-%m-%d',
>>>  '%Y-%m-%d %H:%M:%S': '%Y-%m-%d %H:%M:%S',
>>>
>>>
>>> So what could have caused these changes?  Does web2py itself do 
>>> something that would cause this?  Google Translate?  Website visitors?  
>>> Apache?
>>>
>>> Are there security considerations I should be aware of?
>>>
>>> As far as I know, I have not done anything to modify the default 
>>> Translation behavior of my app.
>>>
>>> Thanks in advance to anyone who can enlighten me,
>>> Mike Wolfe
>>>
>> -- 
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.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/46XERxrdvts/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.


[web2py] Re: This app gives me authentication issue. Why?

2016-01-14 Thread Dave S


On Wednesday, January 13, 2016 at 12:46:25 PM UTC-8, Ron Chatterjee wrote:
>
> Using this app. When I try to chat gives me authentication issue. Any 
> thoughts?
>

Which controllers do you think we should be looking at?

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


[web2py] crud.update alternative

2016-01-14 Thread Ron Chatterjee
I haven't used crud for long time. I realize SQLFORM is the alternative. 
 What would be the crud.update alternative for this example?


@auth.requires_login()
def project_edit():
selected_project = db.Project(request.args(0)) or 
redirect(URL('show_project'))
form = crud.update(db.Project, selected_project, next = 
'show_project_summary/[id]')
return locals()


Same goes for crud.delete. Is it just db.table.field.drop()?

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

2016-01-14 Thread Ovidio Marinho
2



Sent with MailTrack






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


2016-01-14 20:14 GMT-02:00 Pbop :

> Sounds like you have a good approach with option 2. That is my vote! You
> can't get around that once a decision is made the community will react with
> some degrees of enthusiasm and pushback.
>
> I am curious if the increase in performance is based on a more efficient
> algorithm, Python3 is doing things faster or both?
>
> Keep up the good work.
>
>
>
> On Thursday, January 14, 2016 at 12:35:36 AM UTC-5, Massimo Di Pierro
> wrote:
>>
>> It is another experiment.
>>
>> It is a rewrite of some of the web2py modules and supports 90% of the
>> current web2py syntax at 2.5x the speed. It works. It it cleaner and should
>> be easier to port to python 3 than current web2py.
>>
>> We are debating on web2py developers what to do:
>> 1) backport some of the new modules to web2py (specifically the new Form
>> class instead of SQLFORM)
>> 2) try to reach a 99.9% compatibility and release it as new major version
>> with guidelines for porting legacy apps
>> 3) make some drastic changes in backward compatibility and release as a
>> different framework (but change what? we like web2py as it is)
>>
>> For now I am working on 2 to see how far I can push the backward
>> compatibility. But there are some functionalities I want remove or move in
>> an optional module (from legacy_web2py import *).
>>
>> Feel free to share your opinion on web2py developers.
>>
>> Massimo
>>
>>
>> On Wed, Jan 13, 2016 at 11:04 PM, kelson _ 
>> wrote:
>>
>>> I was looking at your recent web3py commits and hoped you could provide
>>> the web3py vision/intent (or point me towards it if I missed the
>>> discussion).
>>>
>>> Thanks,
>>> kelson
>>>
>>
>> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group 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] Re: Oracle Blob Read

2016-01-14 Thread Dave S


On Wednesday, January 13, 2016 at 5:49:17 PM UTC-8, Rochdi HASSINE wrote:
>
> I'm new on web2py and I need to display some images stored in Oracle 
> Database.
> It s Oracle BLOB fields.
>
>
What is your Field declaration for that?

Rendering images is done by the browser, but setting the content-type is 
part of the key to that.  Take a look at the image blog example in Chapter 
3 of the book


(It's worth working through at least some of the examples in that chapter, 
just to get used to things.)

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


[web2py] Re: how to calculate size of uploads by user

2016-01-14 Thread Alex Glaros
do I need to import something to make it work?

lines after if request.vars.contents: are never reached

if I take out the above conditional, it doesn't know what "value" and "
filesize" are

'NoneType' object has no attribute 'value'
'NoneType' object has no attribute 'filename'


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

2016-01-14 Thread Val K
As I see you want to customize date format at form level, i.e.  user picks 
the date from calendar and the field is filled with 'Monday ...' (name of 
the day)
If  it's what you want you can use the following:
There are two JS-variables are used by calendar  (see 
your_app/views/web2py_ajax.html):
var w2p_ajax_date_format = "{{=T('%Y-%m-%d')}}";
var w2p_ajax_datetime_format = "{{=T('%Y-%m-%d %H:%M:%S')}}"; 

You can change these vars in web2py_ajax.html (global change) or just 
overwrite them at veiw level   
Calendar format date  - http://www.dynarch.com/jscal/#sec22
P.S. It seems web2py IS_DATE validator doesn't recognize names of the days  
So, you have to write your own

On Thursday, January 14, 2016 at 4:49:17 AM UTC+3, Lorenzo Zonca wrote:
>
> Goodmorning  to everyone. 
>
> Through a field "date " with calendar of a CRUD , how can I store a date 
> with this syntax 
>
> eg . Monday, 2 May - 2016 ( day - number of day - month - year ) 
>
>
> 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.


[web2py] Error No module named copy_reg after upgrading web2py

2016-01-14 Thread José Eloy
Hi there!

I upgrade my web2py source folder (2.9.6) with the most recent version 
(2.13.4), but when I run my application I get the error: No module named 
copy_reg. Mi app was running well before the upgrade. I´m runnig my app in 
Windows Server 2008 R2. The upgrade was made using the administrative 
interface and copy/paste the new version over the old version.

How I can to fix this error?

Regards.

Sorry for my bad english!  I hope you can understandme.

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

2016-01-14 Thread Ron Chatterjee
It does! Thank you Richard. Do you happen to know if I want to display the 
checkbox horizontally as oppose to vertically, how would I do that? I asked 
cuz if I have a table with other fields and I have 10 checkboxes to say, it 
will be better to present them horizontally than vertically. Regardless, 
thanks for your time on this. Appreciated.

 

On Thursday, January 14, 2016 at 12:33:52 PM UTC-5, Richard wrote:
>
> multiple=True in IS_IN_SET() validator should help...
>
> Richard
>
> On Thu, Jan 14, 2016 at 11:57 AM, Ron Chatterjee  > wrote:
>
>> Where in the book I find this info?  
>>
>>
>> On Thursday, January 14, 2016 at 11:56:51 AM UTC-5, Ron Chatterjee wrote:
>>>
>>> Here is an example in picture.
>>>
>>>
>>>
>>> On Wednesday, January 13, 2016 at 4:23:11 PM UTC-5, Ron Chatterjee wrote:

 *Model:*

 db.define_table('mytable',
 Field('name', type='list:string',requires=IS_IN_SET 
 (('True','False')),
   widget=SQLFORM.widgets.checkboxes.widget))


 *Controller:*


 def index():
 variables = []
 form = SQLFORM(db.mytable).process()
 if form.accepted:
 #comments from that particular blog post
 variables = form.vars.name
 return dict(form = form,variables = variables )


 *View:*

 {{extend 'layout.html'}}
 {{=form}}
 {{=variables}}



 I can only output true or false. I want to select and output True and 
 False both. How?


 -- 
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> --- 
>> You received this message because you are 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.


Re: [web2py] Re: web3py

2016-01-14 Thread Alex
That sounds great, thanks Massimo! I also think 2) makes the most sense. 
Looking forward to using Python 3 ...

Alex

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


[web2py] Why is this code for attachment in the html email showing that static folder doesn't exist?

2016-01-14 Thread aston . ribat
attachments=mail.Attachment('static/hello.png',content_id='photo')

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

2016-01-14 Thread Massimo Di Pierro
There is no db.table.field.drop(). There is db.table.drop() which drops the 
entire table. 
Do not use crud. it is old.

On Thursday, 14 January 2016 16:29:18 UTC-6, Ron Chatterjee wrote:
>
> I haven't used crud for long time. I realize SQLFORM is the alternative. 
>  What would be the crud.update alternative for this example?
>
>
> @auth.requires_login()
> def project_edit():
> selected_project = db.Project(request.args(0)) or 
> redirect(URL('show_project'))
> form = crud.update(db.Project, selected_project, next = 
> 'show_project_summary/[id]')
> return locals()
>
>
> Same goes for crud.delete. Is it just db.table.field.drop()?
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group 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: Why is this code for attachment in the html email showing that static folder doesn't exist?

2016-01-14 Thread aston . ribat
Thanks Anthony, that really helped. I have asked a new question on how to 
put a background image to my body in the html email. Please help me out in 
that. 
Thanks,
Aston Ribat

On Friday, January 15, 2016 at 1:56:05 AM UTC+5:30, Anthony wrote:
>
> You need the full filesystem path. Try:
>
> import os
> attachments = mail.Attachment(os.path.join(request.folder, 'static', 
> 'hello.png'), content_id='photo')
>
> Anthony
>
> On Thursday, January 14, 2016 at 1:19:15 PM UTC-5, aston...@gmail.com 
>  wrote:
>>
>> attachments=mail.Attachment('static/hello.png',content_id='photo')
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group 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 put background-image in body of a html mail and not show the used image in attachment below?

2016-01-14 Thread aston . ribat
what's wrong in my code?

message=' body { 
background-image:"cid:photo"}Hi Astonyou have a new entry:%s and %s with percentage: 
%s' %( session.name1 , session.name2, 
str(session.percent)),
   attachments = 
mail.Attachment(os.path.join(request.folder, 'static', 'hello.png'), 
content_id='photo'))

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

2016-01-14 Thread Anthony

>
> If I don't use cache.ram dict123 is in globals() and function return the 
> else: part of the function...
>

What do you mean by "if I don't use cache.ram"? Are you saying you are 
using cache.disk, or no cache at all? If the latter, how is dict123 in 
globals() (i.e., where do you define it)?

Anthony

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


[web2py] Re: Error No module named copy_reg after upgrading web2py

2016-01-14 Thread Massimo Di Pierro
which python version? Did you upgrade anything else at the same time? 
copy_reg is a python module, not a web2py module and you should have it.

On Thursday, 14 January 2016 18:27:06 UTC-6, José Eloy wrote:
>
> Hi there!
>
> I upgraded my web2py source folder (2.9.6) with the most recent version 
> (2.13.4), but when I run my application I get the error: No module named 
> copy_reg. Mi app was running well before the upgrade. I´m runnig my app in 
> Windows Server 2008 R2. The upgrade was made using the administrative 
> interface and copy/paste the new version over the old version.
>
> How can I to fix this error?
>
> Regards.
>
> Sorry for my bad english!  I hope you can understand me.
>

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

2016-01-14 Thread Massimo Di Pierro
don't. On the youtube page there is a way to download an ... 
object containing the video. You should use that code instead of an iframe.

On Thursday, 14 January 2016 20:31:03 UTC-6, Hans Soflao wrote:
>
> I am trying to embed a youtube video into the view; I do not know why it 
> does not work at all; I thought it is as simple as just the following code:
>
>   http://www.youtube.com/blabla;>
>
>
> What is my error? 
> It looks like the view gets the fram but does not show the video at all.
>
> Does this need to be in the controller level? I was thinking whatever html 
> capability is out there web2py has them too.
>
> Thanks for the help
>

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


[web2py] How to not get the "confirm form submission" on reloading the page a form has?Whats error in my code

2016-01-14 Thread RAGHIB R
def hidefields():
form=SQLFORM(db.sample1)
if form.accepts(request.vars,session,formname="form"):
response.flash="added"
return locals()



{{extend 'layout.html'}}

jQuery(document).ready(function(){
jQuery('#sample1_one__row').hide();
});


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


[web2py] Re: Field Type Data

2016-01-14 Thread Dave S


On Thursday, January 14, 2016 at 8:17:14 AM UTC-8, Lorenzo Zonca wrote:
>
> Thank you, but my problem is not this.
>
> i need to calculate this syntax example:
>
> now is '14/01/2016' 
> I want to be converted automatically to the format 'wednesday  14/01/2016'
>
> simply calculate the day of week ( sunday - monday  ecc. )
>

Read the section about the "%" modifiers (which get wrapped in a T() 
helper, I believe).
This is basically Python strfrime() behavior, although the list in the book 
doesn't show %a or %A.

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


Re: [web2py] Re: Can website visitors update my languages files?

2016-01-14 Thread Anthony
On Thursday, January 14, 2016 at 6:32:43 PM UTC-5, mwolfe02 wrote:
>
> OK. So the framework is updating the languages files in my app based on 
> translations in other apps (e.g., admin and appadmin)? 
>

No, I shouldn't have mentioned admin. But appadmin is part of your app, so 
yes, strings in appadmin do contribute to the language files in your app. 
Translations in one app, however, do not affect those in others.

Anyway, my point was that the specific translations to which you were 
referring are provided with the web2py distribution (the link I included 
shows where those translations are in the .ru file of the welcome app) -- 
they are not generated dynamically. Those particular phrases are likely 
from appadmin, which is why they are included in the default translation 
files.

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] What's missing here in my code for the dialogue box to appear when user clicks 'submit' on the form?

2016-01-14 Thread aston . ribat
 jQuery('#people.submit').prop('onclick',if(!confirm("{{=T('Are you sure 
you want to add this object?')}}"this.submit=false);

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


[web2py] Re: What's missing here in my code for the dialogue box to appear when user clicks 'submit' on the form?

2016-01-14 Thread Niphlod
it misses lots of code. Sorry, you need to study jquery first.

Usually you'd need 

$(form).submit(function(e) {
 e.preventDefault();
 ..your form's management
})

On Friday, January 15, 2016 at 8:20:13 AM UTC+1, aston...@gmail.com wrote:
>
>  jQuery('#people.submit').prop('onclick',if(!confirm("{{=T('Are you sure 
> you want to add this object?')}}"this.submit=false);
>

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


[web2py] Re: Error No module named copy_reg after upgrading web2py

2016-01-14 Thread Niphlod
@jose: you're coming from a really really old version. Unfortunately the 
folder structure changed, so it's possible that overwriting left some files 
that shouldn't be there. Assuming you installed web2py in c:\web2py, please 
do the following:
- copy your applications/ dir (c:\web2py\applications) to somewhere safe 
(e.g. your desktop)
- delete everything in the web2py folder (leaving c:\web2py completely 
empty)
- download the latest version
- decompress the archive in the installation folder (so you have 
c:\web2py\web2py.py)
- copy your applications/ over, except welcome and admin

@massimo: he's probably in the same pickle other found themselves when 
upgrading for the different structure. IMHO "upgrade now" button needs to 
be dropped until a solid upgrade scheme is found: it has been discussed 
over and over and a decision was never made. Finally, we should really look 
into releasing web2py to pypi.

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


[web2py] Re: how to calculate size of uploads by user

2016-01-14 Thread Niphlod
it makes perfect sense: if 

if request.vars.contents

results always falsy, there's no way you can request.vars.contents.value.

Something smells fishy though: you can't NOT have a request variable 
holding your precious uploaded file.

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

2016-01-14 Thread Richard Vézina
There were widget plugins also for that : https://github.com/scubism/sqlabs

But these are really really old, and repo not have been update since 3
years...

The demo site seems not available any more...

Richard

On Thu, Jan 14, 2016 at 3:12 PM, Ron Chatterjee 
wrote:

> I have it like this:
>
>
> db.define_table('mytable',
> Field('name', type='list:string',requires=IS_IN_SET
> (('True','False', 'Neither'), multiple=True),
>   widget=lambda field, value:
> SQLFORM.widgets.checkboxes.widget(field, value, style='divs', label=True)))
>
>
>
> That gives me vertical placement. But you are right. That's the way to do
> it.
>
>
>
> On Thursday, January 14, 2016 at 1:40:25 PM UTC-5, Richard wrote:
>>
>> Looks about style parameters of SQLFORM.widget.checkbox there is
>> information about that if I remember... There is also _style attribute
>> where you can use 'divs'. Make sure you read about both attributes they are
>> differents and serve differents purposes...
>>
>> But with _style='divs' you should be able to displays everythings at you
>> which with CSS...
>>
>> Richard
>>
>> On Thu, Jan 14, 2016 at 1:23 PM, Ron Chatterjee 
>> wrote:
>>
>>> It does! Thank you Richard. Do you happen to know if I want to display
>>> the checkbox horizontally as oppose to vertically, how would I do that? I
>>> asked cuz if I have a table with other fields and I have 10 checkboxes to
>>> say, it will be better to present them horizontally than vertically.
>>> Regardless, thanks for your time on this. Appreciated.
>>>
>>>
>>>
>>> On Thursday, January 14, 2016 at 12:33:52 PM UTC-5, Richard wrote:

 multiple=True in IS_IN_SET() validator should help...

 Richard

 On Thu, Jan 14, 2016 at 11:57 AM, Ron Chatterjee 
 wrote:

> Where in the book I find this info?
>
>
> On Thursday, January 14, 2016 at 11:56:51 AM UTC-5, Ron Chatterjee
> wrote:
>>
>> Here is an example in picture.
>>
>>
>>
>> On Wednesday, January 13, 2016 at 4:23:11 PM UTC-5, Ron Chatterjee
>> wrote:
>>>
>>> *Model:*
>>>
>>> db.define_table('mytable',
>>> Field('name', type='list:string',requires=IS_IN_SET
>>> (('True','False')),
>>>   widget=SQLFORM.widgets.checkboxes.widget))
>>>
>>>
>>> *Controller:*
>>>
>>>
>>> def index():
>>> variables = []
>>> form = SQLFORM(db.mytable).process()
>>> if form.accepted:
>>> #comments from that particular blog post
>>> variables = form.vars.name
>>> return dict(form = form,variables = variables )
>>>
>>>
>>> *View:*
>>>
>>> {{extend 'layout.html'}}
>>> {{=form}}
>>> {{=variables}}
>>>
>>>
>>>
>>> I can only output true or false. I want to select and output True
>>> and False both. How?
>>>
>>>
>>> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are 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+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.
>

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

[web2py] Re: Can website visitors update my languages files?

2016-01-14 Thread Anthony
The first time a visitor requesting a particular language hits the app, any 
T() items not yet in the associated translation file will be added 
automatically for later translation.

Anthony

On Thursday, January 14, 2016 at 2:41:04 PM UTC-5, mwolfe02 wrote:
>
> I've got a live web2py application under Mercurial version control.  When 
> I did my latest commit, I noticed there were several changes to the 
> following two files (the Polish and Russian translation files):
>
> /languages/pl.py
> /languages/ru-ru.py
>
> I did not make these changes.  The changes look like they could be 
> legitimate and perhaps automated.  For example, here are the first few 
> lines of the ru-ru.py diff (I removed some characters and replaced them 
> with {...} to limit the amount of noise:
>
>
> @@ -1,87 +1,91 @@
> -# coding: utf8
> +# -*- coding: utf-8 -*-
>  {
> -'"update" is an optional expression like "field1=\'newvalue\'". You 
> cannot update or delete the results of a JOIN': 
> '"\xd0\x98\xd0{...}\xd1\x8c.',
> +'"update" is an optional expression like "field1=\'newvalue\'". You 
> cannot update or delete the results of a JOIN': '"Изм{...}ть.',
> +'%s rows deleted': '%s строк удалено',
> +'%s rows updated': '%s строк изменено',
>  '%Y-%m-%d': '%Y-%m-%d',
>  '%Y-%m-%d %H:%M:%S': '%Y-%m-%d %H:%M:%S',
>
>
> So what could have caused these changes?  Does web2py itself do something 
> that would cause this?  Google Translate?  Website visitors?  Apache?
>
> Are there security considerations I should be aware of?
>
> As far as I know, I have not done anything to modify the default 
> Translation behavior of my app.
>
> Thanks in advance to anyone who can enlighten me,
> Mike Wolfe
>

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


[web2py] Re: web2py is giving me wrong time when I am using request.now for datetime. How to get time a/c as GMT?

2016-01-14 Thread Gael Princivalle
Ok, thank you Massimo good information, I'll not use it anymore.
I tried it because I don't reach to set the datetime of my new webfaction 
server as I want.
I would like to have the Europe/Rome timezone (UTC+1).
Setting in .bashrc the timezone like that:
export TZ="/usr/share/zoneinfo/Europe/Rome"

At the ssh prompt I have the good timezone withthe date command.
In the app I've got the good timezone.
But sometimes in the administration interface no. I've the 
Australia/Adelaide that I've tried one time to set in .bashrc.

Does web2py have a sort of timezone memory? That's a stupid question but 
this problem make me crazy.

Il giorno mercoledì 13 gennaio 2016 06:05:22 UTC+1, Massimo Di Pierro ha 
scritto:
>
> That is why we do not use the built-in python localization functions in 
> web2py. They are not thread safe.
>
> On Tuesday, 12 January 2016 08:16:43 UTC-6, Niphlod wrote:
>>
>> this is not threadsafe. use utc and translate dates when presented to 
>> users.
>>
>> On Tuesday, January 12, 2016 at 12:41:44 PM UTC+1, Gael Princivalle wrote:
>>>
>>> You can set your timezone like that in your model:
>>>
>>> import os
>>>
>>> os.environ['TZ'] = 'Europe/Rome'
>>>
>>>
>>>

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

2016-01-14 Thread Michael Wolfe
That makes sense.  I guess my question is where do the translations
themselves come from?  For example, the following two lines were *added* to
the Russian translation file:

'%s rows deleted': '%s строк удалено',
'%s rows updated': '%s строк изменено',

I certainly did not add in the Cyrillic characters in the above lines.  So
where did they come from?

There are some lines that were just changed from their hex code to the
Unicode characters (e.g., "\xd0\x98\xd0\xb7\xd0\xbc" to "Изм").  That I can
understand.  It's the brand new translations that I was surprised by.
Could they be coming from the languages files in the example app?

Thanks,
Mike

On Thu, Jan 14, 2016 at 3:32 PM, Anthony  wrote:

> The first time a visitor requesting a particular language hits the app,
> any T() items not yet in the associated translation file will be added
> automatically for later translation.
>
> Anthony
>
>
> On Thursday, January 14, 2016 at 2:41:04 PM UTC-5, mwolfe02 wrote:
>>
>> I've got a live web2py application under Mercurial version control.  When
>> I did my latest commit, I noticed there were several changes to the
>> following two files (the Polish and Russian translation files):
>>
>> /languages/pl.py
>> /languages/ru-ru.py
>>
>> I did not make these changes.  The changes look like they could be
>> legitimate and perhaps automated.  For example, here are the first few
>> lines of the ru-ru.py diff (I removed some characters and replaced them
>> with {...} to limit the amount of noise:
>>
>>
>> @@ -1,87 +1,91 @@
>> -# coding: utf8
>> +# -*- coding: utf-8 -*-
>>  {
>> -'"update" is an optional expression like "field1=\'newvalue\'". You
>> cannot update or delete the results of a JOIN':
>> '"\xd0\x98\xd0{...}\xd1\x8c.',
>> +'"update" is an optional expression like "field1=\'newvalue\'". You
>> cannot update or delete the results of a JOIN': '"Изм{...}ть.',
>> +'%s rows deleted': '%s строк удалено',
>> +'%s rows updated': '%s строк изменено',
>>  '%Y-%m-%d': '%Y-%m-%d',
>>  '%Y-%m-%d %H:%M:%S': '%Y-%m-%d %H:%M:%S',
>>
>>
>> So what could have caused these changes?  Does web2py itself do something
>> that would cause this?  Google Translate?  Website visitors?  Apache?
>>
>> Are there security considerations I should be aware of?
>>
>> As far as I know, I have not done anything to modify the default
>> Translation behavior of my app.
>>
>> Thanks in advance to anyone who can enlighten me,
>> Mike Wolfe
>>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.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/46XERxrdvts/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.


Re: [web2py] simple update of an cache.ram python dict

2016-01-14 Thread Richard Vézina
Forget about last message I was making a mistake in my print statments

On Thu, Jan 14, 2016 at 3:40 PM, Richard Vézina  wrote:

> There is something I don't understand... I put a couple of print statments
> to see if my cached vars was in globals() and I discover that my var was
> never there...
>
> I am lost completly... If it pass throught my "if" my dict will be
> recreated each request...
>
> :(
>
> Richard
>
> On Thu, Jan 14, 2016 at 12:13 PM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>> Yes, this may be an option (update whole dict in Redis)... Mean time I
>> get rid of them, if I can succeed in that...
>>
>> :)
>>
>> Thanks Anthony.
>>
>> Richard
>>
>> On Thu, Jan 14, 2016 at 12:06 PM, Anthony  wrote:
>>
>>> On Thursday, January 14, 2016 at 11:12:12 AM UTC-5, Richard wrote:

 This is true for any other cache except cache.ram right?

>>>
>>> Right. cache.ram works because it doesn't have to pickle a Python object
>>> and put it into external storage (and therefore create a fresh copy of the
>>> stored object via unpickling at retrieval time). Rather, it simply stores a
>>> pointer to the existing Python object within the current Python process. Of
>>> course, this limits cache.ram to a single process, so if your app is being
>>> served by multiple processes, each will have its own version of cache.ram.
>>>
>>>
 If so, there is no gain with cache.redis the way I use it...

>>>
>>> Well, the gain with Redis is that it will actually work, though you will
>>> have to adjust your code to save the whole dictionary back to the cache
>>> upon update.
>>>
>>>
 @Anthony, are you sure about the issue with uwsgi/nginx and cache.ram
 dict update?

>>>
>>> I think so. You might try configuring uwsgi to run a single process with
>>> multiple threads instead of using multiple processes. Not sure how that
>>> will impact performance.
>>>
>>>
 I guess, I should start to look at how to get rid of these global dict
 while not degrading system performance. There surely place where I use
 these global vars that wouldn't suffer from a little query to the backend,
 but for grid where the performance was the greatest or simplifying code was
 acheive with those it will be difficult to stop using them...

>>>
>>> Is it really a problem to write the whole dictionary to Redis? How often
>>> are updates happening?
>>>
>>> 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] Re: How do I select and output multiple checkboxes

2016-01-14 Thread Richard Vézina
Looks about style parameters of SQLFORM.widget.checkbox there is
information about that if I remember... There is also _style attribute
where you can use 'divs'. Make sure you read about both attributes they are
differents and serve differents purposes...

But with _style='divs' you should be able to displays everythings at you
which with CSS...

Richard

On Thu, Jan 14, 2016 at 1:23 PM, Ron Chatterjee 
wrote:

> It does! Thank you Richard. Do you happen to know if I want to display the
> checkbox horizontally as oppose to vertically, how would I do that? I asked
> cuz if I have a table with other fields and I have 10 checkboxes to say, it
> will be better to present them horizontally than vertically. Regardless,
> thanks for your time on this. Appreciated.
>
>
>
> On Thursday, January 14, 2016 at 12:33:52 PM UTC-5, Richard wrote:
>>
>> multiple=True in IS_IN_SET() validator should help...
>>
>> Richard
>>
>> On Thu, Jan 14, 2016 at 11:57 AM, Ron Chatterjee 
>> wrote:
>>
>>> Where in the book I find this info?
>>>
>>>
>>> On Thursday, January 14, 2016 at 11:56:51 AM UTC-5, Ron Chatterjee wrote:

 Here is an example in picture.



 On Wednesday, January 13, 2016 at 4:23:11 PM UTC-5, Ron Chatterjee
 wrote:
>
> *Model:*
>
> db.define_table('mytable',
> Field('name', type='list:string',requires=IS_IN_SET
> (('True','False')),
>   widget=SQLFORM.widgets.checkboxes.widget))
>
>
> *Controller:*
>
>
> def index():
> variables = []
> form = SQLFORM(db.mytable).process()
> if form.accepted:
> #comments from that particular blog post
> variables = form.vars.name
> return dict(form = form,variables = variables )
>
>
> *View:*
>
> {{extend 'layout.html'}}
> {{=form}}
> {{=variables}}
>
>
>
> I can only output true or false. I want to select and output True and
> False both. How?
>
>
> --
>>> Resources:
>>> - http://web2py.com
>>> - http://web2py.com/book (Documentation)
>>> - http://github.com/web2py/web2py (Source code)
>>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>>> ---
>>> You received this message because you are 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.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group 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] SQLFORM.factory with exception: user is tampering with form's record_id: != None

2016-01-14 Thread Silvan Marco Fin
Hi!

I just upgraded web2py to 2.13.4, and now some of my SQLFORM.factory-forms 
stopped working as expected.
Upon submission of the data entered, I get an error:

 user is tampering with form's record_id: != 
None

here an example of code:

def get_some_input():
if ('my_data' in session):
my_data = session.my_data
else:
my_data = None
my_form = SQLFORM.factory(
Field('schnorg'),
record=my_data,
showid=False
)
if (my_form.process().accepted):
session.my_data = my_form.vars
redirect(URL(get_some_input))
return dict(my_form=my_form)

until I performed the update, most of my forms served well in retrieving 
user input code similar to given sample. Now in case session contains 
already my_data (e.g. previous submission) and the submit button is hit, 
the following error is reported:

Traceback (most recent call last):
  File "/home/silvan/local/web2py/gluon/restricted.py", line 227, in 
restricted
exec ccode in environment
  File 
"/home/silvan/local/web2py/applications/sff_sample/controllers/default.py", 
line 92, in 
  File "/home/silvan/local/web2py/gluon/globals.py", line 412, in 
self._caller = lambda f: f()
  File 
"/home/silvan/local/web2py/applications/sff_sample/controllers/default.py", 
line 77, in get_some_input
if (my_form.process().accepted):
  File "/home/silvan/local/web2py/gluon/html.py", line 2304, in process
self.validate(**kwargs)
  File "/home/silvan/local/web2py/gluon/html.py", line 2241, in validate
if self.accepts(**kwargs):
  File "/home/silvan/local/web2py/gluon/sqlhtml.py", line 1559, in accepts
'%s != %s' % (record_id, self.record_id))
SyntaxError: user is tampering with form's record_id:  != None

I found some changes to gluon/sqlhtml.py in 
commit 948bd0c6715ff56ab6898b02cafaa827cb3e6ba2, that may be related to 
this problem. I would appreciate, if someone with more knowledge of this 
code than me would take a look into the problem.

 Kind regards,
  Silvan

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

2016-01-14 Thread José Ricardo Borba
@Ron and @Alex,

I read this in the last line of Massimo's message:
"Feel free to share your opinion on *web2py developers*."

;-)))

Best Regards,

2016-01-14 16:59 GMT-02:00 Alex :

> That sounds great, thanks Massimo! I also think 2) makes the most sense.
> Looking forward to using Python 3 ...
>
> Alex
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
José Ricardo Borba

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

2016-01-14 Thread mwolfe02
I've got a live web2py application under Mercurial version control.  When I 
did my latest commit, I noticed there were several changes to the following 
two files (the Polish and Russian translation files):

/languages/pl.py
/languages/ru-ru.py

I did not make these changes.  The changes look like they could be 
legitimate and perhaps automated.  For example, here are the first few 
lines of the ru-ru.py diff (I removed some characters and replaced them 
with {...} to limit the amount of noise:


@@ -1,87 +1,91 @@
-# coding: utf8
+# -*- coding: utf-8 -*-
 {
-'"update" is an optional expression like "field1=\'newvalue\'". You cannot 
update or delete the results of a JOIN': '"\xd0\x98\xd0{...}\xd1\x8c.',
+'"update" is an optional expression like "field1=\'newvalue\'". You cannot 
update or delete the results of a JOIN': '"Изм{...}ть.',
+'%s rows deleted': '%s строк удалено',
+'%s rows updated': '%s строк изменено',
 '%Y-%m-%d': '%Y-%m-%d',
 '%Y-%m-%d %H:%M:%S': '%Y-%m-%d %H:%M:%S',


So what could have caused these changes?  Does web2py itself do something 
that would cause this?  Google Translate?  Website visitors?  Apache?

Are there security considerations I should be aware of?

As far as I know, I have not done anything to modify the default 
Translation behavior of my app.

Thanks in advance to anyone who can enlighten me,
Mike Wolfe

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group 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.factory with exception: user is tampering with form's record_id: != None

2016-01-14 Thread Anthony
Looks like the way you were using it before wasn't supposed to work but did 
due to a bug. The purpose of the "record" argument is to enable a database 
record to be updated, and so it is expected that the record will have an 
"id" field (or a set of fields serving as a primary key). It appears you 
are instead using the "record" argument as a way of pre-filling the form 
with a set of previously used values. In that case, you should add a dummy 
"id" field to session.mydata (it shouldn't matter what value you assign to 
it, as it doesn't refer to a real record). Alternatively, you could use the 
values in session.mydata to set default values in the SQLFORM.factory 
fields.

Anthony

On Thursday, January 14, 2016 at 2:05:37 PM UTC-5, Silvan Marco Fin wrote:
>
> Hi!
>
> I just upgraded web2py to 2.13.4, and now some of my SQLFORM.factory-forms 
> stopped working as expected.
> Upon submission of the data entered, I get an error:
>
>  user is tampering with form's record_id: 
> != None
>
> here an example of code:
>
> def get_some_input():
> if ('my_data' in session):
> my_data = session.my_data
> else:
> my_data = None
> my_form = SQLFORM.factory(
> Field('schnorg'),
> record=my_data,
> showid=False
> )
> if (my_form.process().accepted):
> session.my_data = my_form.vars
> redirect(URL(get_some_input))
> return dict(my_form=my_form)
>
> until I performed the update, most of my forms served well in retrieving 
> user input code similar to given sample. Now in case session contains 
> already my_data (e.g. previous submission) and the submit button is hit, 
> the following error is reported:
>
> Traceback (most recent call last):
>   File "/home/silvan/local/web2py/gluon/restricted.py", line 227, in 
> restricted
> exec ccode in environment
>   File 
> "/home/silvan/local/web2py/applications/sff_sample/controllers/default.py", 
> line 92, in 
>   File "/home/silvan/local/web2py/gluon/globals.py", line 412, in 
> self._caller = lambda f: f()
>   File 
> "/home/silvan/local/web2py/applications/sff_sample/controllers/default.py", 
> line 77, in get_some_input
> if (my_form.process().accepted):
>   File "/home/silvan/local/web2py/gluon/html.py", line 2304, in process
> self.validate(**kwargs)
>   File "/home/silvan/local/web2py/gluon/html.py", line 2241, in validate
> if self.accepts(**kwargs):
>   File "/home/silvan/local/web2py/gluon/sqlhtml.py", line 1559, in accepts
> '%s != %s' % (record_id, self.record_id))
> SyntaxError: user is tampering with form's record_id:  != None
>
> I found some changes to gluon/sqlhtml.py in 
> commit 948bd0c6715ff56ab6898b02cafaa827cb3e6ba2, that may be related to 
> this problem. I would appreciate, if someone with more knowledge of this 
> code than me would take a look into the problem.
>
>  Kind regards,
>   Silvan
>
>

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

2016-01-14 Thread Ron Chatterjee
I have it like this:


db.define_table('mytable',
Field('name', type='list:string',requires=IS_IN_SET 
(('True','False', 'Neither'), multiple=True),
  widget=lambda field, value: 
SQLFORM.widgets.checkboxes.widget(field, value, style='divs', label=True)))



That gives me vertical placement. But you are right. That's the way to do 
it.

 

On Thursday, January 14, 2016 at 1:40:25 PM UTC-5, Richard wrote:
>
> Looks about style parameters of SQLFORM.widget.checkbox there is 
> information about that if I remember... There is also _style attribute 
> where you can use 'divs'. Make sure you read about both attributes they are 
> differents and serve differents purposes...
>
> But with _style='divs' you should be able to displays everythings at you 
> which with CSS...
>
> Richard
>
> On Thu, Jan 14, 2016 at 1:23 PM, Ron Chatterjee  > wrote:
>
>> It does! Thank you Richard. Do you happen to know if I want to display 
>> the checkbox horizontally as oppose to vertically, how would I do that? I 
>> asked cuz if I have a table with other fields and I have 10 checkboxes to 
>> say, it will be better to present them horizontally than vertically. 
>> Regardless, thanks for your time on this. Appreciated.
>>
>>  
>>
>> On Thursday, January 14, 2016 at 12:33:52 PM UTC-5, Richard wrote:
>>>
>>> multiple=True in IS_IN_SET() validator should help...
>>>
>>> Richard
>>>
>>> On Thu, Jan 14, 2016 at 11:57 AM, Ron Chatterjee  
>>> wrote:
>>>
 Where in the book I find this info?  


 On Thursday, January 14, 2016 at 11:56:51 AM UTC-5, Ron Chatterjee 
 wrote:
>
> Here is an example in picture.
>
>
>
> On Wednesday, January 13, 2016 at 4:23:11 PM UTC-5, Ron Chatterjee 
> wrote:
>>
>> *Model:*
>>
>> db.define_table('mytable',
>> Field('name', type='list:string',requires=IS_IN_SET 
>> (('True','False')),
>>   widget=SQLFORM.widgets.checkboxes.widget))
>>
>>
>> *Controller:*
>>
>>
>> def index():
>> variables = []
>> form = SQLFORM(db.mytable).process()
>> if form.accepted:
>> #comments from that particular blog post
>> variables = form.vars.name
>> return dict(form = form,variables = variables )
>>
>>
>> *View:*
>>
>> {{extend 'layout.html'}}
>> {{=form}}
>> {{=variables}}
>>
>>
>>
>> I can only output true or false. I want to select and output True and 
>> False both. How?
>>
>>
>> -- 
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 --- 
 You received this message because you are 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+un...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

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


[web2py] Re: Why is this code for attachment in the html email showing that static folder doesn't exist?

2016-01-14 Thread Anthony
You need the full filesystem path. Try:

import os
attachments = mail.Attachment(os.path.join(request.folder, 'static', 
'hello.png'), content_id='photo')

Anthony

On Thursday, January 14, 2016 at 1:19:15 PM UTC-5, aston.ri...@gmail.com 
wrote:
>
> attachments=mail.Attachment('static/hello.png',content_id='photo')
>

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

2016-01-14 Thread Richard Vézina
There is something I don't understand... I put a couple of print statments
to see if my cached vars was in globals() and I discover that my var was
never there...

I am lost completly... If it pass throught my "if" my dict will be
recreated each request...

:(

Richard

On Thu, Jan 14, 2016 at 12:13 PM, Richard Vézina <
ml.richard.vez...@gmail.com> wrote:

> Yes, this may be an option (update whole dict in Redis)... Mean time I get
> rid of them, if I can succeed in that...
>
> :)
>
> Thanks Anthony.
>
> Richard
>
> On Thu, Jan 14, 2016 at 12:06 PM, Anthony  wrote:
>
>> On Thursday, January 14, 2016 at 11:12:12 AM UTC-5, Richard wrote:
>>>
>>> This is true for any other cache except cache.ram right?
>>>
>>
>> Right. cache.ram works because it doesn't have to pickle a Python object
>> and put it into external storage (and therefore create a fresh copy of the
>> stored object via unpickling at retrieval time). Rather, it simply stores a
>> pointer to the existing Python object within the current Python process. Of
>> course, this limits cache.ram to a single process, so if your app is being
>> served by multiple processes, each will have its own version of cache.ram.
>>
>>
>>> If so, there is no gain with cache.redis the way I use it...
>>>
>>
>> Well, the gain with Redis is that it will actually work, though you will
>> have to adjust your code to save the whole dictionary back to the cache
>> upon update.
>>
>>
>>> @Anthony, are you sure about the issue with uwsgi/nginx and cache.ram
>>> dict update?
>>>
>>
>> I think so. You might try configuring uwsgi to run a single process with
>> multiple threads instead of using multiple processes. Not sure how that
>> will impact performance.
>>
>>
>>> I guess, I should start to look at how to get rid of these global dict
>>> while not degrading system performance. There surely place where I use
>>> these global vars that wouldn't suffer from a little query to the backend,
>>> but for grid where the performance was the greatest or simplifying code was
>>> acheive with those it will be difficult to stop using them...
>>>
>>
>> Is it really a problem to write the whole dictionary to Redis? How often
>> are updates happening?
>>
>> 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] simple update of an cache.ram python dict

2016-01-14 Thread Richard Vézina
Hello Simone,

Thanks to jump in this thread... I understand what you say... The thing is
I need this dict to be global and I though it could be more clean to have
these dict create and update by the same function.

So, my main issue with both cache.ram and cache.redis is that new id
representation never get added to the dict "permanently". In case of
cache.ram, the issue may come from what Anthony explain because I use
uwsgi/nginx. But I have made some test with redis and the issue still
there, but may still be there for a differents reasons, I don't know. I
mean if I update the Redis cached dict from shell, and I try to retrieve
the representation passing the key to the dict it works, but it looks like
this only works in shell. In case of Redis, I may have to recompute the
whole dict base on what you explain, which will not provide any performance
improvement if it the case, because what I try to prevent it exactly the
creation of the dictionary which requires a lot of computing for nothing
each time a new record get created. There maybe something I don't
understand about how to refresh Redis cache or in what you explained.



On Wed, Jan 13, 2016 at 4:56 PM, Niphlod  wrote:

> errata corrige on BTW2: on redis, time_expire=None results in key stored
> at most one day. you can always do time_expire=30*24*60*60 for 30days worth.
>
> things_to_know: only cache.disk and cache.ram can effectively cache a
> value indefinitely and enable that strange behaviour of retrieving the
> previously cached element - that you marked to expire after 5 seconds - one
> day later.
> Web2py's cache API is effectively incompatible with any high-performance
> caching system, unless the user calls upon himself the burden of clearing
> the cache regularly (which is never the case because cache invalidation is
> one of the hardest things to master).
> Both memcache and redis take a more strict behaviour, i.e. the value will
> effectively expire at the time it was set on the first time. So, you can
> only fetch a cached value one day later if you originally marked it as
> expiring one day later. Redis allows a leeway of 120 seconds to accomodate
> the 90% of the behavioural usecases of cache.ram and cache.disk.
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group 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] Re: multiple instances of a single form on one page

2016-01-14 Thread Anthony
Are you wanting the user to fill all forms and submit them at once, submit 
one form at a time (but remaining on the same page in order to submit 
additional forms), or just submit one of the many forms and then have the 
page reload/redirect?

On Wednesday, January 13, 2016 at 11:58:02 AM UTC-5, aetagot...@gmail.com 
wrote:
>
> I'm not sure if this is even possible, but if it is..how would something 
> like this work:
>
> You prompt the user for an x amount of days, then with javascript and 
> jquery you have x amount of buttons appear. Each button is an instance of 
> the form. There is a variable within the javascript that holds the amount 
> x. So for each instance of x, the user fills out the same form but with 
> different values for each day. In the db module containing the sqlform, 
> there is a function that takes in each instance and performs what it needs 
> to for each separate instance.
>
> Also, if you are in views, how can you share a variable that is used in a 
> script to python code in the same views, or in the db models file?
>

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

2016-01-14 Thread Richard Vézina
Hello Ron,

I think what you ask may be possible, but I think the discussion is stock
at a privous stage... Also, try to go read the whole thread on
web2py-developpers group as Massimo's mention to not split this
discussion...

Richard

On Thu, Jan 14, 2016 at 9:35 AM, Ron Chatterjee 
wrote:

> Can there be some sought of converter that that takes a .w2p file and
> spits out .w3p file? I bet its lot of work and testing requires. I am sure
> it cant b 100% accurate prolly.
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group 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] Re: How do I select and output multiple checkboxes

2016-01-14 Thread Ron Chatterjee
Where in the book I find this info?  

On Thursday, January 14, 2016 at 11:56:51 AM UTC-5, Ron Chatterjee wrote:
>
> Here is an example in picture.
>
>
>
> On Wednesday, January 13, 2016 at 4:23:11 PM UTC-5, Ron Chatterjee wrote:
>>
>> *Model:*
>>
>> db.define_table('mytable',
>> Field('name', type='list:string',requires=IS_IN_SET 
>> (('True','False')),
>>   widget=SQLFORM.widgets.checkboxes.widget))
>>
>>
>> *Controller:*
>>
>>
>> def index():
>> variables = []
>> form = SQLFORM(db.mytable).process()
>> if form.accepted:
>> #comments from that particular blog post
>> variables = form.vars.name
>> return dict(form = form,variables = variables )
>>
>>
>> *View:*
>>
>> {{extend 'layout.html'}}
>> {{=form}}
>> {{=variables}}
>>
>>
>>
>> I can only output true or false. I want to select and output True and 
>> False both. How?
>>
>>
>>

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


[web2py] Re: web3py

2016-01-14 Thread Pbop
Sounds like you have a good approach with option 2. That is my vote! You 
can't get around that once a decision is made the community will react with 
some degrees of enthusiasm and pushback. 

I am curious if the increase in performance is based on a more efficient 
algorithm, Python3 is doing things faster or both?

Keep up the good work. 



On Thursday, January 14, 2016 at 12:35:36 AM UTC-5, Massimo Di Pierro wrote:
>
> It is another experiment.
>
> It is a rewrite of some of the web2py modules and supports 90% of the 
> current web2py syntax at 2.5x the speed. It works. It it cleaner and should 
> be easier to port to python 3 than current web2py. 
>
> We are debating on web2py developers what to do:
> 1) backport some of the new modules to web2py (specifically the new Form 
> class instead of SQLFORM)
> 2) try to reach a 99.9% compatibility and release it as new major version 
> with guidelines for porting legacy apps
> 3) make some drastic changes in backward compatibility and release as a 
> different framework (but change what? we like web2py as it is)
>
> For now I am working on 2 to see how far I can push the backward 
> compatibility. But there are some functionalities I want remove or move in 
> an optional module (from legacy_web2py import *).
>
> Feel free to share your opinion on web2py developers.
>
> Massimo
>
>
> On Wed, Jan 13, 2016 at 11:04 PM, kelson _  > wrote:
>
>> I was looking at your recent web3py commits and hoped you could provide 
>> the web3py vision/intent (or point me towards it if I missed the 
>> discussion).
>>
>> Thanks,
>> kelson
>>
>
>

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