[web2py] request.args and request.args[-3] == 'view':

2015-11-19 Thread Gael Princivalle
Hello all.

With a grid I use a custom single record view.

So in my view I have this test:

if request.args and request.args[-3] == 'view':

for displaying the custom single record view.

But when I click on the add record button I have this error:
 list index out of range
Is there a way to use a custom single record view and the standard view for 
adding a record?

Thanks, regards.

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

2015-11-19 Thread Carla Raquel
Problem solved!Everything is working fine now!

quarta-feira, 18 de Novembro de 2015 às 15:35:32 UTC, Carla Raquel escreveu:
>
> I'm having some troubles importing from csv files while using a Postgres 
> connection, when a table has one or more references to other tables like so:
>
> db.define_table('Extension',
> Field('Person',db.auth_user),
> Field('Supervisor',db.auth_user),
> Field('Number','integer'),
> Field('Description','text')
>
>
>
> I have created this and the auth_user table on Postgres and imported the 
> auth_user contents from the csv file with no problems. I also have no 
> problems importing to other tables that have no external references. I have 
> the following error: ('Error', '23503','insert or update on table 
> "extensao" violates foreign key constraint "extension_person_fkey"'). Any 
> ideas?
>

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

2015-11-19 Thread lucas
yes, thank you, that works great.  you know i tried to see all of that in 
the source code api, but i couldn't find the source code api anymore.  lucas

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

2015-11-19 Thread Anthony
if len(request.args) >= 3 and request.args[-3] == 'view':

or:

if request.args(-3) == 'view':

request.args(index) is the same as request.args[index], except the former 
returns None rather than raising an exception if the index is out of range.

Finally, you could just do:

if 'view' in request.args:

The above should work as long as you're not working with a table named 
"view" (so there won't be any false positives).

Anthony

On Thursday, November 19, 2015 at 4:28:24 AM UTC-5, Gael Princivalle wrote:
>
> Hello all.
>
> With a grid I use a custom single record view.
>
> So in my view I have this test:
>
> if request.args and request.args[-3] == 'view':
>
> for displaying the custom single record view.
>
> But when I click on the add record button I have this error:
>  list index out of range
> Is there a way to use a custom single record view and the standard view 
> for adding a record?
>
> Thanks, regards.
>

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


Re: [web2py] Re: web2py and python3

2015-11-19 Thread Alessio Varalta
I think that for the programmer is not so important the version..always if 
the last is not too old..Python 2.7 is not too old but the problem that i 
see is that there is a good guide and good forum..web2py have many good 
features, but the real problem that I find( I am a web2py developer from 5 
months) is that there are low plugins and the low plugins have a bad 
documentation and low specific web2py library. For example php is old but 
there are many and many documentation, many library, many plugins and so 
many people but also many company use this language..Php is old but if you 
use this language you can find on google in 5minutes any information, you 
can create page in few time, many functionality in few time..So maybe is 
coul use the last version or the last framework example Play Java or 
another Python Framework or web3py but if you have a problem and there is 
any resources online and for one reserach and little problem spend hours is 
not the right way

On Thursday, 19 November 2015 07:11:41 UTC+1, Carlos Cesar Caballero wrote:
>
> I think that backward compatibility, when we look it from the distance, is 
> more a bug that a feature.
>
> Let me explain before they fall on me like wolves...
>
> In my opinion, the backward compatibility restricts innovation, because we 
> do not know what will happen within the next five years, and the new way to 
> go can be difficult or impossible (I mean with impossible not feasible) to 
> adapt. The other thing is that with the time, there is lot of old code 
> making the framework bigger, slower, and harder to maintain.
>
> With this I dont say that we need to change things every week, is very 
> good always work thinking in backward compatibility, but can not be a 
> straitjacket.
>
> But that's just my opinion.
>
> Greetings.
>
> PD: I can take to write because I'll be out most of the time the next two 
> weeks.
>
> El 18/11/15 a las 20:22, Richard Vézina escribió:
>
> What about a relax about backward compatibility with web2py 3.0?
>
> On Wed, Nov 18, 2015 at 6:08 PM, Dave S > 
> wrote:
>
>>
>>
>> On Wednesday, November 18, 2015 at 2:09:45 PM UTC-8, p a wrote: 
>>>
>>> I like the idea of a new framework, using python 3 but that's not the 
>>> most important. These days if we want to attract developers to our projects 
>>> we also need to have an API, and separated front end and back end. web2py 
>>> is great for the backend. The DAL is fantastic, and every time I get close 
>>> to an ORM I appreciate it even more. After trying out ractive for myself, I 
>>> really like Massimo's idea of integrating web2py and ractive.
>>> So I would love to see a new framework, if we can work on a clear 
>>> upgrade path that would take existing web2py apps to the new framework. 
>>> It's much easier to port a web app than a framework, on which many web apps 
>>> rely. I think we should release the web2py dev team from the chains of 
>>> backwards compatibility once every few years. If there is a new framework 
>>> based on the DAL and the other good stuff from web2py, but also using 
>>> ractive and other technologies and good ideas suggested on this list, then 
>>> porting our web apps would take a reasonable effort, and it would be well 
>>> worth it.
>>>
>>
>>
>> Maybe call it web2py-R ?
>>
>> /dps "only half in jest"
>>  
>> -- 
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> --- 
>> You received this message because you are 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: Small issue in DAL using ``

2015-11-19 Thread Niphlod
created and defined are different things. rephrasing: are you sure that the 
DAL instance defines the master table before the call to the sub-table 
definition happens ?

On Thursday, November 19, 2015 at 12:12:05 AM UTC+1, Maxwell Morais wrote:
>
> Thank you so much for the answer!
>
> Yes, I'm sure!
>
> I'm using a Master and Sub-table, the master table is created first, and 
> after the sub-table
>
> Em quarta-feira, 18 de novembro de 2015 18:12:46 UTC-2, Niphlod escreveu:
>>
>> are you sure that the referencED table exists before the referencING one ?
>>
>> On Wednesday, November 18, 2015 at 5:01:03 PM UTC+1, Maxwell Morais wrote:
>>>
>>> Any suggestion?
>>>
>>> Em segunda-feira, 16 de novembro de 2015 18:31:07 UTC-2, Maxwell Morais 
>>> escreveu:

 Hi all!

 I'm trying to implement a small layer over DAL, for my meta-schemas, 
 and I'm facing a very strange issue!

 My model is hosted here 
 https://github.com/MaxMorais/esquema/blob/master/esquema/lds.py#L248, 
 I commented the line that is raising a error in SQLite3.

 What is going wrong is:

 When I use my class to define a model, each sub-model make a explicity 
 reference to the master model, until here nothing special, I guess!

 While DAL try to create the table, I receive a error from SQLite3, 
 basicaly the SQL Statement is right, but the order of the statemets is 
 wrong, see it here 
 https://gist.github.com/MaxMorais/8c22caec9789032ea99a, the fine.SQL 
 is the file that I edited the order of the statements, and the wrong.SQL 
 is 
 the untouched SQL from DAL.

 Inspecting the code, I found the stretch of code that is generating 
 this statement, the stretch is this: 
 https://github.com/web2py/pydal/blob/fef5ed36f07f211aee7c9a5d2218d2b9f3b77c99/pydal/adapters/base.py#L312,
  
 but I dont have idea, why it is in this way!



 -- 

 Best Regards.

 Maxwell Morais
 Python Developer powered by Webnotes framework <3
 +55 11 954329659



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

2015-11-19 Thread Jason Solack
Hello,

I'm wondering if anyone is aware of a guide on creating a secure REST 
service with web2py.  I'd like to get help with creating authentication 
tokens and handshaking and then creating a temporary key allowing people to 
access the service for a set period of time.

Thank you for you help and information.

Jason

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

2015-11-19 Thread Dave S


On Thursday, November 19, 2015 at 4:25:07 PM UTC-8, Jason Solack wrote:
>
> Hello,
>
> I'm wondering if anyone is aware of a guide on creating a secure REST 
> service with web2py.  I'd like to get help with creating authentication 
> tokens and handshaking and then creating a temporary key allowing people to 
> access the service for a set period of time.
>
> Thank you for you help and information.
>
>

Niphlod has a JWT implementation that may be what you're looking for.


The list of features is in his post in the developer's forum.
https://groups.google.com/d/msg/web2py-developers/dXfUrHNI5Sg/gqNa3kXsCQAJ>

If you need some background on JWT, my reading list recently included
https://self-issued.info/docs/draft-ietf-oauth-json-web-token.html>
(that's the standard as of May; it's actually readable by users of 
standards as well the writers, I think)

Last I heard, there was still discussion about how to make this part of the 
distribution, because the "contrib" directory can become a maintenance 
black hole.

/dps

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


Re: [web2py] Re: Appconfig cast boolean

2015-11-19 Thread 黄祥
tested it. return an error if i put the value int = 1 as true in 
appconfig.ini
e.g.
privates/appconfig.ini
[auth]
create_user_groups = 0 ; return an error traceback when value = 1, when 
value = 0, no error occured, works as expected

models/db.py
auth.settings.create_user_groups = myconf.take('auth.create_user_groups', 
cast = lambda value: bool(int(value) ) )

error traceback:
Traceback

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.

Traceback (most recent call last):
  File "/Users/MacBookPro/site/web2py/gluon/restricted.py", line 227, in 
restricted
exec ccode in environment
  File 
"/Users/MacBookPro/site/web2py/applications/testing/controllers/default.py" 
, 
line 44, in 
  File "/Users/MacBookPro/site/web2py/gluon/globals.py", line 412, in 
self._caller = lambda f: f()
  File 
"/Users/MacBookPro/site/web2py/applications/testing/controllers/default.py" 
, 
line 19, in user
return dict(form=auth())
  File "/Users/MacBookPro/site/web2py/gluon/tools.py", line 1614, in __call__
return getattr(self, args[0])()
  File "/Users/MacBookPro/site/web2py/gluon/tools.py", line 2939, in register
self.settings.create_user_groups % form.vars, description)
TypeError: unsupported operand type(s) for %: 'bool' and 'Storage'

Error snapshot [image: help] 


(unsupported operand type(s) for %: 'bool' and 
'Storage')

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

2015-11-19 Thread Mark Graves
I just tried to reproduce your error and could not.

Judging from the error, are you sure you are passing in the string
'auth.create_user_groups' and not auth.create_user_groups as a variable?



On Thu, Nov 19, 2015 at 9:32 PM, 黄祥  wrote:

> tested it. return an error if i put the value int = 1 as true in
> appconfig.ini
> e.g.
> privates/appconfig.ini
> [auth]
> create_user_groups = 0 ; return an error traceback when value = 1, when
> value = 0, no error occured, works as expected
>
> models/db.py
> auth.settings.create_user_groups = myconf.take('auth.create_user_groups',
> cast = lambda value: bool(int(value) ) )
>
> error traceback:
> Traceback
>
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
> 10.
> 11.
> 12.
> 13.
> 14.
>
> Traceback (most recent call last):
>   File "/Users/MacBookPro/site/web2py/gluon/restricted.py", line 227, in 
> restricted
> exec ccode in environment
>   File 
> "/Users/MacBookPro/site/web2py/applications/testing/controllers/default.py" 
> , 
> line 44, in 
>   File "/Users/MacBookPro/site/web2py/gluon/globals.py", line 412, in 
> self._caller = lambda f: f()
>   File 
> "/Users/MacBookPro/site/web2py/applications/testing/controllers/default.py" 
> , 
> line 19, in user
> return dict(form=auth())
>   File "/Users/MacBookPro/site/web2py/gluon/tools.py", line 1614, in __call__
> return getattr(self, args[0])()
>   File "/Users/MacBookPro/site/web2py/gluon/tools.py", line 2939, in register
> self.settings.create_user_groups % form.vars, description)
> TypeError: unsupported operand type(s) for %: 'bool' and 'Storage'
>
> Error snapshot [image: help]
> 
>
> (unsupported operand type(s) for %: 'bool'
> and 'Storage')
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.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/rohbrJEZG_E/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [web2py] Re: Appconfig cast boolean

2015-11-19 Thread 黄祥
pardon, i just tried, what is discussed in this thread on my configuration, 
parsing as string .'auth.create_user_groups' not auth.create_user_groups as 
a variable
e.g.
models/db.py
auth.settings.create_user_groups = False

i want to change the configuration into privates/appconfig.ini with :
e.g.
privates/appconfig.ini
[auth]
create_user_groups = 0 ; return an error traceback when value = 1, when 
value = 0, no error occured, works as expected

models/db.py
auth.settings.create_user_groups = myconf.take('auth.create_user_groups', 
cast = lambda value: bool(int(value) ) )

but it returns an error when i set the value in privates/appconfig.ini into 
1

any idea?

thanks n best regards,
stifan


On Friday, November 20, 2015 at 11:36:33 AM UTC+7, Mark Graves wrote:
>
> I just tried to reproduce your error and could not.
>
> Judging from the error, are you sure you are passing in the string 
> 'auth.create_user_groups' and not auth.create_user_groups as a variable?
>
>
>
> On Thu, Nov 19, 2015 at 9:32 PM, 黄祥 > 
> wrote:
>
>> tested it. return an error if i put the value int = 1 as true in 
>> appconfig.ini
>> e.g.
>> privates/appconfig.ini
>> [auth]
>> create_user_groups = 0 ; return an error traceback when value = 1, when 
>> value = 0, no error occured, works as expected
>>
>> models/db.py
>> auth.settings.create_user_groups = myconf.take('auth.create_user_groups', 
>> cast = lambda value: bool(int(value) ) )
>>
>> error traceback:
>> Traceback
>>
>> 1.
>> 2.
>> 3.
>> 4.
>> 5.
>> 6.
>> 7.
>> 8.
>> 9.
>> 10.
>> 11.
>> 12.
>> 13.
>> 14.
>>
>> Traceback (most recent call last):
>>   File "/Users/MacBookPro/site/web2py/gluon/restricted.py", line 227, in 
>> restricted
>> exec ccode in environment
>>   File 
>> "/Users/MacBookPro/site/web2py/applications/testing/controllers/default.py" 
>> , 
>> line 44, in 
>>   File "/Users/MacBookPro/site/web2py/gluon/globals.py", line 412, in 
>> 
>> self._caller = lambda f: f()
>>   File 
>> "/Users/MacBookPro/site/web2py/applications/testing/controllers/default.py" 
>> , 
>> line 19, in user
>> return dict(form=auth())
>>   File "/Users/MacBookPro/site/web2py/gluon/tools.py", line 1614, in __call__
>> return getattr(self, args[0])()
>>   File "/Users/MacBookPro/site/web2py/gluon/tools.py", line 2939, in register
>> self.settings.create_user_groups % form.vars, description)
>> TypeError: unsupported operand type(s) for %: 'bool' and 'Storage'
>>
>> Error snapshot [image: help] 
>> 
>>
>> (unsupported operand type(s) for %: 'bool' 
>> and 'Storage')
>>
>> -- 
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.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/rohbrJEZG_E/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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: Appconfig cast boolean

