[web2py] Re: How to rename the Edit and View button of SQLFORM.GRID

2015-05-04 Thread Sarbjit
I am able to do it using the below code :

grid = SQLFORM.GRID(...)
try:
for x in grid.elements('span.buttontext'):
if x.components[0] == "Edit":
x.components[0] = "New Edit"
if x.components[0] == "View":
x.components[0] = "New View"
except Exception : pass

Is there any better way to do 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] Sublime Text web2py plugin

2015-05-04 Thread Gergely Orosz
Hi 4 All,

I've started to develop a web2py plugin for Sublime Text 3.
I've implemented a few command I found very useful on my daily work.
If you have any idea how can I make it better and useful please visit the 
below link and submit your feature request there
Thanks in advance

You can find the plugin: https://bitbucket.org/kfog/w2p

If you have any question please feel free to ask here or on the Issue 
tracker

All the best
Greg

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

2015-05-04 Thread Paolo Valleri
It should be fixed in trunk

Paolo

On Saturday, May 2, 2015 at 1:24:32 PM UTC+2, José Borba wrote:
>
> OK.
> Thank you very much again.
>
> Cheers.
>
> 2015-05-02 8:22 GMT-03:00 Paolo Valleri 
> >:
>
>> Open an issue to don't forget it,I'll fix it in the next few days
>>
>> Paolo
>> On May 2, 2015 1:18 PM, "José Ricardo Borba" > > wrote:
>>
>>> Paolo,
>>>
>>> Thank you for you quickly response. But I'm working with the latest 
>>> web2py/Pydal 2.10.4 (downloaded 2.10.3 and updated). I forgot to mention 
>>> this. I'm sorry.
>>>
>>> My second bet is that the parser of time (the time_itens above) need to 
>>> be modified to work with time in mongo,
>>>
>>> Still not knowing what is the correct "bug" (if there are one) to report.
>>>
>>> Cheers,
>>>
>>>
>>> 2015-05-02 4:23 GMT-03:00 Paolo Valleri >> >:
>>>
 Hi, try use the latest version of pydal, Mongo adapter has been 
 recently updated to work with pymongo 3.0
 However, I think this is a bug. Can you open a bug report on 
 https://github.com/web2py/pydal

 Paolo


 On Saturday, May 2, 2015 at 3:58:13 AM UTC+2, José Borba wrote:
>
> Hi 4 All,
>
> I'm new to mongoDB and still having some problems with a TIME field. 
> When I set a TIME field in the table, fill the input field of a sqlform 
> (only time is allowed) and send the data to table, all the record is 
> inserted without any warning. But when I try to show in the sqlform, I 
> receive a message:
>
> 
> 
>   Traceback (most recent call last):
>   File "/home/xxx.../applications/ras/controllers/appadmin.py", line 
> 269, in select
> *fields, limitby=(start, stop))
>   File "/home/xxx.../gluon/packages/dal/pydal/objects.py", line 2026, 
> in select
> return adapter.select(self.query,fields,attributes)
>   File "/home/xxx.../gluon/packages/dal/pydal/adapters/mongo.py", line 
> 353, in select
> result = processor(rows, fields, newnames, False)
>   File "/home/xxx.../gluon/packages/dal/pydal/adapters/base.py", line 
> 1596, in parse
> value = self.parse_value(value,ft,blob_decode)
>   File "/home/xxx.../gluon/packages/dal/pydal/adapters/base.py", line 
> 1450, in parse_value
> return self.parsemap[key](value,field_type)
>   File "/home/xxx.../gluon/packages/dal/pydal/adapters/base.py", line 
> 1472, in parse_time
> time_items = map(int,str(value)[:8].strip().split(':')[:3])
> ValueError: invalid literal for int() with base 10: '2000-01-'
> 
>  
>
> Trying to understand what happened, I'm googled for some info, and 
> found the Mongo adapter code (yes, I didn't tried in my own computer).
>
> Reading the code (in pydal/adapters/mongo.py), I see a (possible) 
> clue: The lines 148 to 163 is, in some way, weird for my reading. Maybe I 
> misunderstood some point, but this
>
> 
> 
> t = datetime.time(0,0,0)
> 
>  
>
> is a formatter for a field type DATE, and this 
>
> 
> 
> t = datetime.date(2000,1,1)
> 
>  
>
> is a formatter for a field type TIME ?
>
> Best regards, and keep going the invaluable work with this framework.
>
> -- 
> 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+un...@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 a topic in the 
>>> Google Groups "web2py-users" group.
>>> To unsubscribe from this topic, visit 
>>> https://groups.google.com/d/topic/web2py/c8JpvzBHGhE/unsubscribe.
>>> To unsubscribe from this group and all its topics, 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://group

Re: [web2py] Re: MongoDB adapter

2015-05-04 Thread Ron Chatterjee
What is mongodb adapter? Where do I find that info?

On Monday, May 4, 2015 at 8:39:48 AM UTC-4, Paolo Valleri wrote:
>
> It should be fixed in trunk
>
> Paolo
>
> On Saturday, May 2, 2015 at 1:24:32 PM UTC+2, José Borba wrote:
>>
>> OK.
>> Thank you very much again.
>>
>> Cheers.
>>
>> 2015-05-02 8:22 GMT-03:00 Paolo Valleri :
>>
>>> Open an issue to don't forget it,I'll fix it in the next few days
>>>
>>> Paolo
>>> On May 2, 2015 1:18 PM, "José Ricardo Borba"  wrote:
>>>
 Paolo,

 Thank you for you quickly response. But I'm working with the latest 
 web2py/Pydal 2.10.4 (downloaded 2.10.3 and updated). I forgot to mention 
 this. I'm sorry.

 My second bet is that the parser of time (the time_itens above) need to 
 be modified to work with time in mongo,

 Still not knowing what is the correct "bug" (if there are one) to 
 report.

 Cheers,


 2015-05-02 4:23 GMT-03:00 Paolo Valleri :

> Hi, try use the latest version of pydal, Mongo adapter has been 
> recently updated to work with pymongo 3.0
> However, I think this is a bug. Can you open a bug report on 
> https://github.com/web2py/pydal
>
> Paolo
>
>
> On Saturday, May 2, 2015 at 3:58:13 AM UTC+2, José Borba wrote:
>>
>> Hi 4 All,
>>
>> I'm new to mongoDB and still having some problems with a TIME field. 
>> When I set a TIME field in the table, fill the input field of a sqlform 
>> (only time is allowed) and send the data to table, all the record is 
>> inserted without any warning. But when I try to show in the sqlform, I 
>> receive a message:
>>
>> 
>> 
>>   Traceback (most recent call last):
>>   File "/home/xxx.../applications/ras/controllers/appadmin.py", line 
>> 269, in select
>> *fields, limitby=(start, stop))
>>   File "/home/xxx.../gluon/packages/dal/pydal/objects.py", line 2026, 
>> in select
>> return adapter.select(self.query,fields,attributes)
>>   File "/home/xxx.../gluon/packages/dal/pydal/adapters/mongo.py", 
>> line 353, in select
>> result = processor(rows, fields, newnames, False)
>>   File "/home/xxx.../gluon/packages/dal/pydal/adapters/base.py", line 
>> 1596, in parse
>> value = self.parse_value(value,ft,blob_decode)
>>   File "/home/xxx.../gluon/packages/dal/pydal/adapters/base.py", line 
>> 1450, in parse_value
>> return self.parsemap[key](value,field_type)
>>   File "/home/xxx.../gluon/packages/dal/pydal/adapters/base.py", line 
>> 1472, in parse_time
>> time_items = map(int,str(value)[:8].strip().split(':')[:3])
>> ValueError: invalid literal for int() with base 10: '2000-01-'
>> 
>>  
>>
>> Trying to understand what happened, I'm googled for some info, and 
>> found the Mongo adapter code (yes, I didn't tried in my own computer).
>>
>> Reading the code (in pydal/adapters/mongo.py), I see a (possible) 
>> clue: The lines 148 to 163 is, in some way, weird for my reading. Maybe 
>> I 
>> misunderstood some point, but this
>>
>> 
>> 
>> t = datetime.time(0,0,0)
>> 
>>  
>>
>> is a formatter for a field type DATE, and this 
>>
>> 
>> 
>> t = datetime.date(2000,1,1)
>> 
>>  
>>
>> is a formatter for a field type TIME ?
>>
>> Best regards, and keep going the invaluable work with this framework.
>>
>> -- 
>> 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+un...@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 a topic in the 
 Google Groups "web2py-users" group.
 To unsubscribe from this topic, visit 
 https://groups.google.com/d/topic/web2py/c8JpvzBHGhE/unsubscribe.
 To unsubscribe from this group and all its topics, 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)
>>> 

[web2py] Re: How to rename the Edit and View button of SQLFORM.GRID

2015-05-04 Thread Anthony
You can also search directly for the specific buttons:

grid.elements('span[title=%s]' % T('View'))

Note, the above will work even if you change the button classes (e.g., if 
you switch to a different UI style).

So, to do it in one line:

[button.__setitem__(0, 'New View') for button in grid.elements(
'span[title=%s]' % T('View'))]

Alternatively, you can create your own buttons using the "links" ar
Anthony

On Monday, May 4, 2015 at 4:37:39 AM UTC-4, Sarbjit wrote:
>
> I am able to do it using the below code :
>
> grid = SQLFORM.GRID(...)
> try:
> for x in grid.elements('span.buttontext'):
> if x.components[0] == "Edit":
> x.components[0] = "New Edit"
> if x.components[0] == "View":
> x.components[0] = "New View"
> except Exception : pass
>
> Is there any better way to do 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.


Re: [web2py] delete session value that store query as_list()

2015-05-04 Thread Johann Spies
On 1 May 2015 at 10:44, 黄祥  wrote:


>
> the problem is if i just use one all value that store in session detail is
> not deleted all, always remain i=1, so that i must take two steps for that.
> is it the correct way to handle it in web2py?
>
>
I see Session() is as Storage object and with a storage object you can do:

  >>> o = Storage(a=1)
>>> print o.a
1

>>> o['a']
1

>>> o.a = 2
>>> print o['a']
2

>>> del o.a
>>> print o.a
None


Regards
Johann
-- 
Because experiencing your loyal love is better than life itself,
my lips will praise you.  (Psalm 63:3)

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

2015-05-04 Thread Christophe Meessen
I'm using queue_task to execute a task once at a predefined time. The task 
itself calls queue_task when it finished executing itself to submit it self 
for a later execution at a predefined time. I'm currently testing it so I 
call web2p directly with the shell to check output. 

This all works as expected and an entry is created in the scheduler_task 
table. When the task completes its status becomes COMPLETE and a new task 
is queued and executed at the predefined time (approximately).

My problem is that the table scheduler_run remains empty. So I can't see 
the output of the task. It was filled during initial development tests. 

Is there a way to see logs of worker processes ? I couldn't find any. The 
logs directory of web2py is empty. 


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


