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

2016-01-12 Thread Massimo Di Pierro
That is why we do not use the built-in python localization functions in 
web2py. They are not thread safe.

On Tuesday, 12 January 2016 08:16:43 UTC-6, Niphlod wrote:
>
> this is not threadsafe. use utc and translate dates when presented to 
> users.
>
> On Tuesday, January 12, 2016 at 12:41:44 PM UTC+1, Gael Princivalle wrote:
>>
>> You can set your timezone like that in your model:
>>
>> import os
>>
>> os.environ['TZ'] = 'Europe/Rome'
>>
>>
>>

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


[web2py] Re: How can we help with the documentation?

2016-01-12 Thread Anthony
You can send pull requests to the book repo: 
https://github.com/mdipierro/web2py-book

If you want to suggest substantial changes to the organization/structure of 
the docs, you might first open a discussion on the developers group: 
https://groups.google.com/forum/#!forum/web2py-developers

Anthony 

On Tuesday, January 12, 2016 at 7:30:27 PM UTC-5, Alfonso Serra wrote:
>
> Ive spent 6 hours wondering why i couldnt update or insert a record with 
> the interactive console.
>
> After changing mysql user passwords, drop tables, remigrate everything, 
> mounting a fresh new web2py installation, tried to disable caching, i wasnt 
> able to update or insert a record even tho the docs says you have to type 
> row.update_record() after a single change, or db.mytable.insert(field1=...)
>
> its not until i read the commit section when i realised my mistake. 
> "In the interactive console you have to use db.commit()!", not the models, 
> not the controllers, not the views.
>
> The point is that i was trying to update or insert (with the console), 
> while in the docs didnt mention anything about this case, in the update, 
> insert sections.
>
> There are many other similar things like this that has happened to me, and 
> probably to many people. Most of them has been solved in this forum by the 
> developers but improving the docs may help many of us without having to 
> bother you guys that much.
>
> I know documenting is not nearly as fun as developing but i would love to 
> contribute to it as im learning and facing all these problems. 
>
> So yes, the question is. How can we help to improve the docs?
>
> Would it be room for a wiki or is too much trouble?
>
> Thanks
>
> BTW: ive noticed a side effect by trying to insert a record at the console 
> without invoking commit. The table auto increment gets incremented 
> althought the record isnt inserted. 
> web2py 2.12.3
> mysql 5.5.24
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.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 know the IP address of the user client using my web2py site?

2016-01-12 Thread Massimo Di Pierro
request.env.remote_addr is the socket remote address and request.client is 
the former or the HTTP_X_FORWRDED_FOR.
none of them is 100% reliable as they can be tricked by the visitor.

On Tuesday, 12 January 2016 04:10:50 UTC-6, 黄祥 wrote:
>
> i think you can use request.client
> e.g.
> def oncreate_event(form, table):
> db.auth_event.insert(time_stamp = request.now, 
> *client_ip = request.client*, 
> user_id = auth.user_id, 
> origin = '%s/%s' % (request.controller, 
> request.function), 
> description = 'ID %s created in table %s' % (form.vars.id, table) )
>
>
> ref:
> http://web2py.com/books/default/chapter/29/04/the-core#request
>
> best regards,
> stifan
>

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


[web2py] update 2 session value using module only first session value work

2016-01-12 Thread 黄祥
is it possible to update 2 sessions values using web2py module? i've tested 
it only first session value work, the second session value work if explicit 
define in the module (but the module is used by another controller, so i 
want to create just 1 module for all controllers).
e.g.
*modules/transaction.py*
def callback_0(session_order, session_order_net):
if current.request.vars.action == 'adjust_total':
id = int(current.request.vars.id)
quantity = int(current.request.vars['quantity_%s' % id])
price = int(current.request.vars['price_%s' % id])
*session_order[id] = quantity, price # the first parameter work*
total_price = quantity * price
total_quantity = 0
grand_total = 0
for calculation_id, (calculation_quantity, calculation_price) in 
session_order.items():
calculation_total_price = calculation_quantity * calculation_price
total_quantity += calculation_quantity
grand_total += calculation_total_price
return "jQuery('#total_price_%s').html('%s'); 
jQuery('#total_quantity').html('%s'); jQuery('#grand_total').html('%s');" % 
(id, 
  format(total_price, ",d").replace(",", "."), format(total_quantity, 
",d").replace(",", "."), 
  format(grand_total, ",d").replace(",", ".") )
if current.request.vars.action == 'adjust_total_net':
discount = int(current.request.vars['discount'] )
delivery_fee = int(current.request.vars['delivery_fee'] )
packing_fee = int(current.request.vars['packing_fee'] )
stamp_fee = int(current.request.vars['stamp_fee'] )
paid = int(current.request.vars['paid'] )

* current.session.sale_order_net = dict(discount = discount, delivery_fee = 
delivery_fee, packing_fee = packing_fee, stamp_fee = stamp_fee, paid = 
paid) # this work when explicit tell the session name*

* #session_order_net = dict(discount = discount, delivery_fee = 
delivery_fee, packing_fee = packing_fee, stamp_fee = stamp_fee, paid = 
paid)** # the second parameter not work, no error traceback occured but the 
result is not expected (not updated value)*

grand_total = sum(calculation_quantity * calculation_price for 
calculation_id, (calculation_quantity, calculation_price) in 
session_order.items() )
grand_total_net = grand_total-discount+delivery_fee+packing_fee+stamp_fee
paid_return = paid-grand_total_net

return "jQuery('#grand_total_net').html('%s'); 
jQuery('#paid_return').html('%s');" % (
  format(grand_total_net, ",d").replace(",", "."), format(paid_return, 
",d").replace(",", ".") )

as in the example code above the bold code is work if i explicit it and if 
i use the second parameter (*session_order_net*) that been passed by 
function in controller, it is not work, the funny things is the first 
parameter work (*session_order*). no error traceback occured but the result 
is not expected.

any idea how to get it work in web2py way?

thanks and best regards,
stifan

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


[web2py] Re: keepvalues - need help with this

2016-01-12 Thread T.R.Rajkumar
But I use FORM and not SQLFORM.

On Saturday, January 11, 2014 at 12:10:07 AM UTC+5:30, Kiran Subbaraman 
wrote:
>
> Hello All,
> The *design *is: I have a custom form with the a controller that 
> inserts/updates a table. Tthe form accepts data, and on successful 
> submission of this form, it stays on the same page (there are no redirects 
> to another page or form)
> *Issue*: The problem am seeing is, when I update values in the form, and 
> submit it, the entered values are lost when the form returns because of 
> successful submit, or due to errors. I have tried to use keepvalues=True in 
> the form.accepts() and form.process() methods. No luck.
> Details below.
>
> Since the page am building has specific design needs, I went with the 
> option of a custom form, where I used the form.custom.* options quite a 
> bit. Therefore input fields in the form look like this
>   id="country" name="country" 
> value="{{=form.custom.inpval['country']}}"
> placeholder="{{=form.custom.comment['country']}}"
>
> Also the controller is coded as below
> x = db(db.x.x_id == auth.user.id).select().first()
> if x:
> form = SQLFORM(db.x, record=x)
> else:
> form = SQLFORM(db.x)
> pass
>
>  
> # process the form
> if form.accepts(request.vars, formname='basicinfo_form', keepvalues=
> True):
> response.flash = 'Basic Information updated successfully.'
> elif form.errors:
> response.flash = 'The submitted form contains errors. The fields 
> in error are highlighted below.'
> else:
> response.flash = 'Please fill the form.'
> pass
>
> return dict(form=form)
>
> I was thinking that maybe I should capture the request.vars and send it 
> back to the view alongwith the form. 
> If the request.vars.country value exists, then I use that, instead of the 
> form.custom.inpval['country']. This only makes the view code a bit more 
> verbose, but if it solves the problem, then nothing like it. 
>
> Can anyone suggest what I could do to sort this out?
> Thank you,
> Kiran
>
> P.S: I did take a look at all the conversations in the forum about 
> keepvalues. None of them seemed to help me. Though I did find this one to 
> be interesting and am curious if this is sorted out already: 
> https://groups.google.com/forum/#!searchin/web2py/keepvalues$20on$20validate/web2py/MNEYo96Shzg/jjKZaMmfAgQJ
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.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] web2pyslices again

