[web2py] helper function - query returns no rows

2014-01-11 Thread zee
Hi,

First post here, so thanks in advance for any help provided.

I have a sub-routine in my main function of a a controller that looks like 
this :

if form.vars.npc:
pass
else:
form.vars.npc = 0
onrp_row = db(
(db.npa.npa==form.vars.npa) & 
(db.npa.loc_name_short==form.vars.lns) & 
(db.npa.npa_complement==form.vars.npc)
).select(db.npa.id)
onrp_id=onrp_row[0].id

Essentially, I use this to update a record I just inserted in the db with a 
foreign primary key from an external data source. I need to keep this 
reference for data consistency purposes in case the external source is 
modified.

This sub-routine behaves as expected.

My problem is that I am trying to make a helper function out of this 
sub-routine. I have extracted it from the index() function and my 
controller now looks like this :

def get_onrp(npa, lns, npc=0):

id=db((db.npa.npa==npa)&(db.npa.loc_name_short==lns)&(db.npa.npa_complement==npc)).select(db.npa.id)
if id:
return id[0].id
else:
return 0

def index():
# SQLFORM.factory here

onrp_id = get_onrp(form.vars.npa, form.vars.lns, form.vars.npc)

# rest of controller logic here

Now, the get_onrp function systematically returns 0, i.e. the db query 
returns no rows.

I have played around in the web2py interactive shell and defining the 
function works as expected as well. 

Any suggestions ?


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


[web2py] Re: Wiki.auth 401 error

2014-01-11 Thread Alan Etkin

>
> Pretty much give up on this, the wiki looked very promising when i first 
> tried it, seems to be dead now,
>

Still unable to reproduce the issue with Version 
2.8.2-stable+timestamp.2014.01.09.11.46.01 in development.

Mind that you must have permission to create wikis. Check that there is a 
wiki_editor or wiki_author membership in the app database applied to your 
user. Also check that when creating the app in development, you have access 
to the admin app, otherwise the automatic permission creation can fail.

If you think this is an environment specific problem, file an issue at 
http://code.google.com/p/web2py and we'll try to fix it asap.

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


[web2py] Re: Writing Web2Py specification and finding free lance Web2Py coders

2014-01-11 Thread weheh
http://experts4solutions.com/ 

I've worked with a couple of the people on experts4solutions (I'm one 
myself) and it worked out well.

On Saturday, January 11, 2014 3:31:20 PM UTC+8, Timothy Swieter wrote:
>
> Ruud - 
>
> I'll take a look at the organization you linked too.  On the face of it, 
> this may be who I am looking for.  Have you any experience with them?  How 
> are they?  What is their process of definition and development?  
>
> Any other freelancers or commercial business that develop on Web2Py 
> full-time?  
>
> Thank you again.  
>

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


[web2py] Need Suggestions on how to install the web2py app on android phone

2014-01-11 Thread kartik murthy
Hello Folks!
 I have built a web2py app which consists of a form that 
stores electrical data info in a db. Now i need to install this app on an 
android phone. I searched on internet for some answers but i couldnt find 
any productives so i would like to ask what is the best,easiest way of doin 
this. The other question is can i make a .apk file of this web2py app?

Thanks!
kartik

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


[web2py] Re: GAE: insert using "key_name"

2014-01-11 Thread Alan Etkin


> Sorry for the confussion..
> But it works fine. I will definitally use this.
>
> (I posted something stupid and removed the stupid post but left some 
> traces. ;-))
>

Well there are good reasons not to add the feature, at least with the 
current name:

https://groups.google.com/d/msg/web2py-developers/bN0WS9_skzw/NJq4bs5M8KIJ

Sorry; however, you could temporarily implement a similar method by 
subclassing GoogleDatastoreAdapter so it pre-processes data without 
applying changes.

http://www.web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Note-on-new-DAL-and-adapters

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


Re: [web2py] Re: REF: DAL Catching errors

2014-01-11 Thread Anthony
It depends on how the particular exception class is implemented. In 
general, if you do str(error), you get the error message. I think in most 
exception classes, error.args[0] is also typically the error message. This 
is a general Python issue and not specific to web2py.

try:

except db._adapter.driver.IntegrityError as e:
return str(e)

Anthony