2015-11-19 Thread Mark Graves
Can you reproduce this error in a fresh welcome app?

Then you can send just the one line?

Is it solely:

; auth
[auth]
create_user_groups = 1

VS

; auth
[auth]
create_user_groups = 0

?



On Thu, Nov 19, 2015 at 10:44 PM, 黄祥  wrote:

> pardon, i just tried, what is discussed in this thread on my
> configuration, parsing as string .'auth.create_user_groups' not
> auth.create_user_groups as a variable
> e.g.
> models/db.py
> auth.settings.create_user_groups = False
>
> i want to change the configuration into privates/appconfig.ini with :
> e.g.
> privates/appconfig.ini
> [auth]
> create_user_groups = 0 ; return an error traceback when value = 1, when
> value = 0, no error occured, works as expected
>
> models/db.py
> auth.settings.create_user_groups = myconf.take('auth.create_user_groups',
> cast = lambda value: bool(int(value) ) )
>
> but it returns an error when i set the value in privates/appconfig.ini
> into 1
>
> any idea?
>
> thanks n best regards,
> stifan
>
>
> On Friday, November 20, 2015 at 11:36:33 AM UTC+7, Mark Graves wrote:
>>
>> I just tried to reproduce your error and could not.
>>
>> Judging from the error, are you sure you are passing in the string
>> 'auth.create_user_groups' and not auth.create_user_groups as a variable?
>>
>>
>>
>> On Thu, Nov 19, 2015 at 9:32 PM, 黄祥  wrote:
>>
>>> tested it. return an error if i put the value int = 1 as true in
>>> appconfig.ini
>>> e.g.
>>> privates/appconfig.ini
>>> [auth]
>>> create_user_groups = 0 ; return an error traceback when value = 1, when
>>> value = 0, no error occured, works as expected
>>>
>>> models/db.py
>>> auth.settings.create_user_groups =
>>> myconf.take('auth.create_user_groups', cast = lambda value: bool(int(value)
>>> ) )
>>>
>>> error traceback:
>>> Traceback
>>>
>>> 1.
>>> 2.
>>> 3.
>>> 4.
>>> 5.
>>> 6.
>>> 7.
>>> 8.
>>> 9.
>>> 10.
>>> 11.
>>> 12.
>>> 13.
>>> 14.
>>>
>>> Traceback (most recent call last):
>>>   File "/Users/MacBookPro/site/web2py/gluon/restricted.py", line 227, in 
>>> restricted
>>> exec ccode in environment
>>>   File 
>>> "/Users/MacBookPro/site/web2py/applications/testing/controllers/default.py" 
>>> , 
>>> line 44, in 
>>>   File "/Users/MacBookPro/site/web2py/gluon/globals.py", line 412, in 
>>> 
>>> self._caller = lambda f: f()
>>>   File 
>>> "/Users/MacBookPro/site/web2py/applications/testing/controllers/default.py" 
>>> , 
>>> line 19, in user
>>> return dict(form=auth())
>>>   File "/Users/MacBookPro/site/web2py/gluon/tools.py", line 1614, in 
>>> __call__
>>> return getattr(self, args[0])()
>>>   File "/Users/MacBookPro/site/web2py/gluon/tools.py", line 2939, in 
>>> register
>>> self.settings.create_user_groups % form.vars, description)
>>> TypeError: unsupported operand type(s) for %: 'bool' and 'Storage'
>>>
>>> Error snapshot [image: help]
>>> 
>>>
>>> (unsupported operand type(s) for %: 'bool'
>>> and 'Storage')
>>>
>>> --
>>> Resources:
>>> - http://web2py.com
>>> - http://web2py.com/book (Documentation)
>>> - http://github.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/rohbrJEZG_E/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 a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/rohbrJEZG_E/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [web2py] Re: Appconfig cast boolean