2016-01-12 Thread Mirek Zvolský
I realy hate web2pyslices.
Maybe there are people who like this page, however for me it is always pain.
List of plugins is terrible and I think it is because their authors simple 
cannot understand how to upload some stuff. For final users it is then 
completly useless - and more: makes big shame to web2py and serious reason 
why novices can leave web2py definitely.
Please use KISS (keep it simple, stupid) technology. We simple need a page 
with very easy list of plugins: Name, Goal, w2p link, repository link - 
please NOTHONG more!! Same should see the user who wish use the plugin.

Now again I want install my own plugin plugin_manage_groups.
>From the times when web2slices was completly unaccessible for me there was 
a bad download address, now I have changed it to the proper one, where the 
plugin realy is.
Download (Download page 
Url): 
https://zvolsky.github.io/plugin_manage_groups/web2py.plugin.manage_groups.w2p

>From web2py admin, I choose application, Manage-Edit, Plugins, Download 
plugins from repository, Install: "Unable to install plugin..."
Of course, thats because the link for "Install" is: 
https://github.com/zvolsky/plugin_manage_groups

So I have changed completly all links github.com... to the proper one 
github.io... (There are more links very nice described like: "Repository 
Url", "Repository page" - do you understand what difference shoul be here?).

But the "Install" link still gives github.com

What for stupid peace of software. Please remove from web2py code and 
web2py doc all references to web2pyslices. Thank you so much!

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.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: keepvalues - need help with this

2016-01-12 Thread T.R.Rajkumar
I do this
form.process(keepvalues=True,onvalidation=validate_meas).accepted:

and the form retains values on submission.

On Saturday, January 11, 2014 at 12:10:07 AM UTC+5:30, Kiran Subbaraman 
wrote:
>
> Hello All,
> The *design *is: I have a custom form with the a controller that 
> inserts/updates a table. Tthe form accepts data, and on successful 
> submission of this form, it stays on the same page (there are no redirects 
> to another page or form)
> *Issue*: The problem am seeing is, when I update values in the form, and 
> submit it, the entered values are lost when the form returns because of 
> successful submit, or due to errors. I have tried to use keepvalues=True in 
> the form.accepts() and form.process() methods. No luck.
> Details below.
>
> Since the page am building has specific design needs, I went with the 
> option of a custom form, where I used the form.custom.* options quite a 
> bit. Therefore input fields in the form look like this
>   id="country" name="country" 
> value="{{=form.custom.inpval['country']}}"
> placeholder="{{=form.custom.comment['country']}}"
>
> Also the controller is coded as below
> x = db(db.x.x_id == auth.user.id).select().first()
> if x:
> form = SQLFORM(db.x, record=x)
> else:
> form = SQLFORM(db.x)
> pass
>
>  
> # process the form
> if form.accepts(request.vars, formname='basicinfo_form', keepvalues=
> True):
> response.flash = 'Basic Information updated successfully.'
> elif form.errors:
> response.flash = 'The submitted form contains errors. The fields 
> in error are highlighted below.'
> else:
> response.flash = 'Please fill the form.'
> pass
>
> return dict(form=form)
>
> I was thinking that maybe I should capture the request.vars and send it 
> back to the view alongwith the form. 
> If the request.vars.country value exists, then I use that, instead of the 
> form.custom.inpval['country']. This only makes the view code a bit more 
> verbose, but if it solves the problem, then nothing like it. 
>
> Can anyone suggest what I could do to sort this out?
> Thank you,
> Kiran
>
> P.S: I did take a look at all the conversations in the forum about 
> keepvalues. None of them seemed to help me. Though I did find this one to 
> be interesting and am curious if this is sorted out already: 
> https://groups.google.com/forum/#!searchin/web2py/keepvalues$20on$20validate/web2py/MNEYo96Shzg/jjKZaMmfAgQJ
>
>

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


[web2py] Re: How can we help with the documentation?

2016-01-12 Thread Anthony
See also 
http://web2py.com/books/default/chapter/29/15/helping-web2py#Documentation--Updating-the-book.

On Tuesday, January 12, 2016 at 9:42:55 PM UTC-5, Anthony wrote:
>
> You can send pull requests to the book repo: 
> https://github.com/mdipierro/web2py-book
>
> If you want to suggest substantial changes to the organization/structure 
> of the docs, you might first open a discussion on the developers group: 
> https://groups.google.com/forum/#!forum/web2py-developers
>
> Anthony 
>
> On Tuesday, January 12, 2016 at 7:30:27 PM UTC-5, Alfonso Serra wrote:
>>
>> Ive spent 6 hours wondering why i couldnt update or insert a record with 
>> the interactive console.
>>
>> After changing mysql user passwords, drop tables, remigrate everything, 
>> mounting a fresh new web2py installation, tried to disable caching, i wasnt 
>> able to update or insert a record even tho the docs says you have to type 
>> row.update_record() after a single change, or db.mytable.insert(field1=...)
>>
>> its not until i read the commit section when i realised my mistake. 
>> "In the interactive console you have to use db.commit()!", not the 
>> models, not the controllers, not the views.
>>
>> The point is that i was trying to update or insert (with the console), 
>> while in the docs didnt mention anything about this case, in the update, 
>> insert sections.
>>
>> There are many other similar things like this that has happened to me, 
>> and probably to many people. Most of them has been solved in this forum by 
>> the developers but improving the docs may help many of us without having to 
>> bother you guys that much.
>>
>> I know documenting is not nearly as fun as developing but i would love to 
>> contribute to it as im learning and facing all these problems. 
>>
>> So yes, the question is. How can we help to improve the docs?
>>
>> Would it be room for a wiki or is too much trouble?
>>
>> Thanks
>>
>> BTW: ive noticed a side effect by trying to insert a record at the 
>> console without invoking commit. The table auto increment gets incremented 
>> althought the record isnt inserted. 
>> web2py 2.12.3
>> mysql 5.5.24
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.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 know the IP address of the user client using my web2py site?

2016-01-12 Thread 黄祥
i think you can use request.client
e.g.
def oncreate_event(form, table):
db.auth_event.insert(time_stamp = request.now, 
*client_ip = request.client*, 
user_id = auth.user_id, 
origin = '%s/%s' % (request.controller, 
request.function), 
description = 'ID %s created in table %s' % (form.vars.id, table) )


ref:
http://web2py.com/books/default/chapter/29/04/the-core#request

best regards,
stifan

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


[web2py] How to know the IP address of the user client using my web2py site?

2016-01-12 Thread aston . ribat
Could you please tell the exact code?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.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 know the location of the user client on my site?

2016-01-12 Thread aston . ribat
Also can I increase by 5 hours and 20 minutes instead of time shown by the 
request.now
Can I do like this?: HH+5:MM+20:SS

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


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

2016-01-12 Thread Gael Princivalle
You can set your timezone like that in your model:

import os

os.environ['TZ'] = 'Europe/Rome'

Il giorno lunedì 11 gennaio 2016 18:50:05 UTC+1, RAGHIB R ha scritto:
>
> Can we do it without any plugin? If yes, how?
>

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


Re: [web2py] Re: web2py httpserver log file location

2016-01-12 Thread Vid Ogris
Using cwdir helped to solve the problem with httpserver.log file. Thank you
for that

So you suggest using scheduler to start my exe program?

2016-01-12 12:24 GMT+01:00 Niphlod :

> for this and the previous issue, you should be on the path "I won't never
> ever start a process inside a web request".
> That being said, subprocess.Popen has cwdir .
>
> On Monday, January 11, 2016 at 8:52:58 PM UTC+1, Yebach wrote:
>>
>> What do u suggest I use to startthe exe program. It takes one parameter
>> (script id)?
>> On Jan 11, 2016 8:50 PM, "Niphlod"  wrote:
>>
>>> you can't os.chdir in web2py. first it's not threadsafe. second, you
>>> screw up all web2py relative imports.
>>>
>>> BTW: httpserver.log is put on the same folder web2py.py is, unless you
>>> are using the -f parameter, in which case it sits in that directory, which
>>> is the one containing the "applications" folder.
>>>
>>> On Monday, January 11, 2016 at 4:06:38 PM UTC+1, Yebach wrote:

 Hello

 I have a strange behavior of my log file, or better to say the location
 of my log file.

 If I understand correctly httpserver.log file is usually located in
 application folder.

 When I have to run the engine the following code is executed

 path = applications/applicationName/engine/e1
 count = 0
 while ( count < 10 and ( os.path.isfile(outPath))):
 count += 1
 os.remove(outPath)
 time.sleep(0.05)

 # Run woshi engine
 path_1 =  os.path.join(path, 'e1')
 os.chdir(path_1)

 p = subprocess.Popen(['woshi_engine.exe', scriptId],
 shell=True, stdout = subprocess.PIPE)

 After that the httpserver.log file is created in folder
 applications/applicationName/engine/e1 and stays there

 Now if I run my second application in folder applications (like
 production version) this file is moved to the engine folder of that
 applicatio

 How can I set the default location of httpserver.log file and that the
 file is not moved?

 Thank you


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



-- 
Lep pozdrav

Vid Ogris

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.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] Generic view pdf