On Saturday, January 11, 2014 1:55:30 AM UTC-5, software.ted wrote:
>
> Hi Anthony!
>
> Those gems we need to know!!!, since i have to extract undocumented 
> details on this list, I would like to find out how i can then get system 
> generated messages cause there are many integrity error 
> descriptions...instead of me having one message like this:
>
> try:
> ...
> except db._adapter.driver.IntegrityError:
> err_msg = "Duplicate record in database"
>
> I would like to have a situation were i can get system messages of the 
> specific integrity error enountered:
>
> try:
> ...
> except db._adapter.driver.IntegrityError:
> err_msg = db.[some object].errorMessage
>
>
> Any pointers?
>
>
> On Sat, Jan 11, 2014 at 8:11 AM, Anthony  >wrote:
>
>> Another one of our great undocumented gems. :-)
>>
>> --
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> ---
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to web2py+un...@googlegroups.com .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>
>
> -- 
>
> ...
> Teddy Lubasi Nyambe
> Opensource Zambia
> Lusaka, ZAMBIA
>
> Cell: +260 97 7760473
> website: http://www.opensource.org.zm
>
> ~/
> Human Knowledge belongs to the world! - AntiTrust
>
> Man is a tool-using animal. Without tools he is nothing, with tools he is 
> all - Thomas Carlyle 1795-1881
>
> /~ 
>

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


[web2py] Re: helper function - query returns no rows

2014-01-11 Thread Anthony
I notice in your original code, you set form.vars.npc to 0 if it is empty 
-- does your new code do the same? We might need to see all the code.

Anthony

On Saturday, January 11, 2014 4:56:56 AM UTC-5, zee wrote:
>
> Hi,
>
> First post here, so thanks in advance for any help provided.
>
> I have a sub-routine in my main function of a a controller that looks like 
> this :
>
> if form.vars.npc:
> pass
> else:
> form.vars.npc = 0
> onrp_row = db(
> (db.npa.npa==form.vars.npa) & 
> (db.npa.loc_name_short==form.vars.lns) & 
> (db.npa.npa_complement==form.vars.npc)
> ).select(db.npa.id)
> onrp_id=onrp_row[0].id
>
> Essentially, I use this to update a record I just inserted in the db with 
> a foreign primary key from an external data source. I need to keep this 
> reference for data consistency purposes in case the external source is 
> modified.
>
> This sub-routine behaves as expected.
>
> My problem is that I am trying to make a helper function out of this 
> sub-routine. I have extracted it from the index() function and my 
> controller now looks like this :
>
> def get_onrp(npa, lns, npc=0):
> 
> id=db((db.npa.npa==npa)&(db.npa.loc_name_short==lns)&(db.npa.npa_complement==npc)).select(
> db.npa.id)
> if id:
> return id[0].id
> else:
> return 0
>
> def index():
> # SQLFORM.factory here
>
> onrp_id = get_onrp(form.vars.npa, form.vars.lns, form.vars.npc)
>
> # rest of controller logic here
>
> Now, the get_onrp function systematically returns 0, i.e. the db query 
> returns no rows.
>
> I have played around in the web2py interactive shell and defining the 
> function works as expected as well. 
>
> Any suggestions ?
>
>
>

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


Re: [web2py] Re: REF: DAL Catching errors

2014-01-11 Thread Massimo Di Pierro
Depending on the situation it may also be necessary to do:

try:

except db._adapter.driver.IntegrityError as e:
db.rollback() # or db.commit()
return str(e)