[web2py] list:string on GAE breaks web2py's db admin tool

2015-05-04 Thread michael . c . mcclain


I've started using a list:string field on the auth_user model.

I'm running web2py on GAE with the datastore.


I noticed web2py's admin tool started crashing on this page 
appadmin/select/db?query=db.auth_user.id>0


looking at the console I found:


/gluon/dal.py", line 10035, in 

return ', '.join(str(y) for y in x or [])

UnicodeEncodeError: 'ascii' codec can't encode character u'\xe1' in position 1: 
ordinal not in range(128)

It seems web2py is not properly handling the datastore string list property. 

I fixed the problem by adding .encoding("utf8") to the dal.py function below:

def list_represent(x, r=None):
#return ', '.join(str(y) for y in x or [])
return ', '.join(str(y.encode("utf8")) for y in x or [])


Has anybody else experienced the same error?


tks

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

2015-05-04 Thread Tom Stratton
Hi -

I've had several unicode issues pop up with postgres and pydal in the last 
couple of weeks - it may be a version issue.

What versions of web2py and pydal are you using, what database adapter, and 
what - specifically - is giving you the crash?

Is the problem when you try to read from the db or only when you write to 
it? What is the stack track?

The more info you provide the more likely you are to get help ;-)

Tom

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

2015-05-04 Thread Ruslan Gareev
Hi, i have the same error, when I register user with ciryllic(Russian) 
chars in name. 
My config is: PgSQL 9.3. base in UTF-8. Web2py version is 2.10.3. Ubuntu 
14.04.

среда, 29 апреля 2015 г., 0:31:53 UTC+5 пользователь mcm написал:
>
> One more check... is the encoding of the database UTF-8?
> you can check with psql -l
>
>
> 2015-04-27 19:01 GMT+02:00 >:
>
>> > which postgresql Version?
>>
>> PSQL 9.3.6 @ Ubuntu 14.04.2 LTS
>>
>> In the meantime, I played around with pgadmin a little bit:
>>
>> 1) Using pgadmin I can create records containing 'ἀγοραζε' (the sample 
>> above) or German Umlaute ä, ö, ü, so it's definetly no database problem.
>>
>> 2) Going to Appadmin 
>> https://testmachine/testapp/appadmin/select/db?query=db.test.id%3E0 displays 
>> the records without Problem
>>
>> 3) As soon as I edit and save, I'll get a
>>  'ascii' codec can't decode byte 
>> 0xe1 in position 114: ordinal not in range(128)
>>
>>
>> Traceback (most recent call last):
>>   File "/home/www-data/web2py/gluon/restricted.py", line 227, in 
>> restricted
>> exec ccode in environment
>>   File 
>> "/home/www-data/web2py/applications/testapp/controllers/appadmin.py", line 
>> 704, in 
>>   File "/home/www-data/web2py/gluon/globals.py", line 393, in 
>> self._caller = lambda f: f()
>>   File 
>> "/home/www-data/web2py/applications/testapp/controllers/appadmin.py", line 
>> 343, in update
>> if form.accepts(request.vars, session):
>>   File "/home/www-data/web2py/gluon/sqlhtml.py", line 1677, in accepts
>> if pk:
>>   File "/home/www-data/web2py/gluon/packages/dal/pydal/objects.py", line 
>> 2117, in update
>> uploadfolder = pjoin(
>>   File "/home/www-data/web2py/gluon/packages/dal/pydal/adapters/base.py", 
>> line 988, in update
>> raise e
>> UnicodeDecodeError: 'ascii' codec can't decode byte 0xe1 in position 114: 
>> ordinal not in range(128)
>>
>>
>>
>>
>>
>> Am Sonntag, 26. April 2015 15:27:06 UTC+2 schrieb Massimo Di Pierro:
>>
>>> which postgresql version? I am failing to reproduce this.
>>>
>>> On Saturday, 25 April 2015 10:28:07 UTC-5, bodob...@gmail.com wrote:

 Hey guys,

 2.10.3 doesn't seem ready for prime time :-( In fact this bug makes 
 2.10.3 unusable for postgres users with need for non ASCII-characters..

 For reference let's link to the corresponding issue here too: 
 https://github.com/web2py/web2py/issues/910

 Is there any solution yet?

 Bodo

 Am Samstag, 11. April 2015 16:38:13 UTC+2 schrieb Ian W. Scott:

> Thanks Richard. My production server is working fine with 2.9.11. I'll 
> open an issue on the web2py github repo, since it sounds like that's the 
> better forum for this.
>
> Ian
>
>
> On Friday, April 10, 2015 at 3:40:16 PM UTC-4, Richard wrote:
>>
>> Ok, ok, I guess there is an issue with web2py or pyDAL... Can you 
>> test this with an earlier version of web2py? If it works consider open 
>> an 
>> issue in web2py on github with condition to reproduce the error and if 
>> it 
>> coming form pyDAL the issue will be migrate to pyDAL repo once the 
>> origin 
>> of the issue is found.
>>
>> Richard
>>
>> On Fri, Apr 10, 2015 at 3:24 PM, Ian W. Scott  
>> wrote:
>>
>>> Also, as I pointed out in my question I can insert the same string 
>>> (with the same encoding) directly into the postgre database using the 
>>> raw 
>>> SQL code that is being sent by pydal to the postgre adapter. I inserted 
>>> a 
>>> print statement into adapters/base.py to give me the exact SQL command, 
>>> copied that SQL command (data and all), then ran it in pgAdmin with no 
>>> problem. So it can't be a problem with the encoding of the string being 
>>> received by the pydal.
>>>
>>> Ian
>>>
>>> On Friday, April 10, 2015 at 2:05:25 PM UTC-4, Richard wrote:

 Can you please show the code that lead to this error?

 If you hard code this you can't use a regular string (str()) which 
 is ascii characters only you have to pass by unicode something like 
 this :

 string = u'ἀγοραζε'.decode(utf-8)

 http://stackoverflow.com/questions/6289474/working-
 with-utf-8-encoding-in-python-source

 If the greek character come form user input web2py deal with this 
 to my knowledge... So I am pretty sure you hard code greek character 
 in 
 your code... So you need to read about encoding in python...

 Richard



 On Fri, Apr 10, 2015 at 1:29 PM, Ian W. Scott  
 wrote:

> Hi folks,
>
> I'm running into an error with 2.10.3 when I try to write unicode 
> text (outside the Latin ranges) to a regular string field in a 
> postgre 
> database. Since my app is a greek language-le

[web2py] Re: Any problem in list:reference in 2.10 ?

2015-05-04 Thread wish7code
Hi Paolo,

> Can you try to replace the failing line with if db._adapter.dbengine == 
'google:datastore'
Solved the issue for me, only the colon at end of missing :-)

Thanks!
Toby