2016-01-12 Thread Marlysson Silva
Person, I'm trying generating a generic view in pdf; but is showing this 
error 

RuntimeError: Table column/cell width not specified, unable to continue


I Put the width at TDs ,then the this error dissapeares, then appeares this 
other:

AttributeError: 'NoneType' object has no attribute 'get'

Anybody already passed to this problem?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.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 httpserver log file location

2016-01-12 Thread Niphlod
use anything you like EXCEPT something inside the web environment.

On Tuesday, January 12, 2016 at 2:01:37 PM UTC+1, Yebach wrote:
>
> Using cwdir helped to solve the problem with httpserver.log file. Thank 
> you for that
>
> So you suggest using scheduler to start my exe program?
>
> 2016-01-12 12:24 GMT+01:00 Niphlod :
>
>> for this and the previous issue, you should be on the path "I won't never 
>> ever start a process inside a web request".
>> That being said, subprocess.Popen has cwdir .
>>
>> On Monday, January 11, 2016 at 8:52:58 PM UTC+1, Yebach wrote:
>>>
>>> What do u suggest I use to startthe exe program. It takes one parameter 
>>> (script id)?
>>> On Jan 11, 2016 8:50 PM, "Niphlod"  wrote:
>>>
 you can't os.chdir in web2py. first it's not threadsafe. second, you 
 screw up all web2py relative imports.

 BTW: httpserver.log is put on the same folder web2py.py is, unless you 
 are using the -f parameter, in which case it sits in that directory, which 
 is the one containing the "applications" folder.

 On Monday, January 11, 2016 at 4:06:38 PM UTC+1, Yebach wrote:
>
> Hello
>
> I have a strange behavior of my log file, or better to say the 
> location of my log file.
>
> If I understand correctly httpserver.log file is usually located in 
> application folder.
>
> When I have to run the engine the following code is executed
>
> path = applications/applicationName/engine/e1
> count = 0
> while ( count < 10 and ( os.path.isfile(outPath))):
> count += 1 
> os.remove(outPath)
> time.sleep(0.05)
> 
> # Run woshi engine
> path_1 =  os.path.join(path, 'e1')
> os.chdir(path_1)
>
> p = subprocess.Popen(['woshi_engine.exe', scriptId], 
> shell=True, stdout = subprocess.PIPE)
>
> After that the httpserver.log file is created in folder 
> applications/applicationName/engine/e1 and stays there
>
> Now if I run my second application in folder applications (like 
> production version) this file is moved to the engine folder of that 
> applicatio
>
> How can I set the default location of httpserver.log file and that the 
> file is not moved?
>
> Thank you 
> 
>
 -- 
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 --- 
 You received this message because you are subscribed to a topic in the 
 Google Groups "web2py-users" group.
 To unsubscribe from this topic, visit 
 https://groups.google.com/d/topic/web2py/0WuC-Ahx0W0/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/0WuC-Ahx0W0/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.
>>
>
>
>
> -- 
> Lep pozdrav 
>
> Vid Ogris
>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.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: Can we use a web2py app on Android mobile?

2016-01-12 Thread eric cuver
you can also do this with web2py you just need to create a webview with 
Cordova or Kivy with the URL of your mobile website view. Me this is what I 
do and it works without problems