On Saturday, 11 January 2014 09:17:33 UTC-6, Anthony wrote:
>
> It depends on how the particular exception class is implemented. In 
> general, if you do str(error), you get the error message. I think in most 
> exception classes, error.args[0] is also typically the error message. This 
> is a general Python issue and not specific to web2py.
>
> try:
> 
> except db._adapter.driver.IntegrityError as e:
> return str(e)
>
> Anthony
>
> On Saturday, January 11, 2014 1:55:30 AM UTC-5, software.ted wrote:
>>
>> Hi Anthony!
>>
>> Those gems we need to know!!!, since i have to extract undocumented 
>> details on this list, I would like to find out how i can then get system 
>> generated messages cause there are many integrity error 
>> descriptions...instead of me having one message like this:
>>
>> try:
>> ...
>> except db._adapter.driver.IntegrityError:
>> err_msg = "Duplicate record in database"
>>
>> I would like to have a situation were i can get system messages of the 
>> specific integrity error enountered:
>>
>> try:
>> ...
>> except db._adapter.driver.IntegrityError:
>> err_msg = db.[some object].errorMessage
>>
>>
>> Any pointers?
>>
>>
>> On Sat, Jan 11, 2014 at 8:11 AM, Anthony  wrote:
>>
>>> Another one of our great undocumented gems. :-)
>>>
>>> --
>>> Resources:
>>> - http://web2py.com
>>> - http://web2py.com/book (Documentation)
>>> - http://github.com/web2py/web2py (Source code)
>>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>>> ---
>>> You received this message because you are subscribed to the Google 
>>> Groups "web2py-users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to web2py+un...@googlegroups.com.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>
>>
>>
>> -- 
>>
>> ...
>> Teddy Lubasi Nyambe
>> Opensource Zambia
>> Lusaka, ZAMBIA
>>
>> Cell: +260 97 7760473
>> website: http://www.opensource.org.zm
>>
>> ~/
>> Human Knowledge belongs to the world! - AntiTrust
>>
>> Man is a tool-using animal. Without tools he is nothing, with tools he is 
>> all - Thomas Carlyle 1795-1881
>>
>> /~ 
>>
>

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


Re: [web2py] Re: REF: DAL Catching errors

2014-01-11 Thread Anthony
Good point. web2py normally does a rollback if a request results in an 
exception, but if you catch the exception, you would need to do the 
rollback yourself to prevent web2py from committing the transaction at the 
end of the request.

Anthony

On Saturday, January 11, 2014 11:48:08 AM UTC-5, Massimo Di Pierro wrote:
>
> Depending on the situation it may also be necessary to do:
>
> try:
> 
> except db._adapter.driver.IntegrityError as e:
> db.rollback() # or db.commit()
> return str(e)
>
>
>
>
> On Saturday, 11 January 2014 09:17:33 UTC-6, Anthony wrote:
>>
>> It depends on how the particular exception class is implemented. In 
>> general, if you do str(error), you get the error message. I think in most 
>> exception classes, error.args[0] is also typically the error message. This 
>> is a general Python issue and not specific to web2py.
>>
>> try:
>> 
>> except db._adapter.driver.IntegrityError as e:
>> return str(e)
>>
>> Anthony
>>
>> On Saturday, January 11, 2014 1:55:30 AM UTC-5, software.ted wrote:
>>>
>>> Hi Anthony!
>>>
>>> Those gems we need to know!!!, since i have to extract undocumented 
>>> details on this list, I would like to find out how i can then get system 
>>> generated messages cause there are many integrity error 
>>> descriptions...instead of me having one message like this:
>>>
>>> try:
>>> ...
>>> except db._adapter.driver.IntegrityError:
>>> err_msg = "Duplicate record in database"
>>>
>>> I would like to have a situation were i can get system messages of the 
>>> specific integrity error enountered:
>>>
>>> try:
>>> ...
>>> except db._adapter.driver.IntegrityError:
>>> err_msg = db.[some object].errorMessage
>>>
>>>
>>> Any pointers?
>>>
>>>
>>> On Sat, Jan 11, 2014 at 8:11 AM, Anthony  wrote:
>>>
 Another one of our great undocumented gems. :-)

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

>>>
>>>
>>>
>>> -- 
>>>
>>> ...
>>> Teddy Lubasi Nyambe
>>> Opensource Zambia
>>> Lusaka, ZAMBIA
>>>
>>> Cell: +260 97 7760473
>>> website: http://www.opensource.org.zm
>>>
>>> ~/
>>> Human Knowledge belongs to the world! - AntiTrust
>>>
>>> Man is a tool-using animal. Without tools he is nothing, with tools he 
>>> is all - Thomas Carlyle 1795-1881
>>>
>>> /~ 
>>>
>>

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


[web2py] parse_as_rest, multiple fields to select

2014-01-11 Thread Zbigniew Pomianowski
Is it possible to use *parse_as_rest* function and select only particular 
fields? I have quite big tables with many columns. From most of them I need 
to get only *id* and corresponding *name*. Whole rows I need only from time 
to time.

In docs there is something like this:

"/friend[person]/{person.id}/:field"


Is there something like:

"/friend[person]/{person.id}/:field1:field2"



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


Re: [web2py] Re: REF: DAL Catching errors