2015-11-19 Thread Mark Graves
Also:

auth.settings.create_user_groups = myconf.take('auth.create_user_groups',
cast=lambda value: bool(int(value)))



On Thu, Nov 19, 2015 at 10:53 PM, Mark Graves  wrote:

> Can you reproduce this error in a fresh welcome app?
>
> Then you can send just the one line?
>
> Is it solely:
>
> ; auth
> [auth]
> create_user_groups = 1
>
> VS
>
> ; auth
> [auth]
> create_user_groups = 0
>
> ?
>
>
>
> On Thu, Nov 19, 2015 at 10:44 PM, 黄祥  wrote:
>
>> pardon, i just tried, what is discussed in this thread on my
>> configuration, parsing as string .'auth.create_user_groups' not
>> auth.create_user_groups as a variable
>> e.g.
>> models/db.py
>> auth.settings.create_user_groups = False
>>
>> i want to change the configuration into privates/appconfig.ini with :
>> e.g.
>> privates/appconfig.ini
>> [auth]
>> create_user_groups = 0 ; return an error traceback when value = 1, when
>> value = 0, no error occured, works as expected
>>
>> models/db.py
>> auth.settings.create_user_groups = myconf.take('auth.create_user_groups',
>> cast = lambda value: bool(int(value) ) )
>>
>> but it returns an error when i set the value in privates/appconfig.ini
>> into 1
>>
>> any idea?
>>
>> thanks n best regards,
>> stifan
>>
>>
>> On Friday, November 20, 2015 at 11:36:33 AM UTC+7, Mark Graves wrote:
>>>
>>> I just tried to reproduce your error and could not.
>>>
>>> Judging from the error, are you sure you are passing in the string
>>> 'auth.create_user_groups' and not auth.create_user_groups as a variable?
>>>
>>>
>>>
>>> On Thu, Nov 19, 2015 at 9:32 PM, 黄祥  wrote:
>>>
 tested it. return an error if i put the value int = 1 as true in
 appconfig.ini
 e.g.
 privates/appconfig.ini
 [auth]
 create_user_groups = 0 ; return an error traceback when value = 1, when
 value = 0, no error occured, works as expected

 models/db.py
 auth.settings.create_user_groups =
 myconf.take('auth.create_user_groups', cast = lambda value: bool(int(value)
 ) )

 error traceback:
 Traceback

 1.
 2.
 3.
 4.
 5.
 6.
 7.
 8.
 9.
 10.
 11.
 12.
 13.
 14.

 Traceback (most recent call last):
   File "/Users/MacBookPro/site/web2py/gluon/restricted.py", line 227, in 
 restricted
 exec ccode in environment
   File 
 "/Users/MacBookPro/site/web2py/applications/testing/controllers/default.py"
  
 ,
  line 44, in 
   File "/Users/MacBookPro/site/web2py/gluon/globals.py", line 412, in 
 
 self._caller = lambda f: f()
   File 
 "/Users/MacBookPro/site/web2py/applications/testing/controllers/default.py"
  
 ,
  line 19, in user
 return dict(form=auth())
   File "/Users/MacBookPro/site/web2py/gluon/tools.py", line 1614, in 
 __call__
 return getattr(self, args[0])()
   File "/Users/MacBookPro/site/web2py/gluon/tools.py", line 2939, in 
 register
 self.settings.create_user_groups % form.vars, description)
 TypeError: unsupported operand type(s) for %: 'bool' and 'Storage'

 Error snapshot [image: help]
 

 (unsupported operand type(s) for %: 'bool'
 and 'Storage')

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