Le lundi 11 janvier 2016 22:31:58 UTC+1, Alessio Varalta a écrit :
>
> Sorry, , you are right. Now i have developed only in Android now in these 
> day for a project i start to study cordova and is true that you can upload 
> on Google market this my first time with Hybrid app
>
> Il giorno lunedì 11 gennaio 2016 13:17:14 UTC+1, Andrew Buchan ha scritto:
>>
>> Just to butt-in on what Richard said:
>>
>> "But this kind of app are often not that interresting from user stand 
>> point... I mean you don't have a good mobile app user experience with them 
>> most of the time because they to simple that you can just access the real 
>> web app and it could be even better..."
>>
>> That's not really true anymore...
>>
>> What you are referring to are hybrid apps, which is essentially a 
>> mini-website (HTML, JS, CSS) wrapped in a package and rendered in a native 
>> webview, as opposed to a native app which is built in objective-C or Java.
>> Hybrid apps can access the phone's features such as camera, battery, 
>> geolocation, accelerometer etc... So you can do much more than you would by 
>> accessing a web app in the browser!
>> Hybrid performance is also more than adequate for most applications, and 
>> many of today's top apps are hybrid (in fact I challenge you to find out 
>> which apps on your phone are hybrid and which are native...)
>>
>> What's more, with tools like cordova you can target both Android and iOS 
>> (with caveats) with the same code.
>> You also get to use the latest Javascript frameworks, such as AngularJS 
>> or ReactJS.
>>
>> My advice would be to learn js and angular then go down the ionic (
>> http://ionicframework.com/) path. I really don't see a case for bringing 
>> web2py into android.
>>
>> Edit:
>>
>> What Alessio said isn't true either. You can publish hybrid apps to 
>> Google play and Apple's app store.
>>
>> Here's a useful page:
>>
>>
>> http://www.joshmorony.com/the-step-by-step-guide-to-publishing-a-html5-mobile-application-on-app-stores/
>>
>>
>>
>> On Monday, January 4, 2016 at 9:20:53 PM UTC, RAGHIB R wrote:
>>>
>>>

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


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

2016-01-12 Thread rgbapps1
thank you

On Tuesday, January 12, 2016 at 12:34:47 AM UTC+5:30, Anthony wrote:
>
> web2py isn't giving you the "wrong" time -- it's the local time on your 
> server. If you want UTC, you can use request.utcnow (request.now and 
> request.utcnow are just datetime.datetime.now() and 
> datetime.datetime.utcnow(), respectively).
>
> Anthony
>
> On Monday, January 11, 2016 at 12:50:05 PM UTC-5, RAGHIB R wrote:
>>
>> Can we do it without any plugin? If yes, how?
>>
>

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


Re: [web2py] Re: keepvalues - need help with this

2016-01-12 Thread szande333
hi Kiran,

would you posting an extract of your final solution?

cheers

Steve

On Thursday, 16 January 2014 02:32:31 UTC+8, Kiran Subbaraman wrote:
>
> Anthony,
> Thanks for the explanation. Went ahead and created widgets, and things 
> work just fine. 
>
> 
> Kiran Subbaramanhttp://subbaraman.wordpress.com/about/
>
> On Wed, 15-01-2014 2:28 PM, Anthony wrote:
>
> On Wednesday, January 15, 2014 3:47:28 AM UTC-5, Kiran Subbaraman wrote: 
>>
>> Hmm, I was planning to use keepvalues for the following scenarios: 
>>
>>- Scenario1 - submitted form returns with errors, and still displays 
>>the form with the submitted values
>>- Scenario2 - submit form successfully, and still display the form 
>>with the submitted values 
>>
>> You mention that the keepvalues should work fine for Scenario2.
>>
> No, I was just saying that keepvalues is only intended for Scenario2 -- it 
> is irrelevant for Scenario1 (in that cases, the values are retained 
> regardless of keepvalues). Neither scenario works for you because you are 
> not using form.custom.widget.
>  
>
>> Can you please elaborate how I can do this "so your custom widget should 
>> be able to retain the value if desired (without using request.vars)". 
>>
> Look at the documentation on custom widgets. Your widget function will 
> receive a field object and a value. Just take the value and use it as the 
> "value" attribute of your input element in the widget code.
>
> Anthony
> -- 
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> --- 
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to web2py+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/d/optout.


[web2py] Cookie issues in Safari 9

2016-01-12 Thread asears
Hey guys. I'm having an issue with logging users in on Safari 9.  It works 
in Chrome and Firefox fine.  When I try to log in, it will take me back to 
the login screen and no errors are shown.  This leads me to believe it is 
logging me in and then losing the session or something.  Also, we are 
changing the cookie to be good for all subdomains.  I have tracked it down 
to have something to do with us saving sessions in the database. Here is 
the code where we are changing the domain:

if not request.env.remote_addr in ['127.0.0.1', 'localhost']:
if "session_id_name" in response:
if response.session_id_name in response.cookies:
response.cookies[response.session_id_name]['domain'] = 
".mydomain.com"

I have noticed that in all browsers, this cookie is on the system twice. 
 They have the same name.  In Firefox and Chrome, the values of the two 
cookies are different from each other.  In Safari, they are the same value. 
 The only difference is the domain that the cookie is good for.  I have 
looked in the database to see what happens when I log in.  In Chrome and 
Firefox, it keeps the same row but updates the unique_key.  This new 
unique_key is in the value of the cookie where the domain is for all 
subdomains.  The other cookie is the old value.  However, in Safari, the 
cookies have the same value.  When I log in, instead of updating the 
previous cookie, it creates a new row and updates the cookie to match this 
row.

Any help would be much appreciated.  Thank you in advance!

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


[web2py] Re: Why I am always being redirected? How to get a response.flash instead here?

2016-01-12 Thread rgbapps1
How to do that? Can you write a chunk of code please if it doesn't bother 
you?

On Tuesday, January 12, 2016 at 12:31:27 AM UTC+5:30, Anthony wrote:
>
> On Monday, January 11, 2016 at 1:03:25 PM UTC-5, RAGHIB R wrote:
>>
>> {{=
>> x.name}}
>> this in my view calls this functions:
>> def my_insert_function():
>>   _id = request.args(0)
>>   db.store.insert(stuff = _id)
>>   
>>
>> if I don't put any redirect("sm page") here it takes me to a null page. 
>> How to prevent this and get a response.flash instead?
>>
>
> Well, your function doesn't return anything, so what do you expect?
>
> If you want the click to do a database insert but do not want to leave the 
> page you are on, you must make an Ajax request.
>
> Anthony
>

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


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

2016-01-12 Thread Niphlod
this is not threadsafe. use utc and translate dates when presented to users.

On Tuesday, January 12, 2016 at 12:41:44 PM UTC+1, Gael Princivalle wrote:
>
> You can set your timezone like that in your model:
>
> import os
>
> os.environ['TZ'] = 'Europe/Rome'
>
>
>

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


[web2py] Why this HTML email not working? Please tell me the corrected version.

2016-01-12 Thread RAGHIB R
def result():
session.x=mail.send('smm...@gmail.com',
'hello',
'Hi Raghib, you 
have a new entry: ','session.name+session.name2+" with 
"+str(session.percent)')
if session.x==True:
response.flash="result"
else:
response.flash="resultt"
return locals()

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


[web2py] Re: Why this HTML email not working? Please tell me the corrected version.

2016-01-12 Thread Niphlod
If you read docs about mail.send, you'd know that it takes

mail.send(to, subject, message, attachments, cc, .. etc etc etc).

for html-only mails, it should be

mail.send('recipi...@gmail.com, 'subject', 'thebody', etc etc 
etc)

That being said, what's the error ? 

On Tuesday, January 12, 2016 at 7:21:25 PM UTC+1, RAGHIB R wrote:
>
> def result():
> session.x=mail.send('smm...@gmail.com ',
> 'hello',
> ' style="background-color:pink;font-size:2em;display:inline">Hi Raghib, you 
> have a new entry: ','session.name+session.name2+" with 
> "+str(session.percent)')
> if session.x==True:
> response.flash="result"
> else:
> response.flash="resultt"
> return locals()
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.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 calculate size of uploads by user

2016-01-12 Thread Alex Glaros
what is easiest way to calculate total user uploaded data size so I can 
bill them for storage individually?

each user will have multiple files loaded at different times.  They will be 
billed each month.

thanks

Alex Glaros


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


[web2py] Re: Active Directories of multiple groups

2016-01-12 Thread Niphlod
with the default ldap adapter you can't.
It won't be hard to hack to search in multiple AD domains, but the setup is 
highly unusual: one app should have one source-per-type identification 
provider.

e.g. user: niphlod. I exist in Sacramento, but also on Los Angeles 
(because, basically, two niphlod(s) CAN'T exist in Sacramento, two 
niphlod(s) can't exist in Los Angeles, but two niphlod(s) can exist one in 
Sacramento and one in Los Angeles). Even if you track the domain (as 
niphlod@sacramento and niphlod@losangeles) you'd have to resort to some 
kind of group-permission based on the domain to let niphlod@sacramento NOT 
see niphlod@losangeles data.

If you have two distinct apps, there should be any problem with the default 
ldap adapter.

On Tuesday, January 12, 2016 at 7:46:37 PM UTC+1, Alex Glaros wrote:
>
> Can someone please lay out the general concepts of how to implement Active 
> Directory for multiple groups on a single cloud instance?
>
> Is it possible?
>
> Let's say I have cities of Sacramento and Los Angeles as clients on a 
> single, cloud-based version of w2p. They want to integrate their own Active 
> Directory into w2p so their employees don't have to register twice.
>
> Is there a way to do that? 
>
> thanks
>
> Alex Glaros
>

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


[web2py] How to get ip address of the device user client is using and the server device?

2016-01-12 Thread aston . ribat
as I find out from different sources, request.env.server_addr 
and  request.env.remote_addr should work but they don't really work. When I 
used this for my app on pythonanywhere, I always 
got  request.env.server_addr as None and different ip address 
for  request.env.remote_addr than what is shown when we check "what is my 
ip address" on google. Can someone tel me the right thing?

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


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

2016-01-12 Thread Niphlod
if you store the file-size as metadata it would be matter of a 

select sum(filesize) from thattable group by user

if you choose not to do it (which I don't recommend), you'd have to 
retrieve the file for each user and sum the calculated size.

On Tuesday, January 12, 2016 at 7:38:24 PM UTC+1, Alex Glaros wrote:
>
> what is easiest way to calculate total user uploaded data size so I can 
> bill them for storage individually?
>
> each user will have multiple files loaded at different times.  They will 
> be billed each month.
>
> thanks
>
> Alex Glaros
>
>
>

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


[web2py] Active Directories of multiple groups

2016-01-12 Thread Alex Glaros
Can someone please lay out the general concepts of how to implement Active 
Directory for multiple groups on a single cloud instance?

Is it possible?

Let's say I have cities of Sacramento and Los Angeles as clients on a 
single, cloud-based version of w2p. They want to integrate their own Active 
Directory into w2p so their employees don't have to register twice.

Is there a way to do that? 

thanks

Alex Glaros

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


[web2py] Tell me the difference between the three and tell me why they give different values:

2016-01-12 Thread aston . ribat

   
   - request.client
   - request.env.remote_addr 
   - request.env.http_x_forwarded_for

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.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: Tell me the difference between the three and tell me why they give different values:

2016-01-12 Thread Niphlod
request.client is equal to http_x_forwarded_for if the header is there, 
either remote_address.
They can't be ALL three different, unless request.env.remote_addr is an 
ipv6 address. Either request.client equals remote_addr or request.client 
equals http_x_forwarded_for .
on the "what they are" I strongly suggest to check the book, it's all 
explained there.

On Tuesday, January 12, 2016 at 8:13:45 PM UTC+1, aston...@gmail.com wrote:
>
>
>- request.client
>- request.env.remote_addr 
>- request.env.http_x_forwarded_for
>
>

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


[web2py] Re: Why I am always being redirected? How to get a response.flash instead here?

2016-01-12 Thread Anthony
http://web2py.com/books/default/chapter/29/11/jquery-and-ajax

On Tuesday, January 12, 2016 at 9:12:02 AM UTC-5, rgbap...@gmail.com wrote:
>
> How to do that? Can you write a chunk of code please if it doesn't bother 
> you?
>
> On Tuesday, January 12, 2016 at 12:31:27 AM UTC+5:30, Anthony wrote:
>>
>> On Monday, January 11, 2016 at 1:03:25 PM UTC-5, RAGHIB R wrote:
>>>
>>> {{=x.name}}
>>> this in my view calls this functions:
>>> def my_insert_function():
>>>   _id = request.args(0)
>>>   db.store.insert(stuff = _id)
>>>   
>>>
>>> if I don't put any redirect("sm page") here it takes me to a null page. 
>>> How to prevent this and get a response.flash instead?
>>>
>>
>> Well, your function doesn't return anything, so what do you expect?
>>
>> If you want the click to do a database insert but do not want to leave 
>> the page you are on, you must make an Ajax request.
>>
>> Anthony
>>
>

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


[web2py] Re: How to know the location of the user client on my site?

2016-01-12 Thread 黄祥
i think you can achieve it with datetime.timedelta and set the default 
value of your table with that value.
e.g.
import datetime
table.end_time.default = request.now + datetime.timedelta(seconds = 19200)

p.s.
19200 seconds is 5 hours and 20 minutes

best regards,
stifan

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


Re: [web2py] Re: web2py httpserver log file location

2016-01-12 Thread Niphlod
for this and the previous issue, you should be on the path "I won't never 
ever start a process inside a web request".
That being said, subprocess.Popen has cwdir .

On Monday, January 11, 2016 at 8:52:58 PM UTC+1, Yebach wrote:
>
> What do u suggest I use to startthe exe program. It takes one parameter 
> (script id)?
> On Jan 11, 2016 8:50 PM, "Niphlod"  wrote:
>
>> you can't os.chdir in web2py. first it's not threadsafe. second, you 
>> screw up all web2py relative imports.
>>
>> BTW: httpserver.log is put on the same folder web2py.py is, unless you 
>> are using the -f parameter, in which case it sits in that directory, which 
>> is the one containing the "applications" folder.
>>
>> On Monday, January 11, 2016 at 4:06:38 PM UTC+1, Yebach wrote:
>>>
>>> Hello
>>>
>>> I have a strange behavior of my log file, or better to say the location 
>>> of my log file.
>>>
>>> If I understand correctly httpserver.log file is usually located in 
>>> application folder.
>>>
>>> When I have to run the engine the following code is executed
>>>
>>> path = applications/applicationName/engine/e1
>>> count = 0
>>> while ( count < 10 and ( os.path.isfile(outPath))):
>>> count += 1 
>>> os.remove(outPath)
>>> time.sleep(0.05)
>>> 
>>> # Run woshi engine
>>> path_1 =  os.path.join(path, 'e1')
>>> os.chdir(path_1)
>>>
>>> p = subprocess.Popen(['woshi_engine.exe', scriptId], shell=True, 
>>> stdout = subprocess.PIPE)
>>>
>>> After that the httpserver.log file is created in folder 
>>> applications/applicationName/engine/e1 and stays there
>>>
>>> Now if I run my second application in folder applications (like 
>>> production version) this file is moved to the engine folder of that 
>>> applicatio
>>>
>>> How can I set the default location of httpserver.log file and that the 
>>> file is not moved?
>>>
>>> Thank you 
>>> 
>>>
>> -- 
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> --- 
>> You received this message because you are subscribed to a topic in the 
>> Google Groups "web2py-users" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/web2py/0WuC-Ahx0W0/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: Support for BIT(1) as boolean?

2016-01-12 Thread Alfonso Serra
Excuse me, one last question.

Is it really necesary? 
import copy
db._adapter.types = copy.copy(db._adapter.types)

or modify the adapter right away will work? It looks like it does, but i 
dont know if theres any implication by skiping copy.

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: Active Directories of multiple groups

2016-01-12 Thread Alex Glaros
So for a rookie like me, does the simplest solution seem to be to create a 
special independent app for each organization just for auth/LDAP purposes, 
then transmit the user data to the centralized, common, shared instance?

The goal is to allow for example, Paris and Chicago to auth independent of 
each other, but then use the shared system for collaborative projects.

thanks

Alex

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


[web2py] Re: Active Directories of multiple groups

2016-01-12 Thread Niphlod


On Tuesday, January 12, 2016 at 9:07:23 PM UTC+1, Alex Glaros wrote:
>
> So for a rookie like me, does the simplest solution seem to be to create a 
> special independent app for each organization just for auth/LDAP purposes, 
> then transmit the user data to the centralized, common, shared instance?
>
>
you can hack an app that authenticates users via multiple LDAP (whose 
access and delegations SHOULD be designed beforehand with a tight 
process-flow for the aforementioned issues) and then use it as a CAS 
provider for every app you need. CAS by default would only provide the id 
part, not the authorization one, which in your case still needs to be 
properly tailored because there won't be a "sharing" between LDAP domains.

I don't really know if something can be accomplished already by doing

from gluon.contrib.login_methods.ldap_auth import ldap_auth
auth.settings.login_methods.append(ldap_auth(mode='ad',
   server='chicago.domain.controller',
   base_dn='ou=Users,dc=domain,dc=com'))
auth.settings.login_methods.append(ldap_auth(mode='ad',
   server='losangeles.domain.controller',
   base_dn='ou=Users,dc=domain,dc=com'))

because theoretically when you "append" methods if a result isn't returned 
by the previous method it'll check into the following one.but I'd stll 
quadruple check the behaviour. 

The goal is to allow for example, Paris and Chicago to auth independent of 
> each other, but then use the shared system for collaborative projects.
>
>
Ehm. Following the beforementioned Paris should only allow paris users, 
Chicago chigago users and everyone using collaborative 
means 
implementing strict checks on Paris controllers, Chicago controllers and 
collaborative controllers

which can very well be done using appropriate group memberships.
 

> thanks
>
> Alex
>
>

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


Re: [web2py] Re: Active Directories of multiple groups

2016-01-12 Thread Richard Vézina
What about multi-tenancy?

http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer?search=multi+#Common-fields-and-multi-tenancy

He could check which domain is accessed and authenticate against the proper
LDAP instance, no?

Richard

On Tue, Jan 12, 2016 at 3:43 PM, Niphlod  wrote:

>
>
> On Tuesday, January 12, 2016 at 9:07:23 PM UTC+1, Alex Glaros wrote:
>>
>> So for a rookie like me, does the simplest solution seem to be to create
>> a special independent app for each organization just for auth/LDAP
>> purposes, then transmit the user data to the centralized, common, shared
>> instance?
>>
>>
> you can hack an app that authenticates users via multiple LDAP (whose
> access and delegations SHOULD be designed beforehand with a tight
> process-flow for the aforementioned issues) and then use it as a CAS
> provider for every app you need. CAS by default would only provide the id
> part, not the authorization one, which in your case still needs to be
> properly tailored because there won't be a "sharing" between LDAP domains.
>
> I don't really know if something can be accomplished already by doing
>
> from gluon.contrib.login_methods.ldap_auth import ldap_auth
> auth.settings.login_methods.append(ldap_auth(mode='ad',
>server='chicago.domain.controller',
>base_dn='ou=Users,dc=domain,dc=com'))
> auth.settings.login_methods.append(ldap_auth(mode='ad',
>server='losangeles.domain.controller',
>base_dn='ou=Users,dc=domain,dc=com'))
>
> because theoretically when you "append" methods if a result isn't returned
> by the previous method it'll check into the following one.but I'd stll
> quadruple check the behaviour.
>
> The goal is to allow for example, Paris and Chicago to auth independent of
>> each other, but then use the shared system for collaborative projects.
>>
>>
> Ehm. Following the beforementioned Paris should only allow paris
> users, Chicago chigago users and everyone using collaborative
> means
> implementing strict checks on Paris controllers, Chicago controllers and
> collaborative controllers
>
> which can very well be done using appropriate group memberships.
>
>
>> thanks
>>
>> Alex
>>
>> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.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: Function fails when called from scheduler, but ok when called from a controller/function

2016-01-12 Thread Niphlod
it seems an error in the model definition, as line 166 in gluon.shell is 
where an exception is raised when executing model files BEFORE calling the 
controller.
As I repeatedly said, scheduler is just calling shell at regular intervals 
on steroids. If it works on the shell, it'll work on the scheduler too.

so, 1st step. What if you execute the function in the shell directly ?

web2py.py -M -S appname/controller_name/function_name

The only thing that can sometimes get you in the corner is conditional 
models ... If  you're using them, be sure when you are queuing the task, 
that you do from the same controller which triggers the same conditional 
models where the function is defined.
Remember that the scheduler executes the same environment where the queuing 
happened if you don't pass an explicit application_name parameter (by 
default is current.request.application/current.request.controller) which 
executes models/* and models/controller_name but not 
models/other_controller_name

On Tuesday, January 12, 2016 at 5:50:52 PM UTC+1, Lisandro wrote:
>
> I'm seeing this traceback error when I try to run a function defined in a 
> model:
>
> Traceback (most recent call last): File 
> "/var/www/medios/gluon/scheduler.py", line 295, in executor _env = env(a=a
> , c=c, import_models=True) File "/var/www/medios/gluon/shell.py", line 166
> , in env sys.exit(1) SystemExit: 1
>
> However, if I call the function from within a controller/function, the 
> function executes ok.
> As I don't see an error pointing to my app's code, I thought I could ask 
> here. What am I missing?
>

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


Re: [web2py] Re: Can we use a web2py app on Android mobile?

2016-01-12 Thread Andrew Buchan
@eric That's interesting... So essentially you'd get an "app" on your
mobile, but it just opens to a webpage on a server.
That is probably the best solution offered so far although you need to be
connected to and also don't get access to phone's features like contacts,
notifications etc...


On Tue, Jan 12, 2016 at 9:04 AM, eric cuver 
wrote:

> you can also do this with web2py you just need to create a webview with
> Cordova or Kivy with the URL of your mobile website view. Me this is what I
> do and it works without problems
>
>
> Le lundi 11 janvier 2016 22:31:58 UTC+1, Alessio Varalta a écrit :
>>
>> Sorry, , you are right. Now i have developed only in Android now in these
>> day for a project i start to study cordova and is true that you can upload
>> on Google market this my first time with Hybrid app
>>
>> Il giorno lunedì 11 gennaio 2016 13:17:14 UTC+1, Andrew Buchan ha scritto:
>>>
>>> Just to butt-in on what Richard said:
>>>
>>> "But this kind of app are often not that interresting from user stand
>>> point... I mean you don't have a good mobile app user experience with them
>>> most of the time because they to simple that you can just access the real
>>> web app and it could be even better..."
>>>
>>> That's not really true anymore...
>>>
>>> What you are referring to are hybrid apps, which is essentially a
>>> mini-website (HTML, JS, CSS) wrapped in a package and rendered in a native
>>> webview, as opposed to a native app which is built in objective-C or Java.
>>> Hybrid apps can access the phone's features such as camera, battery,
>>> geolocation, accelerometer etc... So you can do much more than you would by
>>> accessing a web app in the browser!
>>> Hybrid performance is also more than adequate for most applications, and
>>> many of today's top apps are hybrid (in fact I challenge you to find out
>>> which apps on your phone are hybrid and which are native...)
>>>
>>> What's more, with tools like cordova you can target both Android and iOS
>>> (with caveats) with the same code.
>>> You also get to use the latest Javascript frameworks, such as AngularJS
>>> or ReactJS.
>>>
>>> My advice would be to learn js and angular then go down the ionic (
>>> http://ionicframework.com/) path. I really don't see a case for
>>> bringing web2py into android.
>>>
>>> Edit:
>>>
>>> What Alessio said isn't true either. You can publish hybrid apps to
>>> Google play and Apple's app store.
>>>
>>> Here's a useful page:
>>>
>>>
>>> http://www.joshmorony.com/the-step-by-step-guide-to-publishing-a-html5-mobile-application-on-app-stores/
>>>
>>>
>>>
>>> On Monday, January 4, 2016 at 9:20:53 PM UTC, RAGHIB R wrote:

 --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.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/1ZxFEB5j4XA/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] Email Registration

2016-01-12 Thread Tom Russell
I will try that but I also tried doing this locally and not on 
Pythonanywhere and get the same result so not too sure it is Pythonanywhere.

On Monday, January 11, 2016 at 4:35:50 PM UTC-5, Alessio Varalta wrote:
>
> write in the pythonanywhere forum because for example on my server there 
> are a service that web2py use automatic for the email we use our 
> server...but i use also pythonanywhere and i know that have specific 
> services for example for generate pdf ecc..( i don't use pythonanywhere 
> with email) So wirte in pythonanywhere forum and ask what type of service 
> use the site and the problem
>
> Il giorno sabato 9 gennaio 2016 22:52:17 UTC+1, Tom Russell ha scritto:
>>
>> Yea I have a premium account with pythonanywhere.
>>
>> On Saturday, January 9, 2016, Alessio Varalta  wrote:
>>
>>> Maybe is a problem of the server not web2py for example with 
>>> pythonanywhere you have to have a premium account or on the server there 
>>> aren't a service for the email 
>>>
>>> Il giorno sabato 9 gennaio 2016 21:41:31 UTC+1, Tom Russell ha scritto:


 Hi,

 I have everything in place according to the docs to do the email 
 registration process. However every time I try it in the error log it just 
 says email not sent and then a print out  of what the email would have 
 looked like had it been sent. I have no idea why I cannot get this to work.

 I am using web2py version 2.12.3-stable+timestamp.2015.08.19.00.18.03 
 on pythonanywhere.

 The server where the email from comes from is godaddy.

 Any ideas what to check for with this?

 Thanks,

 Tom

>>> -- 
>>> Resources:
>>> - http://web2py.com
>>> - http://web2py.com/book (Documentation)
>>> - http://github.com/web2py/web2py (Source code)
>>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>>> --- 
>>> You received this message because you are subscribed to a topic in the 
>>> Google Groups "web2py-users" group.
>>> To unsubscribe from this topic, visit 
>>> https://groups.google.com/d/topic/web2py/7X8GFnVHRU8/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: web2py httpserver log file location

2016-01-12 Thread Vid Ogris
Hello

I tried with sheduller
In model I created a file called scheduler.py
my code

def runWoshiEngine(scriptId, path, outPath):
import os, sys
import subprocess
count = 0
while ( count < 10 and ( os.path.isfile(outPath))):
count += 1
os.remove(outPath)
time.sleep(0.05)

# Run woshi engine
path_1 =  os.path.join(path, 'e1')
p = subprocess.Popen(['woshi_engine.exe', scriptId], shell=True, stdout
= subprocess.PIPE, cwd=path_1)


And in my controller function I did the following

 from gluon.scheduler import Scheduler
 scheduler = Scheduler(db, dict(runFunction = runWoshiEngine(scriptId,
path, outPath)))

Is this the right approach? and if it is how can I insert records in my db
for scheduler tables?

Thank you

2016-01-12 15:14 GMT+01:00 Niphlod :

> use anything you like EXCEPT something inside the web environment.
>
> On Tuesday, January 12, 2016 at 2:01:37 PM UTC+1, Yebach wrote:
>>
>> Using cwdir helped to solve the problem with httpserver.log file. Thank
>> you for that
>>
>> So you suggest using scheduler to start my exe program?
>>
>> 2016-01-12 12:24 GMT+01:00 Niphlod :
>>
>>> for this and the previous issue, you should be on the path "I won't
>>> never ever start a process inside a web request".
>>> That being said, subprocess.Popen has cwdir .
>>>
>>> On Monday, January 11, 2016 at 8:52:58 PM UTC+1, Yebach wrote:

 What do u suggest I use to startthe exe program. It takes one parameter
 (script id)?
 On Jan 11, 2016 8:50 PM, "Niphlod"  wrote:

> you can't os.chdir in web2py. first it's not threadsafe. second, you
> screw up all web2py relative imports.
>
> BTW: httpserver.log is put on the same folder web2py.py is, unless you
> are using the -f parameter, in which case it sits in that directory, which
> is the one containing the "applications" folder.
>
> On Monday, January 11, 2016 at 4:06:38 PM UTC+1, Yebach wrote:
>>
>> Hello
>>
>> I have a strange behavior of my log file, or better to say the
>> location of my log file.
>>
>> If I understand correctly httpserver.log file is usually located in
>> application folder.
>>
>> When I have to run the engine the following code is executed
>>
>> path = applications/applicationName/engine/e1
>> count = 0
>> while ( count < 10 and ( os.path.isfile(outPath))):
>> count += 1
>> os.remove(outPath)
>> time.sleep(0.05)
>>
>> # Run woshi engine
>> path_1 =  os.path.join(path, 'e1')
>> os.chdir(path_1)
>>
>> p = subprocess.Popen(['woshi_engine.exe', scriptId],
>> shell=True, stdout = subprocess.PIPE)
>>
>> After that the httpserver.log file is created in folder
>> applications/applicationName/engine/e1 and stays there
>>
>> Now if I run my second application in folder applications (like
>> production version) this file is moved to the engine folder of that
>> applicatio
>>
>> How can I set the default location of httpserver.log file and that
>> the file is not moved?
>>
>> Thank you
>>
>>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/0WuC-Ahx0W0/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/0WuC-Ahx0W0/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.
>>>
>>
>>
>>
>> --
>> Lep pozdrav
>>
>> Vid Ogris
>>
>>
>> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.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
> 

[web2py] Re: problem with PostgreSQL database

2016-01-12 Thread Júlia Rizza
I'm using psycopg2 v2.4.5.

Em terça-feira, 12 de janeiro de 2016 03:02:55 UTC-2, Massimo Di Pierro 
escreveu:
>
> very strange. ConnectionWrapper is not a web2py/dal object. which version 
> of psycopg2 are you using?
>
> On Monday, 11 January 2016 21:27:24 UTC-6, Júlia Rizza wrote:
>>
>> I have an web2py app connected with a PostgreSQL database and it's 
>> raising the following error:
>>
>>  must be psycopg2._psycopg.connection, not 
>> ConnectionWrapper
>>
>>
>> I couldn't figure it out. This is the traceback:
>>
>>
>> Traceback (most recent call last):
>>   File "/var/www/web2py/gluon/restricted.py", line 227, in restricted
>> exec ccode in environment
>>   File "/var/www/web2py/applications/web2courses/models/02_menu.py" 
>> , line 38, 
>> in 
>> if auth.has_membership('Teacher') or auth.has_membership('Admin'):
>>   File "/var/www/web2py/gluon/tools.py", line 4350, in has_membership
>> group_id = self.id_group(group_id)  # interpret group_id as a role
>>   File "/var/www/web2py/gluon/tools.py", line 4320, in id_group
>> rows = self.db(self.table_group().role == role).select()
>>   File "/var/www/web2py/gluon/packages/dal/pydal/objects.py", line 2025, in 
>> select
>> return adapter.select(self.query,fields,attributes)
>>   File "/var/www/web2py/gluon/packages/dal/pydal/adapters/base.py", line 
>> 1280, in select
>> sql = self._select(query, fields, attributes)
>>   File "/var/www/web2py/gluon/packages/dal/pydal/adapters/base.py", line 
>> 1167, in _select
>> sql_w = ' WHERE ' + self.expand(query) if query else ''
>>   File "/var/www/web2py/gluon/packages/dal/pydal/adapters/base.py", line 
>> 952, in expand
>> rv = op(first, second, **optional_args)
>>   File "/var/www/web2py/gluon/packages/dal/pydal/adapters/postgres.py", line 
>> 444, in EQ
>> eq = PostgreSQLAdapter.EQ(self, first, second)
>>   File "/var/www/web2py/gluon/packages/dal/pydal/adapters/base.py", line 
>> 846, in EQ
>> self.expand(second, first.type))
>>   File "/var/www/web2py/gluon/packages/dal/pydal/adapters/base.py", line 
>> 962, in expand
>> rv = self.represent(expression, field_type)
>>   File "/var/www/web2py/gluon/packages/dal/pydal/adapters/postgres.py", line 
>> 416, in represent
>> return PostgreSQLAdapter.represent(self, obj, fieldtype)
>>   File "/var/www/web2py/gluon/packages/dal/pydal/adapters/postgres.py", line 
>> 349, in represent
>> return BaseAdapter.represent(self, obj, fieldtype)
>>   File "/var/www/web2py/gluon/packages/dal/pydal/adapters/base.py", line 
>> 1489, in represent
>> return self.adapt(obj)
>>   File "/var/www/web2py/gluon/packages/dal/pydal/adapters/postgres.py", line 
>> 53, in adapt
>> adapted.prepare(self.connection)
>> TypeError: must be psycopg2._psycopg.connection, not ConnectionWrapper
>>
>>
>> Can somebody help me?
>>
>>

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


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

2016-01-12 Thread Alex Glaros
Can anyone help me with syntax for computing file size and posting to 
metadata? Niphlod got me started in the right direction.

Is this the right idea? Am trying to get file size into field file_size 
below:

def filesize(filename):
   import os, stat
   return os.uploadfolder(os.path.join(request.folder,'uploads'))

auth.settings.extra_fields['auth_user']= [
Field('thumbnail', 'upload', 
uploadfolder=os.path.join(request.folder,'uploads')),  ##, 
requires=RESIZE(50,50)), 

Field('file_size','integer',readable=False,writable=False,compute=lambda 
r:filesize(r['thumbnail']))]

Result was "None" for field file_size.

Alex

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


[web2py] How can we help with the documentation?

2016-01-12 Thread Alfonso Serra
Ive spent 6 hours wondering why i couldnt update or insert a record with 
the interactive console.

After changing mysql user passwords, drop tables, remigrate everything, 
mounting a fresh new web2py installation, tried to disable caching, i wasnt 
able to update or insert a record even tho the docs says you have to type 
row.update_record() after a single change, or db.mytable.insert(field1=...)

its not until i read the commit section when i realised my mistake. 
"In the interactive console you have to use db.commit()!", not the models, 
not the controllers, not the views.

The point is that i was trying to update or insert (with the console), 
while in the docs didnt mention anything about this case, in the update, 
insert sections.

There are many other similar things like this that has happened to me, and 
probably to many people. Most of them has been solved in this forum by the 
developers but improving the docs may help many of us without having to 
bother you guys that much.

I know documenting is not nearly as fun as developing but i would love to 
contribute to it as im learning and facing all these troubles. 

So yes, the question is. How can we help to improve the docs?

Would it be room for a wiki or is too much trouble?

Thanks

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


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

2016-01-12 Thread Alex Glaros
also tried to enter file_size within form when adding the record

if form.process().accepted:
session.flash = 'profile update accepted'
form.vars.file_size = filesize([form.vars.thumbnail])

result was 

return os.stat(os.path.join(request.uploadfolder,'uploads'))
  File "ntpath.py", line 64, in join
  File "ntpath.py", line 114, in splitdrive
TypeError: object of type 'NoneType' has no len()

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.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: problem with PostgreSQL database

2016-01-12 Thread Niphlod
ouch. it's 4 years ago.. try to update it :D

On Tuesday, January 12, 2016 at 5:05:50 PM UTC+1, Júlia Rizza wrote:
>
> I'm using psycopg2 v2.4.5.
>
> Em terça-feira, 12 de janeiro de 2016 03:02:55 UTC-2, Massimo Di Pierro 
> escreveu:
>>
>> very strange. ConnectionWrapper is not a web2py/dal object. which version 
>> of psycopg2 are you using?
>>
>> On Monday, 11 January 2016 21:27:24 UTC-6, Júlia Rizza wrote:
>>>
>>> I have an web2py app connected with a PostgreSQL database and it's 
>>> raising the following error:
>>>
>>>  must be psycopg2._psycopg.connection, not 
>>> ConnectionWrapper
>>>
>>>
>>> I couldn't figure it out. This is the traceback:
>>>
>>>
>>> Traceback (most recent call last):
>>>   File "/var/www/web2py/gluon/restricted.py", line 227, in restricted
>>> exec ccode in environment
>>>   File "/var/www/web2py/applications/web2courses/models/02_menu.py" 
>>> , line 38, 
>>> in 
>>> if auth.has_membership('Teacher') or auth.has_membership('Admin'):
>>>   File "/var/www/web2py/gluon/tools.py", line 4350, in has_membership
>>> group_id = self.id_group(group_id)  # interpret group_id as a role
>>>   File "/var/www/web2py/gluon/tools.py", line 4320, in id_group
>>> rows = self.db(self.table_group().role == role).select()
>>>   File "/var/www/web2py/gluon/packages/dal/pydal/objects.py", line 2025, in 
>>> select
>>> return adapter.select(self.query,fields,attributes)
>>>   File "/var/www/web2py/gluon/packages/dal/pydal/adapters/base.py", line 
>>> 1280, in select
>>> sql = self._select(query, fields, attributes)
>>>   File "/var/www/web2py/gluon/packages/dal/pydal/adapters/base.py", line 
>>> 1167, in _select
>>> sql_w = ' WHERE ' + self.expand(query) if query else ''
>>>   File "/var/www/web2py/gluon/packages/dal/pydal/adapters/base.py", line 
>>> 952, in expand
>>> rv = op(first, second, **optional_args)
>>>   File "/var/www/web2py/gluon/packages/dal/pydal/adapters/postgres.py", 
>>> line 444, in EQ
>>> eq = PostgreSQLAdapter.EQ(self, first, second)
>>>   File "/var/www/web2py/gluon/packages/dal/pydal/adapters/base.py", line 
>>> 846, in EQ
>>> self.expand(second, first.type))
>>>   File "/var/www/web2py/gluon/packages/dal/pydal/adapters/base.py", line 
>>> 962, in expand
>>> rv = self.represent(expression, field_type)
>>>   File "/var/www/web2py/gluon/packages/dal/pydal/adapters/postgres.py", 
>>> line 416, in represent
>>> return PostgreSQLAdapter.represent(self, obj, fieldtype)
>>>   File "/var/www/web2py/gluon/packages/dal/pydal/adapters/postgres.py", 
>>> line 349, in represent
>>> return BaseAdapter.represent(self, obj, fieldtype)
>>>   File "/var/www/web2py/gluon/packages/dal/pydal/adapters/base.py", line 
>>> 1489, in represent
>>> return self.adapt(obj)
>>>   File "/var/www/web2py/gluon/packages/dal/pydal/adapters/postgres.py", 
>>> line 53, in adapt
>>> adapted.prepare(self.connection)
>>> TypeError: must be psycopg2._psycopg.connection, not ConnectionWrapper
>>>
>>>
>>> Can somebody help me?
>>>
>>>

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


Re: [web2py] Re: web2py httpserver log file location

2016-01-12 Thread Niphlod
no, it's not. please read the relevant section on the book to get 
acquainted with the scheduler.

http://web2py.com/books/default/chapter/29/04/the-core#web2py-Scheduler

On Tuesday, January 12, 2016 at 4:06:31 PM UTC+1, Yebach wrote:
>
> Hello
>
> I tried with sheduller 
> In model I created a file called scheduler.py
> my code 
>
> def runWoshiEngine(scriptId, path, outPath):
> import os, sys
> import subprocess
> count = 0
> while ( count < 10 and ( os.path.isfile(outPath))):
> count += 1 
> os.remove(outPath)
> time.sleep(0.05)
> 
> # Run woshi engine
> path_1 =  os.path.join(path, 'e1')
> p = subprocess.Popen(['woshi_engine.exe', scriptId], shell=True, 
> stdout = subprocess.PIPE, cwd=path_1)
> 
>   
> And in my controller function I did the following
>
>  from gluon.scheduler import Scheduler
>  scheduler = Scheduler(db, dict(runFunction = runWoshiEngine(scriptId, 
> path, outPath)))
>
> Is this the right approach? and if it is how can I insert records in my db 
> for scheduler tables?
>
> Thank you
>
> 2016-01-12 15:14 GMT+01:00 Niphlod :
>
>> use anything you like EXCEPT something inside the web environment.
>>
>> On Tuesday, January 12, 2016 at 2:01:37 PM UTC+1, Yebach wrote:
>>>
>>> Using cwdir helped to solve the problem with httpserver.log file. Thank 
>>> you for that
>>>
>>> So you suggest using scheduler to start my exe program?
>>>
>>> 2016-01-12 12:24 GMT+01:00 Niphlod :
>>>
 for this and the previous issue, you should be on the path "I won't 
 never ever start a process inside a web request".
 That being said, subprocess.Popen has cwdir .

 On Monday, January 11, 2016 at 8:52:58 PM UTC+1, Yebach wrote:
>
> What do u suggest I use to startthe exe program. It takes one 
> parameter (script id)?
> On Jan 11, 2016 8:50 PM, "Niphlod"  wrote:
>
>> you can't os.chdir in web2py. first it's not threadsafe. second, you 
>> screw up all web2py relative imports.
>>
>> BTW: httpserver.log is put on the same folder web2py.py is, unless 
>> you are using the -f parameter, in which case it sits in that directory, 
>> which is the one containing the "applications" folder.
>>
>> On Monday, January 11, 2016 at 4:06:38 PM UTC+1, Yebach wrote:
>>>
>>> Hello
>>>
>>> I have a strange behavior of my log file, or better to say the 
>>> location of my log file.
>>>
>>> If I understand correctly httpserver.log file is usually located in 
>>> application folder.
>>>
>>> When I have to run the engine the following code is executed
>>>
>>> path = applications/applicationName/engine/e1
>>> count = 0
>>> while ( count < 10 and ( os.path.isfile(outPath))):
>>> count += 1 
>>> os.remove(outPath)
>>> time.sleep(0.05)
>>> 
>>> # Run woshi engine
>>> path_1 =  os.path.join(path, 'e1')
>>> os.chdir(path_1)
>>>
>>> p = subprocess.Popen(['woshi_engine.exe', scriptId], 
>>> shell=True, stdout = subprocess.PIPE)
>>>
>>> After that the httpserver.log file is created in folder 
>>> applications/applicationName/engine/e1 and stays there
>>>
>>> Now if I run my second application in folder applications (like 
>>> production version) this file is moved to the engine folder of that 
>>> applicatio
>>>
>>> How can I set the default location of httpserver.log file and that 
>>> the file is not moved?
>>>
>>> Thank you 
>>> 
>>>
>> -- 
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> --- 
>> You received this message because you are subscribed to a topic in 
>> the Google Groups "web2py-users" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/web2py/0WuC-Ahx0W0/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/0WuC-Ahx0W0/unsubscribe.
 To unsubscribe from this group and all its topics, send an email to 
 web2py+un...@googlegroups.com.
 For more options, visit 

[web2py] Function fails when called from scheduler, but ok when called from a controller/function

2016-01-12 Thread Lisandro
I'm seeing this traceback error when I try to run a function defined in a 
model:

Traceback (most recent call last): File "/var/www/medios/gluon/scheduler.py"
, line 295, in executor _env = env(a=a, c=c, import_models=True) File 
"/var/www/medios/gluon/shell.py", line 166, in env sys.exit(1) SystemExit: 1

However, if I call the function from within a controller/function, the 
function executes ok.
As I don't see an error pointing to my app's code, I thought I could ask 
here. What am I missing?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.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.