2014-01-11 Thread Teddy Nyambe
Thanks exactly what I was looking for, will try it!
On 11 Jan 2014 19:00, "Anthony"  wrote:

> Good point. web2py normally does a rollback if a request results in an
> exception, but if you catch the exception, you would need to do the
> rollback yourself to prevent web2py from committing the transaction at the
> end of the request.
>
> Anthony
>
> On Saturday, January 11, 2014 11:48:08 AM UTC-5, Massimo Di Pierro wrote:
>>
>> Depending on the situation it may also be necessary to do:
>>
>> try:
>> 
>> except db._adapter.driver.IntegrityError as e:
>> db.rollback() # or db.commit()
>> return str(e)
>>
>>
>>
>>
>> On Saturday, 11 January 2014 09:17:33 UTC-6, Anthony wrote:
>>>
>>> It depends on how the particular exception class is implemented. In
>>> general, if you do str(error), you get the error message. I think in most
>>> exception classes, error.args[0] is also typically the error message. This
>>> is a general Python issue and not specific to web2py.
>>>
>>> try:
>>> 
>>> except db._adapter.driver.IntegrityError as e:
>>> return str(e)
>>>
>>> Anthony
>>>
>>> On Saturday, January 11, 2014 1:55:30 AM UTC-5, software.ted wrote:

 Hi Anthony!

 Those gems we need to know!!!, since i have to extract undocumented
 details on this list, I would like to find out how i can then get system
 generated messages cause there are many integrity error
 descriptions...instead of me having one message like this:

 try:
 ...
 except db._adapter.driver.IntegrityError:
 err_msg = "Duplicate record in database"

 I would like to have a situation were i can get system messages of the
 specific integrity error enountered:

 try:
 ...
 except db._adapter.driver.IntegrityError:
 err_msg = db.[some object].errorMessage


 Any pointers?


 On Sat, Jan 11, 2014 at 8:11 AM, Anthony  wrote:

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



 --
 
 ...
 Teddy Lubasi Nyambe
 Opensource Zambia
 Lusaka, ZAMBIA

 Cell: +260 97 7760473
 website: http://www.opensource.org.zm

 ~/
 Human Knowledge belongs to the world! - AntiTrust

 Man is a tool-using animal. Without tools he is nothing, with tools he
 is all - Thomas Carlyle 1795-1881

 /~

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

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


[web2py] How to use a bootstrap button group as radio buttons in a custom form

2014-01-11 Thread David Gawlowski
hoping someone can point me in the right direction, as the post title says 
I want to use a btn-group

{{=form.custom.begin}}



Opt1
Opt2

etc etc

as radio buttons to pass value to the form, but I am struggling with 
passing the value.  How do I get the selected value the web2py way without 
resorting to js? (like here on 
SO)

Right now my model is pretty vanilla 
Field('opt'),
as well as vanilla controller
form = SQLFORM(db.games)
Thx!

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


[web2py] Re: parse_as_rest, multiple fields to select

2014-01-11 Thread Massimo Di Pierro
No but it should be easy to add the ability to do it. I would use the syntax

"/friend[person]/{person.id}/:field1,field2"

Please open a ticket about this.

On Saturday, 11 January 2014 12:47:02 UTC-6, Zbigniew Pomianowski wrote:
>
> Is it possible to use *parse_as_rest* function and select only particular 
> fields? I have quite big tables with many columns. From most of them I need 
> to get only *id* and corresponding *name*. Whole rows I need only from 
> time to time.
>
> In docs there is something like this:
>
> "/friend[person]/{person.id}/:field"
>
>
> Is there something like:
>
> "/friend[person]/{person.id}/:field1:field2"
>
>
>
>

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


[web2py] Re: Need Suggestions on how to install the web2py app on android phone

2014-01-11 Thread 黄祥

>
> I have built a web2py app which consists of a form that stores electrical 
> data info in a db. Now i need to install this app on an android phone. I 
> searched on internet for some answers but i couldnt find any productives so 
> i would like to ask what is the best,easiest way of doin this. 
>

for installing web2py on android please check this forum.
https://groups.google.com/forum/#!topic/web2py/vmZatOB9Rmo
 

> The other question is can i make a .apk file of this web2py app?
>

the easiest way is to use appsgeyser.com
ref:
https://groups.google.com/forum/#!topic/web2py/n2CWJsbEXG8
appsgeyser.com