Am Mittwoch, 29. April 2015 12:07:21 UTC+2 schrieb Paolo Valleri:
>
> Hi,
> Can you try the fix I proposed in 
> https://github.com/web2py/web2py/issues/946#issuecomment-9661
>
> Paolo
>
> On Tuesday, April 28, 2015 at 9:26:23 PM UTC+2, Ariya Owam-aram wrote:
>>
>> Hi Everyone,
>>
>> I just upgrade to 2.10.4 and found error message when using filed 
>> list:reference.
>>
>> APP : welcome 
>>
>> DB
>> db.define_table('parent', Field('name'))
>> db.define_table('student', Field('name'), Field('parent', 'list:reference 
>> parent'))
>>
>> in APPADMIN
>> - from parent table insert : father, mother
>> - from student table insert : student1 with select father (or mother or 
>> both)
>> - open student grid view : return error 
>>  isinstance() arg 2 must be a class, type, 
>> or tuple of classes and types
>>
>> 1.
>> 2.
>> 3.
>> 4.
>> 5.
>> 6.
>> 7.
>> 8.
>> 9.
>> 10.
>> 11.
>> 12.
>> 13.
>>
>> Traceback (most recent call last):
>>   File "/home/www-data/web2py/gluon/restricted.py", line 227, in restricted
>> exec ccode in environment
>>   File "/home/www-data/web2py/applications/welcome/views/appadmin.html" 
>> , line 
>> 175, in 
>> {{if ram['bytes'] > 524287:}}
>>   File "/home/www-data/web2py/gluon/sqlhtml.py", line 3253, in __init__
>> r = represent(field, r or [], record)
>>   File "/home/www-data/web2py/gluon/sqlhtml.py", line 68, in represent
>> return f(value)
>>   File "/home/www-data/web2py/gluon/packages/dal/pydal/helpers/methods.py", 
>> line 268, in __call__
>> if isinstance(db._adapter, GoogleDatastoreAdapter):
>> TypeError: isinstance() arg 2 must be a class, type, or tuple of classes and 
>> types
>>
>>
>> Frames
>>
>>- 
>>
>>*File /home/www-data/web2py/gluon/restricted.py in restricted at line 
>> 227* code arguments variables
>>- 
>>
>>*File /home/www-data/web2py/applications/welcome/views/appadmin.html in 
>>  at line 175* code arguments variables
>>- 
>>
>>*File /home/www-data/web2py/gluon/sqlhtml.py in __init__ at line 3253* 
>> code arguments variables
>>- 
>>
>>*File /home/www-data/web2py/gluon/sqlhtml.py in represent at line 68* 
>> code arguments variables
>>- 
>>
>>*File /home/www-data/web2py/gluon/packages/dal/pydal/helpers/methods.py 
>> in __call__ at line 268* code arguments variables
>>Function argument list
>>
>>(self=, value=[1L], row=None)
>>Code listing
>>
>>263.
>>264.
>>265.
>>266.
>>267.
>>268.
>>
>>269.
>>270.
>>271.
>>272.
>>
>>if not value:
>>return None
>>from ..adapters import GoogleDatastoreAdapter
>>refs = None
>>db, id = self.ref._db, self.ref._id
>>if isinstance(db._adapter, GoogleDatastoreAdapter):
>>
>>def count(values):
>>return db(id.belongs(values)).select(id)
>>rx = range(0, len(value), 30)
>>refs = reduce(lambda a, b: a & b, [count(value[i:i+30])
>>
>>Variablesbuiltinisinstance> isinstance>db._adapter>object>dbGoogleDatastoreAdapterNone
>>
>>
>> Thank you
>> Ariya
>>
>

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

2015-05-04 Thread Sairam Kolla
Hi 

I have a table called posts which have title,id,body,auth.signature as 
their Fields.In a view called 'Posts' i want to display a grid of all the 
posts made by that particular user.So in the controller i have written like 
this


def view():
constraints={'created_by':auth.user_id}
grid=SQLFORM.smartgrid(db.posts,constraints=constraints)
return locals()

But the grid contains all the posts and there are no filtered.Can anyone 
help me out please

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

2015-05-04 Thread Anandhakumar Radhakrishnan
Hi,

My controller will return a dict like
data = { [ name: 'a', age: '23'], [name: 'b', age: '34']}
return data


in my html
how to construct this as table view like below



  Name 
 Age 

  a
23 

  b
 34






How to construct this?

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


[web2py] Re: Any problem in list:reference in 2.10 ?

2015-05-04 Thread Ben Sharif
Hi,

I was having this problem too (since 2.10.4), everything worked OK in 
2.9.11.
Has exactly the same error as Ariya above. 
Running on pythonanywhere I just tried your fix from github. 
In this file:
web2py > gluon > packages > dal > pydal > helpers > methods.py 
I replaced:
if isinstance(db._adapter, GoogleDatastoreAdapter):
with 
if db._adapter.dbengine == 'google:datastore':

The problem seems to be fixed as a result. 
Thanks!!



On Wednesday, 29 April 2015 11:07:21 UTC+1, Paolo Valleri wrote:
>
> Hi,
> Can you try the fix I proposed in 
> https://github.com/web2py/web2py/issues/946#issuecomment-9661
>
> Paolo
>
> On Tuesday, April 28, 2015 at 9:26:23 PM UTC+2, Ariya Owam-aram wrote:
>>
>> Hi Everyone,
>>
>> I just upgrade to 2.10.4 and found error message when using filed 
>> list:reference.
>>
>> APP : welcome 
>>
>> DB
>> db.define_table('parent', Field('name'))
>> db.define_table('student', Field('name'), Field('parent', 'list:reference 
>> parent'))
>>
>> in APPADMIN
>> - from parent table insert : father, mother
>> - from student table insert : student1 with select father (or mother or 
>> both)
>> - open student grid view : return error 
>>  isinstance() arg 2 must be a class, type, 
>> or tuple of classes and types
>>
>> 1.
>> 2.
>> 3.
>> 4.
>> 5.
>> 6.
>> 7.
>> 8.
>> 9.
>> 10.
>> 11.
>> 12.
>> 13.
>>
>> Traceback (most recent call last):
>>   File "/home/www-data/web2py/gluon/restricted.py", line 227, in restricted
>> exec ccode in environment
>>   File "/home/www-data/web2py/applications/welcome/views/appadmin.html" 
>> , line 
>> 175, in 
>> {{if ram['bytes'] > 524287:}}
>>   File "/home/www-data/web2py/gluon/sqlhtml.py", line 3253, in __init__
>> r = represent(field, r or [], record)
>>   File "/home/www-data/web2py/gluon/sqlhtml.py", line 68, in represent
>> return f(value)
>>   File "/home/www-data/web2py/gluon/packages/dal/pydal/helpers/methods.py", 
>> line 268, in __call__
>> if isinstance(db._adapter, GoogleDatastoreAdapter):
>> TypeError: isinstance() arg 2 must be a class, type, or tuple of classes and 
>> types
>>
>>
>> Frames
>>
>>- 
>>
>>*File /home/www-data/web2py/gluon/restricted.py in restricted at line 
>> 227* code arguments variables
>>- 
>>
>>*File /home/www-data/web2py/applications/welcome/views/appadmin.html in 
>>  at line 175* code arguments variables
>>- 
>>
>>*File /home/www-data/web2py/gluon/sqlhtml.py in __init__ at line 3253* 
>> code arguments variables
>>- 
>>
>>*File /home/www-data/web2py/gluon/sqlhtml.py in represent at line 68* 
>> code arguments variables
>>- 
>>
>>*File /home/www-data/web2py/gluon/packages/dal/pydal/helpers/methods.py 
>> in __call__ at line 268* code arguments variables
>>Function argument list
>>
>>(self=, value=[1L], row=None)
>>Code listing
>>
>>263.
>>264.
>>265.
>>266.
>>267.
>>268.
>>
>>269.
>>270.
>>271.
>>272.
>>
>>if not value:
>>return None
>>from ..adapters import GoogleDatastoreAdapter
>>refs = None
>>db, id = self.ref._db, self.ref._id
>>if isinstance(db._adapter, GoogleDatastoreAdapter):
>>
>>def count(values):
>>return db(id.belongs(values)).select(id)
>>rx = range(0, len(value), 30)
>>refs = reduce(lambda a, b: a & b, [count(value[i:i+30])
>>
>>Variablesbuiltinisinstance> isinstance>db._adapter>object>dbGoogleDatastoreAdapterNone
>>
>>
>> Thank you
>> Ariya
>>
>

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

2015-05-04 Thread Luis Ramos
Hi,
I would like to use pygal to display nice charts in browser. I have tried 
these ways:
1- Creating a function that returns an SVG 'render'
2- Creating a script that saves an SVG file, then calling it from the HTML 
file (Views).

None of these work. I get the error: error on line 68 at column 8: Opening 
and ending tag mismatch: link line 0 and head

Can you guys tell me what am I doing wrong?

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


[web2py] many to many with SQLFORM.grid

2015-05-04 Thread Ben Lawrence
Hi
if I have

db.define_table('meeting',Field('title','string'))
db.define_table('company',Field('name','string'))
db.define_table('co_meet',Field('ref_meeting','reference 
meeting'),Field('ref_company','reference company'))

What would the query be in SQLFORM.grid such that it would pick all the 
meetings for one company?
thanks in advance,
Ben



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


[web2py] Re: Pydal ilike search inside a list of strings?

2015-05-04 Thread Tom Stratton
I'm using postgres:pg8000

But I clearly did not read the documentation well enough - the 
`contains('%Smith')` does the trick perfectly.

Thanks

On Wednesday, April 29, 2015 at 3:20:37 AM UTC-7, Paolo Valleri wrote:
>
> Which postgres adapter are you using?
> Try 
> - contains('%Smith')
> and (for case-insensitive query)
> - contains('%smith', case_sensitive=False)
>
> Paolo
>
> On Tuesday, April 28, 2015 at 9:26:24 PM UTC+2, Tom Stratton wrote:
>>
>> For me, with the postgres adapter, the "contains" method is only 
>> returning information when one of the items in the list is an exact match 
>> (case insensitive) for the item I search for.
>>
>> so if the list is ['John Doe', 'Michael Smith', 'Karen Jones', 'Anne 
>> Baker']
>>
>> contains('Michael Smith') returns the row but
>> contains('Smith') does not
>>
>> I would like to be able to do 
>> ('% b%) and get back the row - Matching 'Anne Baker'
>>
>> Tom
>>
>>
>> On Saturday, April 25, 2015 at 7:15:41 PM UTC-7, Massimo Di Pierro wrote:
>>>
>>> db.tablename.fieldname.contains('whatever')
>>>
>>>
>>>

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

2015-05-04 Thread eric cuver
cool it's great

thank you

Le lundi 4 mai 2015 12:28:55 UTC+2, Gergely Orosz a écrit :
>
> Hi 4 All,
>
> I've started to develop a web2py plugin for Sublime Text 3.
> I've implemented a few command I found very useful on my daily work.
> If you have any idea how can I make it better and useful please visit the 
> below link and submit your feature request there
> Thanks in advance
>
> You can find the plugin: https://bitbucket.org/kfog/w2p
>
> If you have any question please feel free to ask here or on the Issue 
> tracker
>
> All the best
> Greg
>

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

2015-05-04 Thread Ariya Owam-aram
Thank you,

A



เมื่อ วันพุธที่ 29 เมษายน ค.ศ. 2015 17 นาฬิกา 07 นาที 21 วินาที UTC+7, 
Paolo Valleri เขียนว่า:
>
> Hi,
> Can you try the fix I proposed in 
> https://github.com/web2py/web2py/issues/946#issuecomment-9661
>
> Paolo
>
> On Tuesday, April 28, 2015 at 9:26:23 PM UTC+2, Ariya Owam-aram wrote:
>>
>> Hi Everyone,
>>
>> I just upgrade to 2.10.4 and found error message when using filed 
>> list:reference.
>>
>> APP : welcome 
>>
>> DB
>> db.define_table('parent', Field('name'))
>> db.define_table('student', Field('name'), Field('parent', 'list:reference 
>> parent'))
>>
>> in APPADMIN
>> - from parent table insert : father, mother
>> - from student table insert : student1 with select father (or mother or 
>> both)
>> - open student grid view : return error 
>>  isinstance() arg 2 must be a class, type, 
>> or tuple of classes and types
>>
>> 1.
>> 2.
>> 3.
>> 4.
>> 5.
>> 6.
>> 7.
>> 8.
>> 9.
>> 10.
>> 11.
>> 12.
>> 13.
>>
>> Traceback (most recent call last):
>>   File "/home/www-data/web2py/gluon/restricted.py", line 227, in restricted
>> exec ccode in environment
>>   File "/home/www-data/web2py/applications/welcome/views/appadmin.html" 
>> , line 
>> 175, in 
>> {{if ram['bytes'] > 524287:}}
>>   File "/home/www-data/web2py/gluon/sqlhtml.py", line 3253, in __init__
>> r = represent(field, r or [], record)
>>   File "/home/www-data/web2py/gluon/sqlhtml.py", line 68, in represent
>> return f(value)
>>   File "/home/www-data/web2py/gluon/packages/dal/pydal/helpers/methods.py", 
>> line 268, in __call__
>> if isinstance(db._adapter, GoogleDatastoreAdapter):
>> TypeError: isinstance() arg 2 must be a class, type, or tuple of classes and 
>> types
>>
>>
>> Frames
>>
>>- 
>>
>>*File /home/www-data/web2py/gluon/restricted.py in restricted at line 
>> 227* code arguments variables
>>- 
>>
>>*File /home/www-data/web2py/applications/welcome/views/appadmin.html in 
>>  at line 175* code arguments variables
>>- 
>>
>>*File /home/www-data/web2py/gluon/sqlhtml.py in __init__ at line 3253* 
>> code arguments variables
>>- 
>>
>>*File /home/www-data/web2py/gluon/sqlhtml.py in represent at line 68* 
>> code arguments variables
>>- 
>>
>>*File /home/www-data/web2py/gluon/packages/dal/pydal/helpers/methods.py 
>> in __call__ at line 268* code arguments variables
>>Function argument list
>>
>>(self=, value=[1L], row=None)
>>Code listing
>>
>>263.
>>264.
>>265.
>>266.
>>267.
>>268.
>>
>>269.
>>270.
>>271.
>>272.
>>
>>if not value:
>>return None
>>from ..adapters import GoogleDatastoreAdapter
>>refs = None
>>db, id = self.ref._db, self.ref._id
>>if isinstance(db._adapter, GoogleDatastoreAdapter):
>>
>>def count(values):
>>return db(id.belongs(values)).select(id)
>>rx = range(0, len(value), 30)
>>refs = reduce(lambda a, b: a & b, [count(value[i:i+30])
>>
>>Variablesbuiltinisinstance> isinstance>db._adapter>object>dbGoogleDatastoreAdapterNone
>>
>>
>> Thank you
>> Ariya
>>
>

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

2015-05-04 Thread Kike R.
Hello,

I have a different view like  default/user and i need in this 
view/controller send a EMAIL like request_reset_password,  i have the email 
account to send the message but i don't know how i do this.


thx sorry for my bad english, only speak spanish.

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

2015-05-04 Thread Louis Amon
According to Google's own spec 
, 
it takes special routing rules for dynamic websites to be crawled.

Basically, if you put  somewhere in your 
 then you can split your traffic:

Google bots will request stuff like:

   - domain[:port]/path?_escaped_fragment_=hashfragment
   - domain[:port]/path?queryparams&_escaped_fragment_=hashfragment
   - domain[:port]/path?_escaped_fragment_=
   - domain[:port]/path?queryparams&_escaped_fragment_=

While normal browsers will request stuff like:

   - domain[:port]/path#!hashfragment
   - domain[:port]/path?queryparams#!hashfragment
   - domain[:port]/path
   - domain[:port]/path?queryparams

I've got the normal users covered but how can I match "_escaped_fragment_=" 
in my routes to send those request to my static snapshots ?

I've tried 

('/s/$anything?_escaped_fragment_=', '/app/static/snapshots/$anything')

But it doesn't work at all !

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


[web2py] json-encoded requests in web2py

2015-05-04 Thread Louis Amon
I've recently had a pretty annoying issue when using web2py with AngularJS :

By default, AngularJS sends JSON-encoded requests when you use the $http 
service, so a POST request would look like this : 
"{"firstName":"John"}"


For some reason I don't really understand, web2py natively understands this 
JSON request a populates request.vars accordingly.

Why does web2py understand JSON requests ? Aren't POST requests (forms) 
supposed to be url-encoded ?


The issue I ended up facing because of this is when AngularJS sends a 
request that contains accentuated characters, e.g. :
 "{"firstName":"Cédric"}"

When the regular HTML form processing would require something like:
"firstName=C%C3%A9dric"



With the JSON request, web2py ends up populating request.vars like this : 
Storage(firstName=u'Cédric')

And so I get tons of *UnicodeEncodeError* when using web2py widgets or the 
URL helper...

For instance I have a URL(..., vars=request.vars) in a model and this 
raises an Exception (HTTP 500) every time the server receives a 
JSON-encoded request with accentuated characters.


*Shouldn't web2py be able to either convert JSON-encoded unicode strings ot 
reject them altogether without raising an exception ?*



...for the record : my solution so far was to hack the $http service in 
AngularJS into sending url-encoded strings instead of JSON.

I started this post solely because I think there is something wrong going 
on here with web2py and because many people post about UnicodeEncodeError 
in web2py

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

2015-05-04 Thread Louis Amon
Update

Heroku now provides an elegant solution to this issue : session affinity 


https://devcenter.heroku.com/articles/session-affinity

Basically, it sets a special cookie that tends to distribute users towards 
the dyno they've previously been served with.

I've tested it and it does solve the initial issue : which is allowing a 
file-based session system (admin & appadmin) in a concurrent server 
environment.
This is also a great performance improvement as you can rely less on 
Memcache and more on RAM-based caching.

The only caveat I've found so far is that when you scale up or down your 
dyno pool, sessions ends up being redistributed on the fly to even things 
out between dynos.
This shouldn't be an issue if your main application doesn't rely too 
heavily on the filesystem though.

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

2015-05-04 Thread Lieven Van Acker
I need to build a custom form to perform a database operation on a set of 
records. I'm using SQLFORM.factory to build the custom form.
Depending on the request vars, the form will change defaults and form 
element behaviour (the element can be writable or not, depending on how the 
request vars are given)

I have a form field that is a reference to a record in a db table in the 
defined model.


writable = some_condition()

form_fields = []
form_fields.append(Field('AllocationScenario',
 writable=writable,
 default=allocation_version.id,
 requires=IS_IN_DB(db, 
db.AllocationVersion.id,'%(Name)s'))
   )

...

form =  SQLFORM.factory(*form_fields)


If the element representing the form var needs to be editable (when 
some_condition evaluates True), it is shown as expected as a select 
element, with options populated from the references db table.

On the other hand, if I some_condition evaluates False, the element is 
shown as the provided default value (i.e. an integer id value), instead of 
the corresponding label of the selected option.

Wouldn't it be more appropriate to set the displayed value to the 
corresponding label of the select option?

What is the best way to work around this issue?


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

2015-05-04 Thread Tom Stratton
Hi -

I'm setting up to be able to work on some fixes for issues in pydal as they 
relate to web2py and I'm fairly new to this - the submodule of pydal inside 
web2py is hanging me up.

When I fork web2py on github (to be able to clone it locally) and I use the 
—recursive command on the clone I get the main trunk of web2py/pydal 
instead of (as I would hope) my fork of pydal on github.

I'm wondering if there is a simple way to set this up or if I should just 
fork and then re-clone the trunk of pydal locally.

I know that much more experienced people that I have a solution for this 
setup and I'm looking for advice.

Thanks

Tom

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

2015-05-04 Thread Chris Modzelewski
Awesome! Thank you very much for this explanation!

All the best,
Chris

On Tuesday, April 28, 2015 at 6:22:49 PM UTC-4, Leonel Câmara wrote:
>
> This one:
>
> A. Does the cached object get updated:
>
> The cached object is updated immediately because it's the same object. 
> Cache ram does not clone it. Notice that the behaviour will be different if 
> you're using cache disk.
>
> Do know that doing this is a very bad idea, as you will run into all sorts 
> of thread safety problems. You should consider cached values immutable if 
> you don't want to worry about safety yourself.
>
>
> And finally, if I wish to force a changed value of some_object to be saved 
> to the cache, am I correct that I should then call:
> some_object.arg3 = 
> some_object = cache.ram(self.id_attribute, lambda self, time=0)
>
>
> This will force the change, but, again, if it's the same object the change 
> will already be there.
>
> > Does this mean that the next time someone instantiates an object of 
> class "SomeClass" with the same arg1 value but a different time_expire 
> value, the cached object will be overwritten?
>
> It will be overwritten if the cached value has a timestamp that is expired 
> with the given time_expire value. 
>   
>
>
> I think that maybe your problem is that you're not understanding what the 
> cache is actually saving in your example. When you put an object in cache 
> ram, what's actually in the cache is a reference to the object. So if you 
> have a reference to that same object somewhere else and you modify it, 
> you're actually modifying the same object that cache is referencing.
>
> Cache disk is different, because cache disk pickles your object and when 
> you ask it for a value it unpickles it, so each time you will get a new 
> object albeit with the same attributes.
>

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

2015-05-04 Thread vcmdevel
Hi Massimo,

I start build webservers soap with web2py to my clients, but yet haven't a 
site for expose this works. I work with integrations for cargo 
transportation companies in Brazil and expanding the use of web2py to 
websites. Hereafter we can add my company on the list.

Thanks,

Vanderson

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

2015-05-04 Thread Pierre Thibault
Hello,

I had a few projects for Web2py and I did move them to GitHub because 
GoogleCode is going down soon.

Here a few links:

Pierre-Thibault/neo-web2py-utils 
 A utility project for 
web2py applications  Not a lot of stuff in this one...

Pierre-Thibault/neo-web2py2eclipse 
 neo-web2py2eclipse 
is an automated eclipse project creator for web2py applications.

Pierre-Thibault/neo-insert-imports 
  A tool for Web2py 
Pydev Eclipse users to add the code for the static code analyzer.

I hope it can be useful.

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

2015-05-04 Thread Ben Lawrence
Thanks for your work around. I see this too. It seems more convenient to 
use:
Field('gender','string',requires=IS_IN_SET(('Male', 'Female')))
as this will keep the default when in edit.


On Sunday, April 7, 2013 at 10:00:28 PM UTC-7, 黄祥 wrote:
>
> i've already start testing using the simple table (start from scratch) but 
> got the same result. here is my conclusion, please correct me if i'm wrong :
> - if you combine list:string field with IS_IN_SET validator, in form edit 
> you will receive blank value in drop down, not the existing value that 
> stored in database. 
> - if you want to use IS_IN_SET validator and in form edit will show the 
> existing value that store in database, please use string type field in your 
> define table.
>
> *e.g. in form edit receive blank value in drop down field, not the 
> existing value that stored in database*
> *db.py*
> db.define_table('gender',
> Field('gender', 'list:string'),
> format='%(gender)s')
>
> db.gender.gender.requires=IS_IN_SET(['Male', 'Female'])
>
> *default.py*
> def gender():
> grid=SQLFORM.grid(db.gender, user_signature=False)
> return locals()
>
> *default/gender.html*
> {{extend 'layout.html'}}
>
> {{=grid}}
>
> *e.g. in form edit will show the existing value that store in database*
> *db.py*
> db.define_table('gender',
> Field('gender'),
> format='%(gender)s')
>
> db.gender.gender.requires=IS_IN_SET(['Male', 'Female'])
>
> *default.py*
> def gender():
> grid=SQLFORM.grid(db.gender, user_signature=False)
> return locals()
>
> *default/gender.html*
> {{extend 'layout.html'}}
>
> {{=grid}}
>

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

2015-05-04 Thread Christophe Meessen
Yes. Sorry for the delay. Perfect solution. 

Le dimanche 26 avril 2015 00:47:23 UTC+2, Anthony a écrit :
>
> Did this solution  not work 
> for you?
>
> On Saturday, April 25, 2015 at 11:28:10 AM UTC-4, Christophe Meessen wrote:
>>
>> In my web2py web app, the controller function def index(): has the 
>> decorator @auth.requires_login(). 
>>
>> For development and testing purpose I comment out this decorator. But I 
>> often forget to uncomment it before committing the code. 
>>
>> I would like to change this decorator into something that would test if a 
>> file is present (i.e. skipLogin) and if not to require login. I can then 
>> add the skipLogin file in my .gitignore file and don't need to worry about 
>> commenting and uncommenting the decorator line. 
>>
>> I suppose it should be something like @auth.requires(lambda: xxx) but I 
>> have no idea what xxx should be. 
>>
>>

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

2015-05-04 Thread bodobammel
In my case, it is UTF-8.

   List of databases
Name |  Owner   | Encoding |   Collate   |Ctype|   Access 
privileges
-+--+--+-+-+---
 test | manager  | UTF8 | de_DE.UTF-8 | de_DE.UTF-8 |


It seems to be an issue with the default postgresql driver. After changing 
the connection string to
 db = DAL('postgres:*psycopg2* ...) it worked flawless..


Am Dienstag, 28. April 2015 21:31:53 UTC+2 schrieb mcm:

> One more check... is the encoding of the database UTF-8?
> you can check with psql -l
>
>
> 2015-04-27 19:01 GMT+02:00 >:
>
>> > which postgresql Version?
>>
>> PSQL 9.3.6 @ Ubuntu 14.04.2 LTS
>>
>> In the meantime, I played around with pgadmin a little bit:
>>
>> 1) Using pgadmin I can create records containing 'ἀγοραζε' (the sample 
>> above) or German Umlaute ä, ö, ü, so it's definetly no database problem.
>>
>> 2) Going to Appadmin 
>> https://testmachine/testapp/appadmin/select/db?query=db.test.id%3E0 displays 
>> the records without Problem
>>
>> 3) As soon as I edit and save, I'll get a
>>  'ascii' codec can't decode byte 
>> 0xe1 in position 114: ordinal not in range(128)
>>
>>
>> Traceback (most recent call last):
>>   File "/home/www-data/web2py/gluon/restricted.py", line 227, in 
>> restricted
>> exec ccode in environment
>>   File 
>> "/home/www-data/web2py/applications/testapp/controllers/appadmin.py", line 
>> 704, in 
>>   File "/home/www-data/web2py/gluon/globals.py", line 393, in 
>> self._caller = lambda f: f()
>>   File 
>> "/home/www-data/web2py/applications/testapp/controllers/appadmin.py", line 
>> 343, in update
>> if form.accepts(request.vars, session):
>>   File "/home/www-data/web2py/gluon/sqlhtml.py", line 1677, in accepts
>> if pk:
>>   File "/home/www-data/web2py/gluon/packages/dal/pydal/objects.py", line 
>> 2117, in update
>> uploadfolder = pjoin(
>>   File "/home/www-data/web2py/gluon/packages/dal/pydal/adapters/base.py", 
>> line 988, in update
>> raise e
>> UnicodeDecodeError: 'ascii' codec can't decode byte 0xe1 in position 114: 
>> ordinal not in range(128)
>>
>>
>>
>>
>>
>> Am Sonntag, 26. April 2015 15:27:06 UTC+2 schrieb Massimo Di Pierro:
>>
>>> which postgresql version? I am failing to reproduce this.
>>>
>>> On Saturday, 25 April 2015 10:28:07 UTC-5, bodob...@gmail.com wrote:

 Hey guys,

 2.10.3 doesn't seem ready for prime time :-( In fact this bug makes 
 2.10.3 unusable for postgres users with need for non ASCII-characters..

 For reference let's link to the corresponding issue here too: 
 https://github.com/web2py/web2py/issues/910

 Is there any solution yet?

 Bodo

 Am Samstag, 11. April 2015 16:38:13 UTC+2 schrieb Ian W. Scott:

> Thanks Richard. My production server is working fine with 2.9.11. I'll 
> open an issue on the web2py github repo, since it sounds like that's the 
> better forum for this.
>
> Ian
>
>
> On Friday, April 10, 2015 at 3:40:16 PM UTC-4, Richard wrote:
>>
>> Ok, ok, I guess there is an issue with web2py or pyDAL... Can you 
>> test this with an earlier version of web2py? If it works consider open 
>> an 
>> issue in web2py on github with condition to reproduce the error and if 
>> it 
>> coming form pyDAL the issue will be migrate to pyDAL repo once the 
>> origin 
>> of the issue is found.
>>
>> Richard
>>
>> On Fri, Apr 10, 2015 at 3:24 PM, Ian W. Scott  
>> wrote:
>>
>>> Also, as I pointed out in my question I can insert the same string 
>>> (with the same encoding) directly into the postgre database using the 
>>> raw 
>>> SQL code that is being sent by pydal to the postgre adapter. I inserted 
>>> a 
>>> print statement into adapters/base.py to give me the exact SQL command, 
>>> copied that SQL command (data and all), then ran it in pgAdmin with no 
>>> problem. So it can't be a problem with the encoding of the string being 
>>> received by the pydal.
>>>
>>> Ian
>>>
>>> On Friday, April 10, 2015 at 2:05:25 PM UTC-4, Richard wrote:

 Can you please show the code that lead to this error?

 If you hard code this you can't use a regular string (str()) which 
 is ascii characters only you have to pass by unicode something like 
 this :

 string = u'ἀγοραζε'.decode(utf-8)

 http://stackoverflow.com/questions/6289474/working-
 with-utf-8-encoding-in-python-source

 If the greek character come form user input web2py deal with this 
 to my knowledge... So I am pretty sure you hard code greek character 
 in 
 your code... So you need to read about encoding in python...

 Richard



 On Fri, Apr 10, 2015 at 1:29 PM, Ian

[web2py]

2015-05-04 Thread Александр Остыловский
hello! 
File index.html contains next string:

But I have not found where this class defined. 
May be I have to define this class myself?

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: Linking directly to an uploaded image

2015-05-04 Thread Simon Marshall

>
> i've been trying to work this out but so far no image is showing, below is 
> my mvc:
>
 Model:

db.define_table('images',
Field('picture', 'upload', 
uploadfolder=request.folder+'static/uploaded')) 

Controller:

def index():
res = db(db.images).select()
#res = db(db.images.id==request.args(0)).select(db.images.picture)

return locals()

View: 

{{for row in res:}}



{{pass}} 

i can get the image to show when i do this -  but not the above, is using 
the URL helper is better?

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

2015-05-04 Thread Massimo Di Pierro
yes they should be utf8

On Tuesday, 28 April 2015 14:26:23 UTC-5, Louis Amon wrote:
>
> I'm raising what seems to be an old issue with web2py : sending forms with 
> web2py raises exceptions when using accentuated characters.
>
> Given that request.vars can be virtually anything on a production server, 
> what is the best practice here ?
>
>
> Should I force request.vars keys & values to be utf-8 instead of unicode ?
>

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

2015-05-04 Thread Jairo Lozano
Maybe this is a dumb question but I'm really new to web2py and I'm having a 
hard time testing my project manually :/ so I wanted you guys to tell me 
what do you do to test your projects in web2py? you know, to create a test 
battery and run it whenever necessary... If you can provide any links to 
resources like tutorials or demos it would be great :)
Thanks in advance :)

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


[web2py] Re: Interesting new Python<-->Javascript builder

2015-05-04 Thread Massimo Di Pierro
Interesting!

On Saturday, 2 May 2015 19:17:52 UTC-5, Joe Barnhart wrote:
>
> Saw this yesterday...
>
> https://github.com/timothycrosley/jiphy
>
> It translates Python to Javascript and Javascript to Python.  I could see 
> it as an enhancement to the {{}} functionality in web2py to help write 
> javascript code in python syntax.  C'mon, you know you already think in 
> python -- just admit it and go all the way!
>
> One of the problems the author faced is that he needs a reliable way to 
> tell when blocks terminate.  We already crossed that rubicon with our usage 
> of "pass" for block closures.  If he added that it would make a nice 
> javascript emitter from python source in our "view" pages.
>
> Edit:
>
> Found another one...
>
> https://github.com/niwibe/cobrascript
>
> This one is only Python-->Javascript (which is the direction I care about 
> anyway)
>
>

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

2015-05-04 Thread 黄祥
e.g.
def view():
constraints = db.posts.created_by == auth.user_id
grid=SQLFORM.smartgrid(db.posts, constraints = constraints)
return locals()

ref:
https://groups.google.com/forum/#!topic/web2py/mtbhY19aAEA

best regards,
stifan

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


[web2py] Re: What is the best way to do software testing in web2py?

2015-05-04 Thread pang
Not a dumb question, but it has been asked already!

For example:

https://groups.google.com/forum/#!searchin/web2py/test/web2py/cPN0m-iQNqc/1r0Q6TYY_f4J
https://groups.google.com/forum/#!searchin/web2py/test/web2py/wsob6MVojc4/bFkiXrBBFZYJ
https://groups.google.com/forum/#!searchin/web2py/test/web2py/CFwe4sxPLEg/bwMy3DS1RSgJ

and you will find other older threads on this issue if you search a little 
bit deeper

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

2015-05-04 Thread 黄祥
perhaps, you can do 
e.g.
def test():
query = db.co_meet.ref_company == 1 # whatever value that refer to 
table company
grid=SQLFORM.grid(query)
return locals()

best regards,
stifan

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


Re: [web2py] delete session value that store query as_list()

2015-05-04 Thread 黄祥
can not, it will deleted if the session list value is only 1, but if more 
than one you could sweep it all (delete it twice) with :
e.g.
def empty_checkout(session_return_detail, redirect_cart):
for i, row in enumerate(session_return_detail):
del session_return_detail[i]
for i in xrange(0, len(session_return_detail) ):
del session_return_detail[i]
redirect(URL(redirect_cart) )

best regards,
stifan

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


[web2py] Re: Sublime Text web2py plugin

2015-05-04 Thread Massimo Di Pierro
Nice. Thank you! I added link form the web2py examples/ app.

On Monday, 4 May 2015 05:28:55 UTC-5, Gergely Orosz wrote:
>
> Hi 4 All,
>
> I've started to develop a web2py plugin for Sublime Text 3.
> I've implemented a few command I found very useful on my daily work.
> If you have any idea how can I make it better and useful please visit the 
> below link and submit your feature request there
> Thanks in advance
>
> You can find the plugin: https://bitbucket.org/kfog/w2p
>
> If you have any question please feel free to ask here or on the Issue 
> tracker
>
> All the best
> Greg
>

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

2015-05-04 Thread 黄祥
why not just copy the user function in the controller 'default' and paste 
it on the other controller?

best regards,
stifan

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


[web2py] Re: SQLFORM.factory writable=False

2015-05-04 Thread 黄祥
perhaps you can try:
e.g.
#write_in_form = 'edit' in request.args
write_in_form = '1' in request.vars

form_fields.append(Field('AllocationScenario',
 writable = not write_in_form,
 default=allocation_version.id,
 requires=IS_IN_DB(db, 
db.AllocationVersion.id,'%(Name)s'))
   )

best regards,
stifan

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


[web2py] Re: SQLFORM.factory writable=False

2015-05-04 Thread Anthony
You haven't defined a "represent" attribute for the field, so when you set 
the field to read-only, it just displays the actual value, which is the 
integer ID. This doesn't happen when the field is writable because the 
IS_IN_DB validator generates a select widget that shows the "name" values. 
Try:

Field(..., represent=lambda id, r: db.AllocationVersion(id).name)

Anthony

On Monday, May 4, 2015 at 11:56:36 AM UTC-4, Lieven Van Acker wrote:
>
> I need to build a custom form to perform a database operation on a set of 
> records. I'm using SQLFORM.factory to build the custom form.
> Depending on the request vars, the form will change defaults and form 
> element behaviour (the element can be writable or not, depending on how the 
> request vars are given)
>
> I have a form field that is a reference to a record in a db table in the 
> defined model.
>
>
> writable = some_condition()
>
> form_fields = []
> form_fields.append(Field('AllocationScenario',
>  writable=writable,
>  default=allocation_version.id,
>  requires=IS_IN_DB(db, 
> db.AllocationVersion.id,'%(Name)s'))
>)
>
> ...
>
> form =  SQLFORM.factory(*form_fields)
>
>
> If the element representing the form var needs to be editable (when 
> some_condition evaluates True), it is shown as expected as a select 
> element, with options populated from the references db table.
>
> On the other hand, if I some_condition evaluates False, the element is 
> shown as the provided default value (i.e. an integer id value), instead of 
> the corresponding label of the selected option.
>
> Wouldn't it be more appropriate to set the displayed value to the 
> corresponding label of the select option?
>
> What is the best way to work around this issue?
>
>
>

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

2015-05-04 Thread 黄祥
print the dict.keys() in your thead, and then use looping to print 
dict.values() in your tbody.

best regards,
stifan

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


[web2py] Re: recaptcha is not work in web2py latest version

2015-05-04 Thread 黄祥
yes you right, it related with the form.elements
e.g.
form.element('#submit_record__row').insert(-1,TR('', 
Recaptcha(current.request, 
   
PUBLIC_KEY, 
   
PRIVATE_KEY, 
   
error_message = 'invalid', 
   label = 
'Verify:', 
   options 
= 'theme : "white", lang : "fr"'), ''))

the error is disappeared but the recaptcha is not shown in the form too 
(unexpected result test on pythonanywhere with web2py latest version).

best regards,
stifan

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


[web2py] Re: DB2 database issue with Clob types

2015-05-04 Thread Boris Aramis Aguilar Rodríguez
Hi, web2py data type is text; 

I see in this 
post: 
https://groups.google.com/forum/#!searchin/web2py/ODBC$20data$20type$20-99/web2py/6xxz8KXBXCY/pcpdiPQh1K4J
that it is the normal behavior of web2py, to map text-clob on IBM DB2 
databases. 

Also on the same post they propose a solution editing db2cli.ini file but I 
don't know how to configure db2cli.ini (I mean, I know how to open it, 
where it is but I don't understand which alias should I put on the file)

Any help I will really appreciate it.

Thanks!

El sábado, 25 de abril de 2015, 5:24:41 (UTC-6), Paolo Valleri escribió:
>
> you should provide us more info...
> which web2py type are you using that is mapped to CLOB field?
> web2py/pyodbc version
>
> Paolo
>
> On Friday, April 24, 2015 at 6:17:53 PM UTC+2, Boris Aramis Aguilar 
> Rodríguez wrote:
>>
>>  ('ODBC data type -99 is not supported. Cannot read 
>> column LDTEXT.', 'HY000') 
>>
>> Hi, Im currently accesing a DB2 database (readonly) that is used by 
>> another application, my connection string is as follows: 
>>
>> db_tivoli = 
>> DAL('db2:pyodbc://driver=DB2;hostname=24.50.5.5;database=MAXDB71;uid=on_usr;pwd=pass.;port=50005',
>>  
>> pool_size=1, db_codec='latin1', migrate=False) 
>>
>> and everything was going fine until I added a clobdata type to web2py 
>> data code 
>>
>> And now I'm getting the error I referenced above (sorry I couldnt paste 
>> it in order, Im on my phone) Any hints I would appreciate 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: scheduler workers get deleted constantly and one task is assigned to many different runs

2015-05-04 Thread Pengfei Yu
This need to be verified with AWS's tech support I guess. The instances in 
AWS region "cn-north-1" are weird in many aspects from my recent 
experiences...

On Sunday, May 3, 2015 at 8:18:59 AM UTC-4, Niphlod wrote:
>
> seems that the same thing that happened a long time ago on travis-ci: glad 
> you worked it out, but I'm really unsure why different regions should carry 
> different versions of the same operating system.
>
> On Thursday, April 30, 2015 at 6:57:08 PM UTC+2, Pengfei Yu wrote:
>>
>> Hi Niphlod,
>>
>> I think I solve the problem. Followed by my last post, the issure is in 
>> shared memory for the multiprocessing module of python. According to the 
>> solution on this link (
>> http://stackoverflow.com/questions/2009278/python-multiprocessing-permission-denied
>>  
>> ), I let none being mounted on /dev/shm/ and the problem is fixed. 
>> The interesting thing is that in EC2 instance of US regions, I don't need 
>> to do this mounting, and it works fine for the multiprocessing, but for the 
>> instance in China region, I need to do that.
>>
>> Thanks for all your helps!
>> Pengfei
>>
>> On Thursday, April 30, 2015 at 8:47:48 AM UTC-4, Niphlod wrote:
>>>
>>>
>>>
>>> On Wednesday, April 29, 2015 at 11:53:56 PM UTC+2, Pengfei Yu wrote:

 Hi Niphlod and Dave,

 I think the worker is deleted because the the last heartbeat doesn't 
 change for a while. When I comment out the line "#dead_workers.delete()" 
 in 
 gluon/schdeuler.py, the task is stuck as QUEUED without new run record 
 created. And the worker supposed to be deleted with the last_heartbeat 
 doesn't change. When I keep this line "dead_workers.delete()", the 
 situation remain the same as my original email. 

>>>
>>> a worker that can't "piggyback" its presence NEEDS to be assumed as dead.
>>>  
>>>

 I think the task is never processed, since I added a single test line 
 as "os.system('touch /test.log')" at the beginning of the 
 task 
 function, but this "test.log" file is never created in the server. I guess 
 the worker is died right after it is assigned a task, even before the task 
 is being processed, and then the task is QUEUED again. 

>>>
>>> in this case, you won't have any scheduler_run records. Those are 
>>> created when the task gets picked up.
>>>  
>>>

 I have the configuration in /etc/init/web2py-scheduler,conf, and the 
 service is running, that is why new worker are pop out when previous one 
 dies. 

>>>
>>> Perfect, but maybe you should monitor if they ALWAYS fail and avoid 
>>> restarting them ?!?!!?
>>>  
>>>

 When I set timeout as 10s for the task, it is still the same as before, 
 multiple runs are generated for the same task and they are not ended 
 though 
 the assigned workers are died. I guess for the task, the time from RUNNING 
 to QUEUED again is very short.

>>>
>>> This seems to point out that the problem isn't a really long task that 
>>> gets stuck, but rather that your task even before the "10 seconds" has 
>>> issues, or the scheduler has trying to pick that up.
>>>


 One difference between the server in original region (works fine) and 
 the current region is that in the current region, I use the port 8000 for 
 the HTTPS access, instead of the default 443. This is because the current 
 one is in China and there are restrictions on HTTP/HTTPS access with port 
 80/8080/443. I am not sure if this will affect the workers since the 
 worker 
 name only have ip information but not port.


>>> Shouldn't be a problem.
>>>  
>>>
 Niphlod, 

 May I ask how can I enable the DEBUG mode and check the logging? I do 
 see logging in the script of gluon/scheduler.py, but I don't know where I 
 can find the logging information in a log file. 

 Thanks

>>>
>>> use logging.conf (enable DEBUG log for root and web2py, then in 
>>> consolehandler) and start the scheduler with
>>>
>>> web2py.py -K appname -D 0
>>>  
>>>
>>

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


[web2py] Re: DB2 database issue with Clob types

2015-05-04 Thread Boris Aramis Aguilar Rodríguez
I've just fixed it :D

The thing is that those parameters (that fix up the issue with clob types 
and pyodbc) can be passed trough the web2py connection string, so it is now 
as follows:

db_tivoli = 
DAL('db2:pyodbc://driver=DB2;hostname=IP_OR_HOSTNAME;database=DATABASENAME;\

uid=USER;pwd=PASSWORD;port=50005;LONGDATACOMPAT=1;LOBMAXCOLUMNSIZE=10485875',
migrate=False, pool_size=0, attempts=1)

I'm so happy :)

El lunes, 4 de mayo de 2015, 10:56:49 (UTC-6), Boris Aramis Aguilar 
Rodríguez escribió:
>
> Hi, web2py data type is text; 
>
> I see in this post: 
> https://groups.google.com/forum/#!searchin/web2py/ODBC$20data$20type$20-99/web2py/6xxz8KXBXCY/pcpdiPQh1K4J
> that it is the normal behavior of web2py, to map text-clob on IBM DB2 
> databases. 
>
> Also on the same post they propose a solution editing db2cli.ini file but 
> I don't know how to configure db2cli.ini (I mean, I know how to open it, 
> where it is but I don't understand which alias should I put on the file)
>
> Any help I will really appreciate it.
>
> Thanks!
>
> El sábado, 25 de abril de 2015, 5:24:41 (UTC-6), Paolo Valleri escribió:
>>
>> you should provide us more info...
>> which web2py type are you using that is mapped to CLOB field?
>> web2py/pyodbc version
>>
>> Paolo
>>
>> On Friday, April 24, 2015 at 6:17:53 PM UTC+2, Boris Aramis Aguilar 
>> Rodríguez wrote:
>>>
>>>  ('ODBC data type -99 is not supported. Cannot read 
>>> column LDTEXT.', 'HY000') 
>>>
>>> Hi, Im currently accesing a DB2 database (readonly) that is used by 
>>> another application, my connection string is as follows: 
>>>
>>> db_tivoli = 
>>> DAL('db2:pyodbc://driver=DB2;hostname=24.50.5.5;database=MAXDB71;uid=on_usr;pwd=pass.;port=50005',
>>>  
>>> pool_size=1, db_codec='latin1', migrate=False) 
>>>
>>> and everything was going fine until I added a clobdata type to web2py 
>>> data code 
>>>
>>> And now I'm getting the error I referenced above (sorry I couldnt paste 
>>> it in order, Im on my phone) Any hints I would appreciate 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.


Re: [web2py] Re: DB2 database issue with Clob types

2015-05-04 Thread Paolo Valleri
well done

 Paolo

2015-05-04 19:35 GMT+02:00 Boris Aramis Aguilar Rodríguez <
boriscou...@gmail.com>:

> I've just fixed it :D
>
> The thing is that those parameters (that fix up the issue with clob types
> and pyodbc) can be passed trough the web2py connection string, so it is now
> as follows:
>
> db_tivoli =
> DAL('db2:pyodbc://driver=DB2;hostname=IP_OR_HOSTNAME;database=DATABASENAME;\
>
> uid=USER;pwd=PASSWORD;port=50005;LONGDATACOMPAT=1;LOBMAXCOLUMNSIZE=10485875',
> migrate=False, pool_size=0, attempts=1)
>
> I'm so happy :)
>
> El lunes, 4 de mayo de 2015, 10:56:49 (UTC-6), Boris Aramis Aguilar
> Rodríguez escribió:
>>
>> Hi, web2py data type is text;
>>
>> I see in this post:
>> https://groups.google.com/forum/#!searchin/web2py/ODBC$20data$20type$20-99/web2py/6xxz8KXBXCY/pcpdiPQh1K4J
>> that it is the normal behavior of web2py, to map text-clob on IBM DB2
>> databases.
>>
>> Also on the same post they propose a solution editing db2cli.ini file but
>> I don't know how to configure db2cli.ini (I mean, I know how to open it,
>> where it is but I don't understand which alias should I put on the file)
>>
>> Any help I will really appreciate it.
>>
>> Thanks!
>>
>> El sábado, 25 de abril de 2015, 5:24:41 (UTC-6), Paolo Valleri escribió:
>>>
>>> you should provide us more info...
>>> which web2py type are you using that is mapped to CLOB field?
>>> web2py/pyodbc version
>>>
>>> Paolo
>>>
>>> On Friday, April 24, 2015 at 6:17:53 PM UTC+2, Boris Aramis Aguilar
>>> Rodríguez wrote:

  ('ODBC data type -99 is not supported. Cannot
 read column LDTEXT.', 'HY000')

 Hi, Im currently accesing a DB2 database (readonly) that is used by
 another application, my connection string is as follows:

 db_tivoli =
 DAL('db2:pyodbc://driver=DB2;hostname=24.50.5.5;database=MAXDB71;uid=on_usr;pwd=pass.;port=50005',
 pool_size=1, db_codec='latin1', migrate=False)

 and everything was going fine until I added a clobdata type to web2py
 data code

 And now I'm getting the error I referenced above (sorry I couldnt paste
 it in order, Im on my phone) Any hints I would appreciate 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 a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/525AqDpOpio/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: A text field in PostgreSQL is mixing unicode and str types

2015-05-04 Thread Chris
Just spent some time reviewing this - looks OK now, I think I must have 
screwed up somewhere.

All db text fields in web2py are supposed to be bytestrings of , right?

On Sunday, May 3, 2015 at 8:15:19 AM UTC-4, Niphlod wrote:
>
> can you post an example app to reproduce the issue ?
>
> On Thursday, April 30, 2015 at 9:18:13 PM UTC+2, Chris wrote:
>>
>> I'm using web2py with PostgreSQL and it's working pretty well, however, 
>> there's a weird problem. When I load a row with a text column in it, that 
>> column isn't one consistent type. It appears as  when it 
>> includes extended characters and  when it doesn't. I end up 
>> having to look up the type and call decode on just the strs 
>>  
>> to make sure they all have a consistent type and avoid the dreaded 
>> UnicodeDecodeError.
>>
>> This is causing a bug on my setup which is Linux:
>> 2.9.12-stable+timestamp.2015.01.17.06.11.03
>> (Running on Rocket 1.2.6, Python 2.7.0)
>>
>> Will this/has this been patched? Is this a bug with my version of Python?
>>
>

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

2015-05-04 Thread Niphlod
is there at least something or it just renders as a void ?

On Monday, May 4, 2015 at 6:46:56 PM UTC+2, 黄祥 wrote:
>
> yes you right, it related with the form.elements
> e.g.
> form.element('#submit_record__row').insert(-1,TR('', 
> Recaptcha(current.request, 
>
> PUBLIC_KEY, 
>
> PRIVATE_KEY, 
>
> error_message = 'invalid', 
>label = 
> 'Verify:', 
>options 
> = 'theme : "white", lang : "fr"'), ''))
>
> the error is disappeared but the recaptcha is not shown in the form too 
> (unexpected result test on pythonanywhere with web2py latest version).
>
> best regards,
> stifan
>

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


[web2py] Re: scheduler_run table remains empty

2015-05-04 Thread Niphlod
is your task returning something ? if it's not returning anything, by 
default the corresponding scheduler_run record is deleted.

On Monday, May 4, 2015 at 5:56:36 PM UTC+2, Christophe Meessen wrote:
>
> I'm using queue_task to execute a task once at a predefined time. The task 
> itself calls queue_task when it finished executing itself to submit it self 
> for a later execution at a predefined time. I'm currently testing it so I 
> call web2p directly with the shell to check output. 
>
> This all works as expected and an entry is created in the scheduler_task 
> table. When the task completes its status becomes COMPLETE and a new task 
> is queued and executed at the predefined time (approximately).
>
> My problem is that the table scheduler_run remains empty. So I can't see 
> the output of the task. It was filled during initial development tests. 
>
> Is there a way to see logs of worker processes ? I couldn't find any. The 
> logs directory of web2py is empty. 
>
>
>

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

2015-05-04 Thread Niphlod
.backgroud is set on web2py-bootstrap3.css . container-fluid is a basic 
class from boostrap3

On Monday, May 4, 2015 at 5:56:36 PM UTC+2, Александр Остыловский wrote:
>
> hello! 
> File index.html contains next string:
> 
> But I have not found where this class defined. 
> May be I have to define this class myself?
>
> thanks.
>

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


[web2py] Re: json-encoded requests in web2py

2015-05-04 Thread Niphlod
web2py understands POST requests that are either
- multipart/something
- application/json

that is coming from the content-type specified in the request itself. 
web2py behaves accordingly to the content-type...json strings are 
unicode by default, so I really don't see the issue on having 
first_name=u'something'  maybe the issue at hand is that the helper 
you'd like to use doesn't understand unicode "automagically", but that's 
another matter...
I think the issue at hand is that urlencode from urllib doesn't take 
unicode values as good ones

maybe raise an issue on github: I see that unicode values in rewrite, 
request.args and such have already a few issues opened on them: this one 
for the vars should be in the same "family" fix. 

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


Re: [web2py] how to run tests over pydal locally?

2015-05-04 Thread Niphlod
ok, rephrasing: *in order to gain any advantage in using py.test over 
unittests* you'd need to rewrite the entire test-suite. 

if you don't rewrite them, nothing of py.test fancy features can be used.



On Monday, May 4, 2015 at 6:16:56 AM UTC+2, Vinicius Assef wrote:
>
> As far as the py.test docs says, you shouldn’t need to rewrite them.
>
> py.test understands unittest tests.
>
>
> On 3 May 2015, at 09:17, Niphlod > wrote:
>
> you need to rewrite the entire test-suite.
>
> On Thursday, April 30, 2015 at 8:46:38 PM UTC+2, Richard wrote:
>>
>> Simone,
>>
>> How can I run unittest with py.test?
>>
>> Richard
>>
>> On Wed, Apr 29, 2015 at 4:38 PM, Richard Vézina  
>> wrote:
>>
>>> my bad from not form...
>>>
>>> :(
>>>
>>> Richard
>>>
>>> On Wed, Apr 29, 2015 at 4:34 PM, Richard Vézina  
>>> wrote:
>>>
 that's how validators.py is added!!

 I don't find how to import smart_query

 from pydal.helpers.methods import smart_query

 the above returns "invalid syntax"

 Richard

 On Wed, Apr 29, 2015 at 4:28 PM, Niphlod  wrote:

> oh my. Add to __init__ ^_^'
>
> On Wednesday, April 29, 2015 at 10:18:51 PM UTC+2, Richard wrote:
>>
>> One more I don't see my news tests executing...
>>
>> Is there anything else to do then add an new file of unitttest into 
>> pydal/tests
>>
>> To add news cases?
>>
>> Richard
>>
>> On Wed, Apr 29, 2015 at 4:13 PM, Richard Vézina <
>> ml.richa...@gmail.com> wrote:
>>
>>> :)
>>>
>>> I don't test enough!!
>>>
>>> Richard
>>>
>>> On Wed, Apr 29, 2015 at 4:08 PM, Niphlod  wrote:
>>>
 some time I just don't know what's going on with my writing. Am I 
 really that obscure ?

 can you spot the difference from mine

 *python -m unittest -v tests*

 and yours

 *python -m unittest -v validation.py*

 ?

 To be more precise (and abnoxious, maybe). Place yourself in the 
 root dir of pydal. then copy 

 *python -m unittest -v tests*

 and paste to your commandline. Then press enter. 


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

2015-05-04 Thread Ron Chatterjee
:-)

On Monday, May 4, 2015 at 12:15:07 PM UTC-4, Massimo Di Pierro wrote:
>
> Interesting!
>
> On Saturday, 2 May 2015 19:17:52 UTC-5, Joe Barnhart wrote:
>>
>> Saw this yesterday...
>>
>> https://github.com/timothycrosley/jiphy
>>
>> It translates Python to Javascript and Javascript to Python.  I could see 
>> it as an enhancement to the {{}} functionality in web2py to help write 
>> javascript code in python syntax.  C'mon, you know you already think in 
>> python -- just admit it and go all the way!
>>
>> One of the problems the author faced is that he needs a reliable way to 
>> tell when blocks terminate.  We already crossed that rubicon with our usage 
>> of "pass" for block closures.  If he added that it would make a nice 
>> javascript emitter from python source in our "view" pages.
>>
>> Edit:
>>
>> Found another one...
>>
>> https://github.com/niwibe/cobrascript
>>
>> This one is only Python-->Javascript (which is the direction I care about 
>> anyway)
>>
>>

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

2015-05-04 Thread isi_jca
RUTMARYS:

*¿Qué tipo de formulario estas usando para insertar los datos, en que base 
de datos estas trabajando?, el mensaje te esta indicando que estas tratando 
de insertar en la columna ente o *
*nomodelo un valor inexistente en las tablas  ente o modelo, revisa como 
esta definida la relación dentro de la base de datos.*
*Si puedes sube una versión reducida de tu aplicación conteniendo el 
modelo, *
*el controlador y la vista para ver si se puede reproducir el error. Por mi 
parte te comento que hice una carga usando un formulario de tipo grid y no 
tuve *
*el problema que comentas e usado labase de datos sqlite.*

*Saludos cordiales.*

*Saludos.*




El martes, 28 de abril de 2015, 16:26:23 (UTC-3), RUTMARYS TRUJILLO 
escribió:
>
> Hola tengo un problema, cada vez que introduzco los registros en el 
> formulario de la tabla proyecto sale el error class 
> 'sqlite3.integrityerror' foreign key constraint failed 
>
> no se que hacer... por favor agradecería su ayuda
>
> este es el modelo:
>
>db.define_table("ente",
>
> Field("ente", "string", default=None))
>
> db.define_table("modelo",
>
> Field("nommodelo", "string", default=None),
>
> Field("etapac", "string", default=None))
>
> db.define_table("proyecto",
>
> Field("codigop", "integer", default=None),
>
> Field("ente", 'reference ente'),
>
> Field("nommodelo", 'reference modelo'),
>
> Field("nombrep", "string", default=None),
>
> Field("tipo", "string", default=None),
>
> Field("estatus", "string", default=None),
>
> Field("fechai", "date", default=None),
>
> Field("fechaf", "date", default=None),
>
> Field("meta", "integer", default=None),
>
> Field("nomrep", "string", default=None),
>
> Field("aperep", "string", default=None),
>
> Field("telefono", default=None),
>
> Field("email", "string", default=None),
>
> Field("estado", "string", default=None),
>
> Field("municipio", "string", default=None),
>
> Field("parroquia", "string", default=None))
>
>  
>
> """ Relations between tables (remove fields you don't need from 
> requires) """
>
> db.proyecto.ente.requires=IS_IN_DB( db, 'ente.id', ' %(ente)s')
>
> db.proyecto.nommodelo.requires=IS_IN_DB( db, 'modelo.id', ' 
> %(nommodelo)s')
>
>
> *Error ticket for "PROGRAMA"*
>
> *Ticket ID*
>
> 127.0.0.1.2015-04-27.12-55-08.a4f7ea63-a2dc-40ca-9885-d63027a5b13e
>
> * foreign key constraint failed*
>
> *Versión*
>   
> *web2py™*
>  
> Version 2.9.12-stable+timestamp.2015.02.15.23.04.25
>   
> *Python*
>  
> Python 2.7.9: C:\Users\RUTMARYS\Documents\mi pasantia\web2py\web2py.exe 
> (prefix: C:\Python27)
>   
> *Rastreo*
>   
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
> 10.
> 11.
> 12.
> 13.
> 14.
> 15.
> 16.
>  
> Traceback *(*most recent call last
> *):   *File "C:\Users\RUTMARYS\Documents\mi 
> pasantia\web2py\gluon\restricted.py"*, *line 224*, **in *restricted
> *exec *ccode *in *environment
>   File "C:/Users/RUTMARYS/Documents/mi 
> pasantia/web2py/applications/PROGRAMA/controllers/appadmin.py" 
> *, 
> *line 654*, **in **<*module
> *>   *File "C:\Users\RUTMARYS\Documents\mi 
> pasantia\web2py\gluon\globals.py"*, *line 393*, **in **<**lambda*
> *> **self**.*_caller *= **lambda *f*: *f
> *()   *File "C:/Users/RUTMARYS/Documents/mi 
> pasantia/web2py/applications/PROGRAMA/controllers/appadmin.py" 
> *, 
> *line 152*, **in *insert
> *if *form*.*accepts*(*request*.*vars*, *session
> *):   *File "C:\Users\RUTMARYS\Documents\mi 
> pasantia\web2py\gluon\sqlhtml.py"*, *line 1677*, **in *accepts
> *self**.*vars*.*id *= **self**.*table*.*insert*(***fields
> *)   *File "C:\Users\RUTMARYS\Documents\mi 
> pasantia\web2py\gluon\packages\dal\pydal\objects.py"*, *line 737*, **in *
> insert
> ret *=  **self**.*_db*.*_adapter*.*insert*(**self**, **self**.*
> _listify*(*fields
> *))   *File "C:\Users\RUTMARYS\Documents\mi 
> pasantia\web2py\gluon\packages\dal\pydal\adapters\base.py"*, *line 719*, **in 
> *insert
> *raise *e
> IntegrityError*: *foreign key constraint failed
>   
> *Error snapshot* *[image: help]* 
> 
>
> (foreign key constraint failed)
>
>  
>

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

[web2py] what is syntax for including "writable = false" right in the table definition?

2015-05-04 Thread Alex Glaros
What is syntax for incorporating this:

db.Organization.id.writable=False

right inside the table definition in db.py?

thanks

Alex Glaros

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


[web2py] Re: Send Email like request_reset_password from another controller/view

2015-05-04 Thread Dave S


On Monday, May 4, 2015 at 9:29:00 AM UTC-7, 黄祥 wrote:
>
> why not just copy the user function in the controller 'default' and paste 
> it on the other controller?
>
>
I'm not sure that was what was being asked.   I think KR was wanting to 
know how to send emails.

General reading:
http://www.web2py.com/books/default/chapter/29/08/emails-and-sms>
(there are a couple more hits in the book for "mail.send)

Some reading in the group for that:

https://groups.google.com/d/msg/web2py/uKShDBsxI3s/RWLAlGoF61cJ>
shows filling the auth fields.

https://groups.google.com/d/msg/web2py/n-l0oxc5SwE/VsbG4Hd7VIUJ>
 recommendation to use scheduler because mail.send() is a blocking call.

https://groups.google.com/d/msg/web2py/8LN2jGVtOHg/OfLf1k_9xbsJ>
(if you are sending via gmail)

I haven't gotten around to trying any of this yet, so I can't answer any 
specific question, but there's more in the group archives, and most of the 
answer-providers are active here.

/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: What is the best way to do software testing in web2py?

2015-05-04 Thread 黄祥
another place to look is on web2pyslices.com
e.g.
http://www.web2pyslices.com/slice/show/1465/unittesting-doctesting-and-userinterface-testing
http://www.web2pyslices.com/slice/show/1392/unit-testing
http://www.web2pyslices.com/slice/show/1691/help-developers-adding-tests-to-web2py

best regards,
stifan

On Monday, May 4, 2015 at 11:16:30 PM UTC+7, pa...@cancamusa.net wrote:
>
> Not a dumb question, but it has been asked already!
>
> For example:
>
>
> https://groups.google.com/forum/#!searchin/web2py/test/web2py/cPN0m-iQNqc/1r0Q6TYY_f4J
>
> https://groups.google.com/forum/#!searchin/web2py/test/web2py/wsob6MVojc4/bFkiXrBBFZYJ
>
> https://groups.google.com/forum/#!searchin/web2py/test/web2py/CFwe4sxPLEg/bwMy3DS1RSgJ
>
> and you will find other older threads on this issue if you search a little 
> bit deeper
>

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

2015-05-04 Thread Dave S


On Monday, May 4, 2015 at 8:56:36 AM UTC-7, Christophe Meessen wrote:
 

> Is there a way to see logs of worker processes ? I couldn't find any. The 
> logs directory of web2py is empty. 
>
>
I think you have to make your tasks do logging.  Here's an example of how 
someone set it up:
https://groups.google.com/d/msg/web2py/91UugH6T3dQ/6xkgen92SesJ> 

I thought there was a more recent example, but I only find logging being 
*mentioned.*

/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: scheduler_run table remains empty

2015-05-04 Thread Dave S


On Monday, May 4, 2015 at 5:49:15 PM UTC-7, Dave S wrote:
>
>
>
> On Monday, May 4, 2015 at 8:56:36 AM UTC-7, Christophe Meessen wrote:
>  
>
>> Is there a way to see logs of worker processes ? I couldn't find any. The 
>> logs directory of web2py is empty. 
>>
>>
> I think you have to make your tasks do logging.  Here's an example of how 
> someone set it up:
> https://groups.google.com/d/msg/web2py/91UugH6T3dQ/6xkgen92SesJ> 
>
> I thought there was a more recent example, but I only find logging being 
> *mentioned.*
>

Ah, this may be what I was remembering:
https://groups.google.com/d/msg/web2py/91UugH6T3dQ/6xkgen92SesJ>

/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: scheduler_run table remains empty

2015-05-04 Thread Dave S


On Monday, May 4, 2015 at 5:51:03 PM UTC-7, Dave S wrote:
>
>
>
> On Monday, May 4, 2015 at 5:49:15 PM UTC-7, Dave S wrote:
>>
>>
>>
>> On Monday, May 4, 2015 at 8:56:36 AM UTC-7, Christophe Meessen wrote:
>>  
>>
>>> Is there a way to see logs of worker processes ? I couldn't find any. 
>>> The logs directory of web2py is empty. 
>>>
>>>
>> I think you have to make your tasks do logging.  Here's an example of how 
>> someone set it up:
>> https://groups.google.com/d/msg/web2py/91UugH6T3dQ/6xkgen92SesJ> 
>>
>> I thought there was a more recent example, but I only find logging being 
>> *mentioned.*
>>
>
> Ah, this may be what I was remembering:
> https://groups.google.com/d/msg/web2py/91UugH6T3dQ/6xkgen92SesJ>
>


I think the second link mentions logging.conf.  In there, you should have

[loggers]
keys=root,rocket,markdown,web2py,rewrite,cron,app,welcome,myApp


(Add myApp to the existing list of keys)

and
# myApp app handler
[logger_LogServer]
level=DEBUG
qualname=web2py.app.myApp
handlers=consoleHandler,rotatingFileHandler
propagate=0


I think those are default handlers, but check under the [handlers] section 
that they aren't commented out.

Note that the welcome app example in logging.conf uses "level=WARNING".
This filters out anything less urgent than a WARNING.  myApp has this level 
opened up to DEBUG.

It appears logging.conf is only read at startup, so when you make changes, 
bounce the web2py instance.

The output goes into logs/web2py.log unless you set things up differently, 
and you should see (among web2py's own entries) something like

2015-05-04 18:26:12,028 - web2py.app.myApp - DEBUG - BEGIN: top of 
myController

/dps "now if I can just remember where I posted this next time I need 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.


Re: [web2py] Init Script in Web2Py

2015-05-04 Thread A36_Marty
Likewise, I too am confused by Massimo's suggestion of using:

if cache.ram('init',lambda:db(db.auth_user).isempty(),None):
   arbitrary_function()


The True value indicating auth_user is empty is stored in the cache.ram 
'init' value, then never updated.   In my test code, 'arbitary_function' 
gets executed every time a page is loaded (since True for .isempty() is 
cached), even after records are added to auth_user

It's only after I stop web2py, restart (and the new value is stored in 
cache.ram 'init' does the function stop being executed.

How can setting a cache.ram value then setting the expiration of the value 
to None / never expire every work?





On Monday, March 31, 2014 at 2:57:00 PM UTC-5, Jay Martin wrote:
>
> I'm confused as to why this scenario needs caching.
>
> Isn't it true that for an empty user table:
>
> if cache.ram('init',lambda:db(db.auth_user).isempty(),None):
>arbitrary_function()
>
> will only cache the boolean value True and keep that value (True) in cache 
> forever (until the app is restarted), associated with the given key 'init'?
>
> Therefore, only this initial state is remembered. All future executions of 
> this code will only ever return this initial value (True), therefore the 
> subsequent arbitrary function will continue to be executed every cycle of 
> execution.
>
> Am I missing something? Many thanks!
>
>
>
> On Friday, August 10, 2012 11:23:56 PM UTC-4, Massimo Di Pierro wrote:
>>
>> you stil want to cache that
>>
>> if cache.ram('init',lambda:db(db.mytable).isempty(),None):
>>
>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group 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 is syntax for including "writable = false" right in the table definition?

2015-05-04 Thread Anthony
You can explicitly include the "id" field if desired -- just make it of 
type "id":

Field('id', 'id', writable=False)

Anthony

On Monday, May 4, 2015 at 7:46:31 PM UTC-4, Alex Glaros wrote:
>
> What is syntax for incorporating this:
>
> db.Organization.id.writable=False
>
> right inside the table definition in db.py?
>
> thanks
>
> Alex Glaros
>

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


[web2py] Re: Sublime Text web2py plugin

2015-05-04 Thread Gergely Orosz
Thank you Massimo,

I am going to improve it continuously

2015. május 4., hétfő 18:24:34 UTC+2 időpontban Massimo Di Pierro a 
következőt írta:
>
> Nice. Thank you! I added link form the web2py examples/ app.
>
> On Monday, 4 May 2015 05:28:55 UTC-5, Gergely Orosz wrote:
>>
>> Hi 4 All,
>>
>> I've started to develop a web2py plugin for Sublime Text 3.
>> I've implemented a few command I found very useful on my daily work.
>> If you have any idea how can I make it better and useful please visit the 
>> below link and submit your feature request there
>> Thanks in advance
>>
>> You can find the plugin: https://bitbucket.org/kfog/w2p
>>
>> If you have any question please feel free to ask here or on the Issue 
>> tracker
>>
>> All the best
>> Greg
>>
>

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