Re: [web2py] Re: Appconfig cast boolean

2015-11-19 Thread Mark Graves
It appears that auth.settings.create_user_groups takes either False or the
string that formats the user group creation message.

So you'll need to provide a string format representation ie '%(id)s' as is
shown in the error.

However that won't convert to a boolean, so your cast function will fail.

-Mark

On Thu, Nov 19, 2015 at 11:22 PM, 黄祥  wrote:

> same result, here is step i took
> 1. create new simple application from web2py admin named a
> 2. add auth in privates/appconfig.ini
> [auth]
> create_user_groups = 1
> 3. add auth in models/db.py
> auth.settings.create_user_groups = myconf.take('auth.create_user_groups',
> cast = lambda value: bool(int(value) ) )
>
> attached the simple app that i took the step above, when i change
> create_user_groups = 0, no error occured when i sign up, but, when i set
> create_user_group = 1, same error traceback occured, when i sign up
>
> 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 a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/rohbrJEZG_E/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] How to control the access with auth_group?

2015-11-19 Thread Clément Lauprêtre
Hello,

I developed an app accessible by different users. There is 4 groups of 
users who can access to different views.
I would like to know how to allow the access to some views for only one 
group.

Thanks

Clément.

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


[web2py] web2py

2015-11-19 Thread MOHANA LAHARI Tanguturi
i am using this syntax