if you want to create the apk yourself, please download adt-bundle and put 
the webview code to loadurl your server.
ref for download adt-bundle:
http://developer.android.com/sdk/index.html

ref for coding android :
http://mobile.tutsplus.com/tutorials/android/android-sdk-embed-a-webview-with-the-webkit-engine/
http://www.mkyong.com/android/android-webview-example/
http://examples.javacodegeeks.com/android/core/ui/webview/android-webview-example/
http://www.tutorialspoint.com/android/android_webview_layout.htm
http://javatechig.com/android/android-webview-example
http://www.learn2crack.com/2013/10/android-webview-example.html
 
another suggestion, is please make a great relation with google, it going 
to help you a lot 

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


[web2py] Re: Audio Streaming View

2014-01-11 Thread 黄祥
pardon me, don't know what do you want to achieve in here. i think massimo 
guide, is show the html5 player in the grid.
consider in this code :


# tell web2py that links to music files are to be
# represented as HTML5 audio embedded players
from gluon.contrib.autolinks import expand_one
db.music.filename.represent = lambda v,r: \
XML(expand_one(URL('download',args=v),{}))

another suggestion is if you don't want to use grid, just move the code 
above in models. and then create the controller and the view it will 
automatically create the html5 audio embedded players.

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


[web2py] Re: require based on another field.

2014-01-11 Thread 黄祥
IS_NULL_OR is deprecated, please use IS_EMPTY_OR
ref:
http://web2py.com/books/default/chapter/29/07/forms-and-validators

i think you can achieve it iwth IS_EMPTY_OR(IS_IN_DB() )

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


[web2py] questions about using xml files in web2py

2014-01-11 Thread greaneym
Hi,

I am learning about using xml files in web2py and have some questions.

This controller allows me to view an xml file,

from gluon.tools import Expose
import osdef showtree3():
expath = '/Users/mgreaney/examples/ex_01.xml'
return dict(files=Expose(expath))

This allows me to view the xml file in a view
with index containing {{=files}}, but I want to collect the xml file as 
raw POST data.

I found this info on the "old web2py blog":

ontroller code:
def indexxml():   # changed name from index to indexxml
response.headers['content-type'] = 'text/xml'
xml = request.body.read()  # retrieve the raw POST data
if len(xml) == 0:
xml = 'no post 
data'
return response.render(dict(xml=XML(xml)))

# View code:
{{=xml}}

and then it says to try using curl to call the controller like this,

curl --data 'my xml data' 
http://example.com/app/controller/index

and when I use curl from the command line like this,
curl --data 'my xml data' 
http://127.0.0.0:8000:/myapp/static/ex_01.xml

I can see the contents of ex_01.xml

but if I run this from the command line,
curl --data 'my xml data' 
http://127.0.0.0:8000:/myapp/maketree/indexxml

I get the output of the view "index.html" for the maketree controller, 
which just has some brief text content and not any output from 
indexxml.html.

I don't understand how the indexxml in the example above gets the xml file 
as input?

How do I use request.body and request.body.read()?

Is there a  way to get raw POST data from an xml file that is in my static 
directory 
using request.body?

Also, can you use curl from inside a controller? I get a syntax error if I 
try this.

Can I use a modified version of the end info at this post?
https://groups.google.com/forum/?hl=en#!searchin/web2py/curl/web2py/efrSxAT9AnU/NlGub7WvlfAJ
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/groups/opt_out.


[web2py] Re: Best practices with sessions

2014-01-11 Thread Wonton
Thank you very much Niphlod, a perfect explanation.