results = 
json.load(urllib.urlopen("http://www.pricetree.com/dev/api.ashx?pricetreeId=11072&apikey=7770AD31-382F-4D32-8C36-3743C0271699";))


it is showing this error

 HTTP Error 403: Forbidden
what should i do
pls reply to this qustion

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

2015-11-19 Thread Bart
Hi Anthony,

This solution you mention is, with some minor changes, still working in the 
current version. I've managed to get the change working in the 2.12.3 
version of web2py.js:
Change function trap_form to:

  trap_form: function(action, target) {
/* traps any LOADed form */
$('#' + target + ' form').each(function(i) {
  var form = $(this);
  if(form.hasClass('no_trap')) {
return;
  }
  form.attr('data-w2p_target', target);
  var url = form.attr('action');
  if((url === "") || (url === "#") || (typeof url === 'undefined')) 
{
/* form has no action. Use component url. */
url = action;
  }
 /* begin change  */
 if(form.find('.upload').length>0) {
form.ajaxForm({
  url: url,
  success: function(data, statusText, xhr) {
jQuery('#'+target).html(xhr.responseText);
web2py.trap_form(action, target);
web2py.ajax_init();
  }
});
 } else { /* end change */
  form.submit(function(e) {
web2py.disableElement(form.find(web2py.formInputClickSelector));
web2py.hide_flash();
web2py.ajax_page('post', url, form.serialize(), target, form);
e.preventDefault();
  });
 };
  form.on('click', web2py.formInputClickSelector, function(e) {
e.preventDefault();
var input_name = $(this).attr('name');
if(input_name != undefined) {
  $('').attr('name', input_name)
.attr('value', $(this).val()).appendTo(form)
}
form.trigger('submit');
  });
});
  },

Regards,

Bart

Op dinsdag 7 augustus 2012 06:43:36 UTC+2 schreef Anthony:
>
> At the end of this section 
>  in the book it 
> says:
>
> *Please note:* Because Ajax post does not support multipart forms, i.e. 
>> file uploads, upload fields will not work with the LOAD component. You 
>> could be fooled into thinking it would work because upload fields will 
>> function normally if POST is done from the individual component's .load 
>> view. Instead, uploads are done with ajax-compatible 3rd-party widgets and 
>> web2py manual upload store commands.
>
>
> In the web2py cookbook 
> ,
>  
> there is a recipe for this. The app associated with that recipe can be 
> downloaded here: 
> https://github.com/mdipierro/web2py-recipes-source/blob/master/apps/04_advanced_forms/web2py.app.upload.w2p.
>  
> It uses the jquery.form.js plugin: 
> http://jquery.malsup.com/form/#file-upload. The app includes a customized 
> web2py_ajax.js (which is named web2py.js in more recent versions of web2py) 
> with a custom version of web2py_trap_form():
>
> function web2py_trap_form(action,target) {
>jQuery('#'+target+' form').each(function(i){
>  var form=jQuery(this);
>  if(!form.hasClass('no_trap'))
>if(form.find('.upload').length>0) {
>  form.ajaxForm({
>url: action,
>success: function(data, statusText, xhr) {
>  jQuery('#'+target).html(xhr.responseText);
>  web2py_trap_form(action,target);
>  web2py_ajax_init();
>}
>  });
>} else { 
> form.submit(function(e){
>   jQuery('.flash').hide().html('');
>   web2py_ajax_page('post',action,form.serialize(),target);
>   e.preventDefault();
> });
>}
>});
> }
>
> Anthony
>
> On Monday, August 6, 2012 11:49:27 PM UTC-4, Picheth wrote:
>>
>> I have a problem with the upload file using the LOAD (., ajax = True)
>>
>>
>> please .. any help, cues or snippets of codes to accomplish this ... will 
>> be greatly appreciated
>>
>> Picheth.
>>
>

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

2015-11-19 Thread mfarees . knysys
I need some help with a DAL query. I'm trying to update records, but my 
query contains joins.

*tournament Table*
| id | start | end |

*match Table*
| id | tournamentID | home_team | away_team | start | end |

db( ((db.tournament.start >= '2015-01-01 00:00:00') & (db.tournament.end <= 
'2015-12-31 00:00:00')) &\
(db.tournament.id == db.match.tournamentID) ).update(start= 
db.match.start + timedelta(hours=1), end= db.match.end + timedelta(hours=1))

I want to add 1 hour to the start and end fields *in the match table* (not 
the tournament table). But when I try to run this DAL statement, I get an 
error saying "Too many tables" (because of the join, I suppose). What would 
be an alternate single query for this?
Thanks
 
Note: Start and End columns are datetime.

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

2015-11-19 Thread Sam Heather
Thanks for the reply Kiran - I have gone through that section of the book a 
couple of times and can't find an answer to what I want.

I should clarify: 'myc' is a generic token - a URL argument - I should have 
written it as  or .

The full path of the application is /default/company/myc, where 'default' 
is the package, company is the function, and 'myc' is a URL argument. Is it 
possible to do this with routes.py without adding a new entry to the 
routes,py file for every instance of the redirect (an ever changing list, 
thousands of entries, requiring lots of reloading of the routes.py!).

Does what I am trying to do make a bit more sense now?

Thanks!

Sam

On Tuesday, November 17, 2015 at 9:24:29 AM UTC+1, Kiran Subbaraman wrote:
>
> There is an example in the book related to redirection: 
> http://web2py.com/books/default/chapter/29/04/the-core?search=routes#Pattern-based-system
> A less elegant way would be to: Using routes.py, map the /myc to the path 
> /app/controller/func. In the func(), redirect('url path to company/myc'). 
> This is, if you want to manage all of this in your app code.
> nginx may have something for your case ... am not conversant enough in 
> that though.
>
> 
> Kiran Subbaramanhttp://subbaraman.wordpress.com/about/
>
> On Tue, 17-11-2015 4:20 AM, Sam Heather wrote:
>
> Hi there,
>
> I am trying to create redirects using web2py from effectively the default 
> index page (or just the route of the domain/package). Some keywords (such 
> as 'about', stored in a list) wouldn't redirect. However, all not in that 
> list would redirect.
>
> The desired behaviour is: 
> https://startbean.com/about -> No redirect
> https://startbean.com/myc -> https://startbean.com/company/myc
>
> The default page that is shown at startbean.com is from the package 
> 'default' and is called 'index'. If the redirect was as in the below, it 
> would be easy:
>
> https://startbean.com/default/about -> No redirect
> https://startbean.com/default/index/myc -> 
> https://startbean.com/default/company/myc
>
> because the myc is a URL argument. But when it is from the root, Web2Py 
> tries to open a package called 'myc' and then finds no page (index or 
> controller function) so errors.
>
> What is the best way of handling this? I was trying with routes.py, but 
> couldn't figure out a way to do this (am pretty sure it is not supported). 
> I thought about a redirect for the token after / to a page called 
> /default/redirect/ which would then decide about the redirect, but 
> there's no way to stop the infinite loop. Another possible solution was a 
> tweak to the nginx config so redirect when there is one token after the /, 
> but again I think this causes a problem with the about.
>
> Maybe there is a catch-all function for controllers that I haven't found? 
> I've gone through the web2py book and found nothing - any ideas very 
> welcome!
>
> Thanks,
>
> Sam
> -- 
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> --- 
> You received this message because you are 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] Compile .less files?

2015-11-19 Thread Thee Cherry
Hi,

I try to import (compile) .less files in web2py.
I did find in the web2py book that you can import less files with
response.files

Did try to import a less file with that in the layout.html
{{response.files.append(URL('static','less/style.less'))}}

But in the source code from the finish page, i find just a 

https://192.168.101.144:8000/default/static/less/style.less>" 
rel="stylesheet/less" type="text/css" />


and not a compiled css. There is the failure?

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

2015-11-19 Thread Andy Southgate
Thanks for there reply.  I'm using 15 workers with a one second heartbeat. 
 I don't think this is fundamentally a load problem though - it looks like 
a case of two things taking the same locks in a different order.  Maybe the 
situation mentioned here 
http://www.postgresql.org/docs/9.4/static/explicit-locking.html section 
13.3.4 'deadlocks can also occur as the result of row-level locks'.

I've been running an experimental workaround overnight, adding this:

if counter % 5 == 0 or mybackedstatus == PICK:
try:
*db.commit()*
*db.executesql("LOCK TABLE scheduler_worker;")*
# delete dead workers