On Thursday, January 9, 2014 9:29:25 PM UTC+1, Niphlod wrote:
>
>
>
> On Wednesday, January 8, 2014 10:41:49 PM UTC+1, Wonton wrote:
>>
>> Hello everyone,
>>
>> I'm trying to implement the web2py recipes to improve the efficiency and 
>> security of my backend.  I'm beggining with sessions and I have a couple of 
>> doubts:
>>
>> - My site is over SSL and has user authentication, so I guess I should 
>> secure my sessions. The recipe sais "In your applications, if they require 
>> authentication, you should make the session cookies secure 
>> with:session.secure()", 
>> but, where should I put that code?
>>
>
>  session.secure() just adds secure to the cookies. If all your site is 
> behind ssl, then put session.secure() in a model, so every session will 
> have this "flag" set.
>
>
>> - The number of session files of my server is growing quickly so I should 
>> use the sessions2trash.py script, but, how should I use that script? 
>> Should I create a cron task in my server that execute each day something 
>> like this "python web2py.py -S app -M -R scripts/sessions2trash.py -A -o 
>> -x 3600 -f"?
>>
>
> this is a two-sided question: if your sessions are growing because they 
> are never deleted then sure, use the script as a cron task (the setup with 
> nginx does it for you for the welcome app automatically
>
> https://github.com/web2py/web2py/blob/master/scripts/setup-web2py-nginx-uwsgi-ubuntu.sh#L145
> using uwsgi cron facilities
> ) 
> if instead they're growing because lots of different users access the 
> application that needs them, you can't absolutely do nothing, except 
> following some best practices on using separate=True to avoid having speed 
> penalties from the underlying filesystem (for tenths of thousands of 
> session files) or adopt the redis backend, that can handle millions of 
> sessions very quickly. All of this is largely documented on the book at 
> http://web2py.com/books/default/chapter/29/13/deployment-recipes
> Please note that with your commandline you'll delete sessions older than 
> an hour, regardless of the expiration: this means that your users will have 
> to logon after 1 hour of no activity, and that **could** be seen as a 
> bummer. 
>  
>
>>
>> Thank you very much and kind 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/groups/opt_out.


Re: [web2py] Re: Debugging with the scheduler

2014-01-11 Thread User
For future reference just adding the fact that you can open a web2py shell 
and call your scheduler tasks directly in order to debug them.  This wasn't 
obvious to me but is much easier than trying to run the scheduler and debug 
it via logging statements.

For example:

python web2py.py  -M -S your_app_name

and then call a function from your scheduler.py file which will just be a 
global function (that is, just type the function name at the shell 
prompt).  Inside your function you can set a pdb break point and debug to 
your heart's content.

scheduler.py:

def myfunction():
import pdb; pdb.set_trace()
...





On Wednesday, February 27, 2013 4:36:10 PM UTC-5, José L. wrote:

> 2013/2/26 Niphlod >: 
> > never done it, but debugging a multiprocessing spawned process needs 
> > additional tuning http://pydev.org/manual_adv_remote_debugger.html 
> > 
> > PS: can I ask what is not working ? if it's a "focused" problem maybe I 
> can 
> > come up with an answer . 
>
> I've fixed it , it was a problem with a locked file when using shelve. 
> I've used a workaround but I don't feel happy with the solution (it 
> works but's terribly ugly). Any idea to exchange a big Python list 
> with data between the main web2py application and the long-lasting 
> backgroud process is welcome. 
>
> Regards. 
>
>
> > 
> > 
> > On Tuesday, February 26, 2013 9:12:23 PM UTC+1, José L. wrote: 
> >> 
> >> Hello, 
> >> I'm working with async processes using the scheduler (with the 
> >> unvaluable help of the "learn by trial" application from Niphlod. 
> >> 
> >> I wonder if there's an easy way to debug the processes that are being 
> >> executed in the background (I'm  having problems with them, they work 
> >> ok when run from web2py directly as a normal process, but not when 
> >> they're executed by the scheduler). 
> >> Pdb would be great, but if not, is there any way to use the ugly but 
> >> useful "print vars" commands to see the flow of execution of the 
> >> tasks? 
> >> 
> >> I know of the output field in the scheduler_task table in the 
> >> database, but that's terribly slow 
> >> 
> >> Regards. 
> >> José L. 
> > 
> > -- 
> > 
> > --- 
> > You received this message because you are subscribed to the Google 
> Groups 
> > "web2py-users" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> an 
> > email to web2py+un...@googlegroups.com . 
> > For more options, visit https://groups.google.com/groups/opt_out. 
> > 
> > 
>

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


[web2py] calling custom javascript functions

2014-01-11 Thread jonas
hi

I have developed javascript functions in /static/js/custom/charts.js

they are loaded in layout.html:

 

I call them in index.html by:



myfunction();



I know that ajax and jQuery can be used to call python functions in 
default.py and my question is, is it possible to use ajax or jQuery to call 
my custom javascript functions? which one should I use? 
My goal is to call d3js functions to generate graphs. 

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


[web2py] Re: calling custom javascript functions

2014-01-11 Thread Massimo Di Pierro
I suggest jQuery.ajax

On Saturday, 11 January 2014 17:36:43 UTC-6, jonas wrote:
>
> hi
>
> I have developed javascript functions in /static/js/custom/charts.js
>
> they are loaded in layout.html:
>
>  
>
> I call them in index.html by:
>
> 
>
> myfunction();
>
> 
>
> I know that ajax and jQuery can be used to call python functions in 
> default.py and my question is, is it possible to use ajax or jQuery to call 
> my custom javascript functions? which one should I use? 
> My goal is to call d3js functions to generate graphs. 
>
> 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/groups/opt_out.


[web2py] Re: Audio Streaming View

2014-01-11 Thread Asher S
I don't want to use the grid so I put the code in models, then in the view 
wrote:
{{=URL('download', music.filename)}}
but it still displays as a relative URL not the html5 audio embeded player. 
I must be missing something.
Thank you for the reply Stifan!

On Saturday, January 11, 2014 2:00:15 PM UTC-8, 黄祥 wrote:
>
> pardon me, don't know what do you want to achieve in here. i think massimo 
> guide, is show the html5 player in the grid.
> consider in this code :
>
>
> # tell web2py that links to music files are to be
> # represented as HTML5 audio embedded players
> from gluon.contrib.autolinks import expand_one
> db.music.filename.represent = lambda v,r: \
> XML(expand_one(URL('download',args=v),{}))
>
> another suggestion is if you don't want to use grid, just move the code 
> above in models. and then create the controller and the view it will 
> automatically create the html5 audio embedded players.
>
> 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/groups/opt_out.


[web2py] Get label of field

2014-01-11 Thread Leonardo Pires Felix
I'm tryng to make the export classes export with fieldlabel instead of 
dbname.field.
So i'm seeing that should be here where i should change:

writer.writerow(
[unicode(col).encode 
("utf8")
 for col in self.rows 
.colnames])
 

My doubt is, how i get the labels of specific field, or a group of fields, 
or all fields?

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


[web2py] calling custom javascript functions

2014-01-11 Thread Anthony
It's not quite clear what you want to do. You wouldn't use ajax to call a 
JavaScript function. If you want to call a JS function in the browser, just 
make sure it is loaded on the page and call it.

Anthony

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


[web2py] Re: Writing Web2Py specification and finding free lance Web2Py coders

2014-01-11 Thread Simon Ashley
Often thought that it would be good to push this to another level. We have 
projects from time to time that would be good to outsource, if people were 
interested. Something like a project post board, with bidders, assignment, 
monitoring and completion. 

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


[web2py] How to add users to a table row by request

2014-01-11 Thread Jon Smith
I am probably going about this all wrong, so I am open to suggestions. 
However I am wondering how I can append a user (if approved) to a table 
row. Currently I have a project_groups table and a tmp table as you can see 
below. The tmp table is meant as a place holder for users requesting access 
to the group. The access is granted if a user sends a request and the 
project admin approves the request using ajax/javascript. However I am 
having problems in passing these values from the tmp table and updating the 
project_groups.members field. Any advice would be greatly appreciated.

db.define_table('project_groups',

Field('members', requires=IS_IN_DB(db, db.auth_user, '%(first_name)s 
%(last_name)s %(public_email)s', multiple=(1, 1000)), default=auth.user_id, 
writable=False, readable=False),
...

db.define_table('tmp',
Field('source', db.auth_user, default=auth.user_id, writable=False, 
readable=False),
Field('project_groups', db.project_groups, default=auth.user_id, 
writable=False, readable=False),
Field('created_on', 'datetime', default=request.now, writable=False, 
readable=False))


# The query which is baffling me at this stage

elif request.args(0) == 'accept':
#tmp = db((db.tmp.project_groups == db.project_groups.id) & 
(db.project_groups.userinfo == auth.user_id)).select() 
tmp_user = request.args(1)
tmp = db(db.tmp.source == tmp_user).select(db.tmp.ALL)
updates = db(db.project_groups.id == 
db.tmp.project_groups).select(db.project_groups.ALL)
for myupdate in updates:
myupdate.update(members = myupdate.members + [tmp_user])
#db(db.tmp.source == a0).delete()
return

Thanks if anyone out there can help.

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