and haven't seen a recurrence yet.  If this is the problem, maybe if the 
first update touched *all* of the rows it would achieve the same thing, in 
a more compatible way.

Andy

On Tuesday, 17 November 2015 11:02:07 UTC, Niphlod wrote:
>
> how many workers you have and what heartbeat are you using ?
>
> it's no news that the scheduler_worker table is the most "congested" 
> because it's where most of the IPC happens. That's why I should release a 
> version that does IPC on redis, but alas, I didn't find the time yet to 
> polish the code.
>
> BTW: as it is the code can't be made "less pushy": every transaction you 
> see is necessary to avoid bugs
>
> On Tuesday, November 17, 2015 at 1:47:00 AM UTC+1, Andy Southgate wrote:
>>
>> Hi all,
>>
>> First of all, many thanks to all involved in web2py, it's been working 
>> out very well for me :)
>>
>> I've been using the scheduler a lot, and I think I've found a source of 
>> database deadlocks.  As far as I can tell, it happens when the system is 
>> deleting what it thinks are dead workers because heartbeats have timed out, 
>> and electing a new ticker, and two or more worker processes are trying to 
>> do this at the same time.  They each update there own heartbeats and then 
>> do several update/delete operations on a number of the scheduler_worker 
>> rows, without intervening db.commits, and the 'many rows' operations 
>> collide with each other.  These can range from simple:
>>
>> 2015-11-16 11:02:33 GMT PID=5244 trans=72287062 ERROR:  40P01: deadlock 
>> detected
>> 2015-11-16 11:02:33 GMT PID=5244 trans=72287062 DETAIL:  Process 5244 
>> waits for ShareLock on transaction 72287313; blocked by process 6236.
>> Process 6236 waits for ShareLock on transaction 72287062; blocked by 
>> process 5244.
>> Process 5244: UPDATE scheduler_worker SET is_ticker='F' WHERE 
>> (scheduler_worker.worker_name <> 'UKVMAAS#6316');
>> Process 6236: DELETE FROM scheduler_worker WHERE 
>> (((scheduler_worker.last_heartbeat < '2015-11-16 11:00:44') AND 
>> (scheduler_worker.status = 'ACTIVE')) OR ((scheduler_worker.last_heartbeat 
>> < '2015-11-16 10:46:44') AND (scheduler_worker.status <> 'ACTIVE')));
>>
>> to spectacular:
>>
>> 2015-11-16 11:02:16 GMT PID=6772 trans=72287377 ERROR:  40P01: deadlock 
>> detected
>> 2015-11-16 11:02:16 GMT PID=6772 trans=72287377 DETAIL:  Process 6772 
>> waits for ExclusiveLock on tuple (311,9) of relation 16681 of database 
>> 16384; blocked by process 564.
>> Process 564 waits for ShareLock on transaction 72287313; blocked by 
>> process 6236.
>> Process 6236 waits for AccessExclusiveLock on tuple (0,19) of relation 
>> 16908 of database 16384; blocked by process 6804.
>> Process 6804 waits for ShareLock on transaction 72287062; blocked by 
>> process 5244.
>> Process 5244 waits for ShareLock on transaction 72287388; blocked by 
>> process 728.
>> Process 728 waits for ExclusiveLock on tuple (311,9) of relation 16681 of 
>> database 16384; blocked by process 6772.
>> Process 6772: UPDATE scheduler_task SET 
>> status='QUEUED',assigned_worker_name='' WHERE 
>> ((scheduler_task.assigned_worker_name IN (SELECT 
>>  scheduler_worker.worker_name FROM scheduler_worker WHERE 
>> (((scheduler_worker.last_heartbeat < '2015-11-16 11:01:01') AND 
>> (scheduler_worker.status = 'ACTIVE')) OR ((scheduler_worker.last_heartbeat 
>> < '2015-11-16 10:47:01') AND (scheduler_worker.status <> 'ACTIVE') AND 
>> (scheduler_task.status = 'RUNNING'));
>> Process 564: UPDATE scheduler_task SET 
>> status='QUEUED',assigned_worker_name='' WHERE 
>> ((scheduler_task.assigned_worker_name IN (SELECT 
>>  scheduler_worker.worker_name FROM scheduler_worker WHERE 
>> (((scheduler_worker.last_heartbeat < '2015-11-16 11:00:45') AND 
>> (scheduler_worker.status = 'ACTIVE')) OR ((scheduler_worker.last_heartbeat 
>> < '2015-11-16 10:46:45') AND (scheduler_worker.status <> 'ACTIVE') AND 
>> (scheduler_task.status = 'RUNNING'));
>> Process 6236: DELETE FROM scheduler_worker WHERE 
>> (((scheduler_worker.last_heartbeat < '2015-11-16 11:00:44') AND 
>> (scheduler_worker.status = 'ACTIVE')) OR ((scheduler_worker.last_heartbeat 
>> < '2015-11-16 10:46:44') AND (scheduler_worker.status <> 'ACTIVE')));
>> Process 6804: UPDATE scheduler_worker SET 
>> status='ACTIVE',last_heartbeat='2015-11-16 
>> 11:00:36',worker_stats='{"status": "ACTIVE", "errors": 0, "

[web2py] How to add an hour to datetime field

2015-11-19 Thread mfarees . knysys


I have a table that I have created (in models) using 

db.define_table('myTable',
Field('start', type='datetime', requires=NE)
)

I have some records in this table, in this format: '2015-12-31 00:00:00' (this 
is on id = 1)


I want to run a query that will add one hour to this time, for each row.


db(db.myTable.id == 1).update(start = db.myTable.start + timedelta(hours=1))


But when I execute the above query, it changes the start value to '2015-12-31 
00:00:01'. And if I run the same query again it changes it to '-00-00 
00:00:00'. What am I doing wrong here and how can I fix this?


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


[web2py] Re: Web2py + Google Cloud Endpoints: There is a way to make them work together ?

2015-11-19 Thread Victor
Hello, Carlos.
Did you manage to make this working?

On Wednesday, October 15, 2014 at 4:51:43 AM UTC+2, Cláudio Bastos wrote:
>
> Hi, 
>
> i'm struggling to make Web2py and Google Cloud Endpoints work together.
>
> When I change app.yaml to include :
>
>
> - url: /_ah/spi/.*
>   script: my_api.application
>
> libraries:
> - name: pycrypto
>   version: "2.6"
>
> it tells me :
>
>
> INFO 2014-10-14 23:42:24,845 module.py:659] default: "POST 
>> /_ah/spi/BackendService.getApiConfigs HTTP/1.1" 500 -
>> INFO 2014-10-14 23:42:24,846 module.py:659] default: "GET 
>> /_ah/api/discovery/v1/apis HTTP/1.1" 500 60
>> ERROR2014-10-15 02:42:24,927 wsgi.py:262] 
>> Traceback (most recent call last):
>>   File "C:\Program Files\Google\Cloud 
>> SDK\google-cloud-sdk\platform\google_appengine\google\appengine\runtime\wsgi.py",
>>  
>> line 239, in Handle
>> handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
>>   File "C:\Program Files\Google\Cloud 
>> SDK\google-cloud-sdk\platform\google_appengine\google\appengine\runtime\wsgi.py",
>>  
>> line 298, in _LoadHandler
>> handler, path, err = LoadObject(self._handler)
>>   File "C:\Program Files\Google\Cloud 
>> SDK\google-cloud-sdk\platform\google_appengine\google\appengine\runtime\wsgi.py",
>>  
>> line 84, in LoadObject
>> obj = __import__(path[0])
>>   File "C:\Devel\workspace\myproject\gaehandler.py", line 52, in 
>> class MyApi(remote.service):
>> AttributeError: 'module' object has no attribute 'service'
>
>
> So it's like it couldn't import protorpc module.
> I checked my appengine sdk and see that there is protorpc/remote.py with 
> Service class in there.
>
> Does anyone know any way to make it happen?
>
> 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] cx_oracle web2Py on windows

2015-11-19 Thread rochdi hassine
I tried to connect web2py to my Oracle database.
I have deployed web2py on a windows environment where python was already 
installed with cx_oracle.
But web2py haven't run with Oracle cause it can't see the driver cx_oracle 
that is installed in Python directory.
I tried to redeploy cx_oracle to the directory of web2py but it doesn't 
work.

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

2015-11-19 Thread Massimo Di Pierro
The problem is probably in the layout.html you are using. It may be 
declaring an encoding other than utf8.

On Monday, 16 November 2015 18:46:58 UTC-6, Patrik Skřivánek wrote:
>
> Hello,
>
> I have in my controller simple input form:
>
> form=FORM('Search user: ', INPUT(_name='search'), INPUT(_type='submit'))
>
> When I submit character from other than first 128 char of ascii table (for 
> example: ů,á..), output is this error:
>
> Traceback (most recent call last):
>   File "/home/web2py/gluon/restricted.py", line 227, in restricted
> exec ccode in environment
>   File "applications/eden/compiled/views.development.patriks.html.py", line 
> 397, in 
> UnicodeDecodeError: 'ascii' codec can't decode byte 0xc5 in position 0: 
> ordinal not in range(128)
>
>  at 0xbabcc1d0, file 
> "applications/eden/compiled/views.development.patriks.html.py", line 1>
>
> How can I fix this input? 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: creating a secure rest service

2015-11-19 Thread Massimo Di Pierro
which reminds me... I will include it in the next web2py version.

On Thursday, 19 November 2015 19:08:46 UTC-6, Dave S wrote:
>
>
>
> On Thursday, November 19, 2015 at 4:25:07 PM UTC-8, Jason Solack wrote:
>>
>> Hello,
>>
>> I'm wondering if anyone is aware of a guide on creating a secure REST 
>> service with web2py.  I'd like to get help with creating authentication 
>> tokens and handshaking and then creating a temporary key allowing people to 
>> access the service for a set period of time.
>>
>> Thank you for you help and information.
>>
>>
>
> Niphlod has a JWT implementation that may be what you're looking for.
>
>
> The list of features is in his post in the developer's forum.
>  https://groups.google.com/d/msg/web2py-developers/dXfUrHNI5Sg/gqNa3kXsCQAJ
> >
>
> If you need some background on JWT, my reading list recently included
> https://self-issued.info/docs/draft-ietf-oauth-json-web-token.html>
> (that's the standard as of May; it's actually readable by users of 
> standards as well the writers, I think)
>
> Last I heard, there was still discussion about how to make this part of 
> the distribution, because the "contrib" directory can become a maintenance 
> black hole.
>
> /dps
>
>

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


[web2py] Re: How to control the access with auth_group?

2015-11-19 Thread 黄祥
i think you can use conditional check auth.has_membership, either put it on 
models/menu.py, controllers or even in views
e.g.
if auth.has_membership(role = 'Admin'):

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.