[web2py] Re: json-rpc

2018-04-24 Thread 黄祥
*json rpc (1.1 and 2) *
*for curl should be*
curl -X POST -d '{"method": "add", "params": [42, 23], "id": 1}' -i 
http://127.0.0.1:8000/test/default/call/jsonrpc
curl -X POST -d '{"method": "add", "params": {"a": 42, "b": 23}, "id": 1}' 
-i http://127.0.0.1:8000/test/default/call/jsonrpc
curl -X POST -d '{"jsonrpc": "2.0", "method": "add", "params": [42, 23], 
"id": 3 }' -i http://127.0.0.1:8000/test/default/call/jsonrpc2
curl -X POST -d '{"jsonrpc": "2.0", "method": "add", "params": {"a": 42, 
"b": 23}, "id": 3 }' -i http://127.0.0.1:8000/test/default/call/jsonrpc2

*for postman*
just change the method into POST and the body raw type (application/json) 
with the params from example above (curl -d)

xmlrpc seems must create the *.xml file first, not sure, never tried

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: change the record of a table

2018-04-24 Thread Vash


On Tuesday, April 24, 2018 at 11:46:07 AM UTC-7, Anthony wrote:
>
> On Tuesday, April 24, 2018 at 2:37:37 PM UTC-4, Vash wrote:
>>
>> say I have a table
>> db.define_table('mytable',
>>Field('is_public', 'boolean', default=False),
>> )
>> I want to toggle this to true if user clicked on the icon
>> if request.args(0) is not None:
>> q = ((db.checklists.user_email == auth.user.email) & (db.checklists.id 
>> == request.args(0)))
>> row=db(q).select().first()
>> row.update_record(is_public=not is_public)
>> would this work?
>>
>
> You've got the code, so can't you test it? Does it not do what you are 
> expecting? Without more context, it's hard to say, though from what you 
> have shown, the "is_public" variable is not defined. Perhaps you meant to 
> use row.is_public. Alternatively, you could do is_public=not 
> db.checklists.is_public, which will reverse whatever the current value is.
>
> Anthony
>  
>


I get this error 
Not Authorized
Insufficient privileges 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are 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] Validate a GET request using SQLFORM.factory and request vars

2018-04-24 Thread Alfonso Serra
Hi everybody.

Im trying to validate a simple GET request using SQLFORM.factory. but cant 
get it to pass. I would like just to validate those variables but i dont 
know what im missing. On the docs theres not much info about forms and the 
get method but form.accepts(request.vars, ...). 

The url would be:
http://myapp/get_rates?rooms=5=1


The controller:
def get_rates():
# http://myapp/get_rates?rooms=5=1

print "request:",  request.vars
# 

form = SQLFORM.factory(
Field("rooms", "integer", required=True)
, Field("agency", "integer", required=True)
, _method="GET"
)
#remove the auto id field
form.fields.pop(0)


print "accepts:", form.accepts(request.vars, session=None, dbio=False)
# False
print "validate:", form.validate(request_vars=request.vars, session=None
)
# False
print "fvars:", form.vars
# {}

if form.accepted:
print "All good"
elif form.errors:
print form.errors

print "Done"
return 0.0

And the console output:
request: 
accepts: False
validate: False
fvars: 
Done

Version 2.12.3-stable+timestamp.2015.08.19.00.18.03

What would be wrong with the code above?
is there an easier way to validate a GET request?

Many thanks in advance.


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


Re: [web2py] Re: web2py 2.16.1 and login menu on mobile systems NOT WORKING

2018-04-24 Thread Massimo Di Pierro
thanks Anthony. I keep saying "trunk" and should switch to a more 
appropriate terminology. :-)

On Monday, 23 April 2018 09:19:48 UTC-5, Anthony wrote:
>
> On Monday, April 23, 2018 at 7:35:35 AM UTC-4, Andrea Fae' wrote:
>>
>> I'm sorry. What is "in trunk"?
>>
>
> That just refers to the master branch on Github (I think the term "trunk" 
> is more commonly used in the context of the Subversion version control 
> system to represent the "main line" of development, in contrast to 
> "branches," representing separate lines of development).
>
> Anthony
>

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


Re: [web2py] web2py 2.16.1 and login menu on mobile systems NOT WORKING

2018-04-24 Thread Massimo Di Pierro
please I could use some help with this.

On Sunday, 22 April 2018 19:16:15 UTC-5, Carlos Cesar Caballero wrote:
>
> Yes, I usually use a newer bootstrap version, and make some fixes in the 
> layout bar.
>
> Testing the trunk I can see that is fixed, but there are some responsive 
> issues. Is there some issue open about this? If there is no one working I 
> can send some fixes.
>
> Greetings.
>
> El 22/04/18 a las 15:54, Andrea Fae' escribió:
>
> If you try to use welcome application on web2py 2.16.1 login menu 
> (hamburger icon) is not working. Clicking on it nothing happens...it's 
> a bug. 
> Am I right?
> -- 
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> --- 
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
>
>

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


Re: [web2py] please help us test trunk web2py

2018-04-24 Thread Massimo Di Pierro
please do even be aware that in trunk bs4 we no longer use the 
auth.navbar() I think the code is more transparent to new users without it. 
We may deprecate it.

On Sunday, 22 April 2018 19:05:31 UTC-5, Carlos Cesar Caballero wrote:
>
> Hi, I was testing and there are some issues with the DAL parse_as_rest and 
> Python 3. There are also some style issues with the welcome app navbar.
>
> I can work in the navbar if no one is working. 
>
> Greetings.
>
> El 24/02/18 a las 21:44, Massimo Di Pierro escribió:
>
> Please help us test the version of web2py which is posted on github. 
>
> I would like to release a new stable version and I would like to know if 
> any of the changes has broken backward compatibility.
> Also the icons are back in the latest welcome but use font-awesome.
>
> Please check it. Thanks.
>
> Massimo
>
> -- 
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> --- 
> You received this message because you are 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: 'Column table.id not found (SQLTABLE)'

2018-04-24 Thread Massimo Di Pierro
strange the local pydal should take precendence over the pip installed one. 
did you change the order package import somehow?

On Friday, 20 April 2018 20:05:28 UTC-5, Brian M wrote:
>
> Thank you for mentioning this - just wasted an hour plus trying to figure 
> out why my code had stopped working only to find that it was because I'd 
> done pip install pydal for something else and foolishly not used a venv. 
> Uninstalled pydal and everything was good again. So warning to others, 
> avoid globally installing pydal
>
> On Saturday, June 3, 2017 at 11:33:17 AM UTC-5, Najtsirk wrote:
>>
>> I checked this and I had pydal installed as a global module. 
>> When I removed it web2py's DAL works ok.
>>
>>
>>
>> On Saturday, 3 June 2017 18:30:05 UTC+2, Najtsirk wrote:
>>>
>>> +1
>>> Have this problem too!
>>>
>>> On Saturday, 3 June 2017 18:13:18 UTC+2, Maurice Waka wrote:

 Hi did anyone get to solve this error? I seem to be locked in it also
 Regards

 On Monday, March 20, 2017 at 4:39:13 PM UTC+3, Santiago Cartasegna 
 wrote:
>
> Are you trying to use a table that you have defined in your database 
> and not in web2py? 
> If it is the case you must add an id field with autoincremental
>
> El domingo, 12 de marzo de 2017, 20:27:08 (UTC-3), LoveWeb2py escribió:
>>
>> Keep getting this error for all of my tables!! What is going on?
>>
>> What information would be helpful for me to post to get help?
>>
>

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


[web2py] Re: problem export virtual field to CSV using grid

2018-04-24 Thread Massimo Di Pierro
Please open a ticket with a suggestion for improvement

On Sunday, 8 April 2018 08:58:04 UTC-5, Vic Ding wrote:
>
> Hi all,
> I am having issue exporting virtual fields to CSV using grid. It displays 
> fine though. 
>
> I defined field in this way
>
> Field.Virtual('cost_value', lambda row: row.inventory.cost_price_avg * 
> row.inventory.qty, label=T('Stock value')),
>
>
> When I export it to CSV in grid I got the following error
>  '"inventory"."cost_value"'
>
> The grid was a simple one
>
> fields = [db.inventory.qty, 
> db.inventory.cost_price_avg,db.inventory.cost_value]
> grid = SQLFORM.grid(db.inventory, maxtextlength=64, paginate=20, create=False,
> details=False, editable=editable, deletable=deletable,
> fields=fields,
> links=links,
> )
>
>
> Any clue?
>
> Thanks!
>
> Vic
>

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


[web2py] Re: Dynamic url routing

2018-04-24 Thread Massimo Di Pierro
no

On Wednesday, 18 April 2018 13:13:24 UTC-5, kamala kotha wrote:
>
> routes_in = (
>('/(?P[\w]+)(?P.*)', 
> '/myapp\g?client=\g'),
> )
>
> user will have to see the same url they had entered.
> so how should i have the routes_out so that outgoing url is same as 
> incoming url. Is there a way to access the dynamic prefix entered by user 
> in the routes_out?
>
> routes_out = ('myapp(?P.*)',  outgoing url?? )
>
>
>
>   
>

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

2018-04-24 Thread Massimo Di Pierro
I believe this is fixed in the most recent DAL

On Sunday, 15 April 2018 23:18:04 UTC-5, Joe Barnhart wrote:
>
> Anybody else seeing this?
>
> .../gluon/contrib/pymysql/cursors.py:166: Warning: (3090, u"Changing sql 
> mode 'NO_AUTO_CREATE_USER' is deprecated. It will be removed in a future 
> release.")
>
> This Is showing up on the console while running version 
> 2.16.1-stable+timestamp.2017.11.13.23.50.07
>
> Just curious...
>
> -- Joe
>

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


[web2py] Re: Request with login privileges hangs for a specific user account, how to debug it?

2018-04-24 Thread Lisandro
Hi Massimo, thank you for your time.
I had marked this thread as "no action needed" because I found the cause of 
the issue.

First I thought it was a different problem, so I opened a new thread in 
this forum:
https://groups.google.com/forum/#!topic/web2py/E9jrmf5E-B4
The title of that thread is not correct. I ended up finding that the 
problem is generated in some specific situations, and a specific key can't 
be stored at redis cache. In that thread I've posted some details about the 
tests I made to figure out that was the root cause. 

Sorry if I created some confusion opening a new thread, won't happen again 
:)


El martes, 24 de abril de 2018, 18:43:09 (UTC-3), Massimo Di Pierro 
escribió:
>
> That query itself cannot case hanging but maybe when that query is 
> executed the database is busy with some other background task?
> Try setting migrations to false. may be you are doing more database IO 
> than you should
>
> On Friday, 6 April 2018 09:41:09 UTC-5, Lisandro wrote:
>>
>> Hi Anthony, again, thank you very much for your time, I really appreciate 
>> it.
>>
>> El jueves, 5 de abril de 2018, 17:52:36 (UTC-3), Anthony escribió:
>>>
>>> On Thursday, April 5, 2018 at 2:57:20 PM UTC-4, Lisandro wrote:

 Thank you Anthony, yes I'm aware of that.
 I use it like that for this reason: sometimes (not very often) an 
 external app modifies a field of the auth_user table (specifically, it 
 sets 
 true or false a field that I use as a flag). However that change isn't 
 updated to auth.user. In order to do so, the user needs to logout and 
 login 
 again. So I retrieve the auth_user record again and store it to 
 response.answer.

 Maybe it could be done like this:
 if auth.is_logged_in():
 auth.user = db.auth_user[auth.user.id]

 But I thought it could be break something with Auth methods, so I store 
 it in response.user.

>>>
>>> Got it. Yeah, don't replace auth.user -- create a separate variable.
>>>  
>>>
 Anyway, I set this topic as "no action needed" because I opened a new 
 topic, I've found some more info and I think the issue isn't related to 
 that sentence.

>>>
>>> But you indicated the select generated by that code was causing Postgres 
>>> to hang. Are you sure that is the case? In other words, is the web2py code 
>>> getting stuck at that line and ultimately causing your server to time out? 
>>> Have you tried adding some logging statements to your code to determine 
>>> exactly where it is getting stuck?
>>>
>>
>> To be truth, I'm not exactly sure that is the line where the code hangs, 
>> I supposed that because of the select query taking too long, but I can't be 
>> sure.
>> The problem is that the incident presents sporadically, and the worst 
>> part is that I can't reproduce it. Also, as it happens in the production 
>> server, I can't afford to modify the app code in production, giving that I 
>> would be making changes to an application that is used by our customers, so 
>> I'm in a tricky situation. 
>>
>> I've made have plans to move sessions to Redis, but as a developer, I 
>> would still like to understand the root cause of the issue :)
>>
>> Anyway, I'll wait to the incident happens again, hoping that it happens 
>> in an app of a "small" customer so I can do some tests.
>>
>>
>>  
>>
>>>
>>> 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: Strange behaviour between two grids and different Bootstrap versions

2018-04-24 Thread Massimo Di Pierro
Can you post a minimalist app to reproduce?

On Wednesday, 11 April 2018 15:39:56 UTC-5, greenpoise wrote:
>
> So, I have this two applications with different bootstrap versions. One is 
> older version with Bootstrap 3 and the grid works perfectly. I am able to 
> view and edit the item and it takes me back to the grid. Meanwhile the new 
> version, Bootstrap4, I click on Edit for a specific item and I edit a 
> field, click submit and it refreshes but does not take me back to the grid 
> and even if I click back, the edited field does not update. Anyone has 
> experienced this?
>

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


[web2py] Re: Caching DAL Selects - only cache.ram works?

2018-04-24 Thread Massimo Di Pierro
please post a minimal model to reproduce the problem.

On Tuesday, 3 April 2018 17:15:25 UTC-5, Brian M wrote:
>
> Further investigation shows that cache.redis plays nicely with pyodbc *as 
> long as you have all uniquely named fields in your select*. The selects 
> that I was working with involved multiple tables that each had a "Name" 
> field that was being selected. If I add .with_alias() to provide unique 
> names then caching worked but that's also not really convenient. Is this 
> the way it is supposed to work?
>
> On Tuesday, April 3, 2018 at 2:16:30 PM UTC-5, Anthony wrote:
>>
>> You can also see what happens if you do not set cacheable=True.
>>
>> On Tuesday, April 3, 2018 at 3:15:55 PM UTC-4, Anthony wrote:
>>>
>>> It should work. Could be a bug specific to using pyodbc. Have you tried 
>>> it with other databases/drivers? Feel free to file a PyDAL issue.
>>>
>>> Anthony
>>>
>>> On Tuesday, April 3, 2018 at 12:40:50 PM UTC-4, Brian M wrote:

 I've been playing with caching and looking through the mailing list and 
 have a bit of confusion about whether or not you can actually cache DAL 
 Selects with anything other than cache.ram due to issues with what 
 can/cannot be pickled. When I use 

 db(...).select(...,cache=(cache.disk, 300), cacheable=True)

 Caching works just fine. But if I try it with cache.disk or cache.redis 
 instead then I get errors which seem to be related to not being able to 
 unpickle the cached select results. 

 type 'exceptions.TypeError'> ("cannot create 'pyodbc.Row' instances", 
 , )


 This, admittedly old, post seems to suggest that cache.redis should be 
 pretty much drop-in for cache.ram but that's not my experience. 
 https://groups.google.com/forum/?fromgroups#!searchin/web2py/caching$20model$20data/web2py/Tn4TiLPScII/jtMR1KtT4V8J


 So does the ability to cache DAL Selects really only exist for 
 cache.ram or am I missing something?


 Brian

>>>

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


[web2py] Re: Scheduler workers crash on usage of urllib

2018-04-24 Thread Massimo Di Pierro
yes. asap.

On Friday, 6 April 2018 17:02:32 UTC-5, Antonio Salazar wrote:
>
> Shouldn't this warrant a new release? The last stable release is 2.16.1 
> and the fix is missing there.
>
> On Saturday, December 16, 2017 at 3:47:06 PM UTC-6, Massimo Di Pierro 
> wrote:
>>
>> fixed on gitghub. thanks for reporting it.
>>
>> On Thursday, 7 December 2017 06:26:33 UTC-6, Ryan Herbert wrote:
>>>
>>> I found this issue: https://github.com/web2py/pydal/issues/498 which 
>>> denotes my exact problem, so it should be fixed soon (?). Not entirely sure 
>>> why this issue didn't come up when searching my error on google...
>>>
>>> On Wednesday, 6 December 2017 16:39:11 UTC+1, Ryan Herbert wrote:

 Hello,
 I am currently experiencing an issue with my scheduler workers crashing 
 on startup with the following error:

 Exception in thread Thread-1:
 Traceback (most recent call last):
   File "/usr/lib/python2.7/threading.py", line 801, in 
 __bootstrap_inner
 self.run()
   File "/usr/share/vidjil/server/web2py/gluon/scheduler.py", line 637, 
 in run
 self.send_heartbeat(counter)
   File "/usr/share/vidjil/server/web2py/gluon/scheduler.py", line 1161, 
 in send_heartbeat
 self.db._uri, folder=self.db._adapter.folder, decode_credentials=
 True)
   File 
 "/usr/share/vidjil/server/web2py/gluon/packages/dal/pydal/base.py", 
 line 169, in __call__
 obj = super(MetaDAL, cls).__call__(*args, **kwargs)
   File 
 "/usr/share/vidjil/server/web2py/gluon/packages/dal/pydal/base.py", 
 line 474, in __init__
 "Failure to connect, tried %d times:\n%s" % (attempts, tb)
 RuntimeError: Failure to connect, tried 5 times:
 Traceback (most recent call last):
   File 
 "/usr/share/vidjil/server/web2py/gluon/packages/dal/pydal/base.py", 
 line 454, in __init__
 self._adapter = adapter(**kwargs)
   File 
 "/usr/share/vidjil/server/web2py/gluon/packages/dal/pydal/adapters/__init__.py"
 , line 40, in __call__
 obj = super(AdapterMeta, cls).__call__(*args, **kwargs)
   File 
 "/usr/share/vidjil/server/web2py/gluon/packages/dal/pydal/adapters/base.py"
 , line 368, in __init__
 super(SQLAdapter, self).__init__(*args, **kwargs)
   File 
 "/usr/share/vidjil/server/web2py/gluon/packages/dal/pydal/adapters/base.py"
 , line 50, in __init__
 self._initialize_(do_connect)
   File 
 "/usr/share/vidjil/server/web2py/gluon/packages/dal/pydal/adapters/mysql.py"
 , line 24, in _initialize_
 user = self.credential_decoder(m.group('user'))
   File 
 "/usr/share/vidjil/server/web2py/gluon/packages/dal/pydal/base.py", 
 line 403, in 
 credential_decoder = lambda cred: urllib.unquote(cred)
 NameError: global name 'urllib' is not defined

 The workers are running inside a docker container and are started with 
 the following command:
 /usr/local/bin/gosu www-data python web2py.py -K myapp


 I have made sure urllib is correctly installed, and as far as I can 
 tell, it is. Or at least running a python shell and importing the module 
 works. Does anyone have any insight as to why this might be happening ?

 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: Request with login privileges hangs for a specific user account, how to debug it?

2018-04-24 Thread Massimo Di Pierro
That query itself cannot case hanging but maybe when that query is executed 
the database is busy with some other background task?
Try setting migrations to false. may be you are doing more database IO than 
you should

On Friday, 6 April 2018 09:41:09 UTC-5, Lisandro wrote:
>
> Hi Anthony, again, thank you very much for your time, I really appreciate 
> it.
>
> El jueves, 5 de abril de 2018, 17:52:36 (UTC-3), Anthony escribió:
>>
>> On Thursday, April 5, 2018 at 2:57:20 PM UTC-4, Lisandro wrote:
>>>
>>> Thank you Anthony, yes I'm aware of that.
>>> I use it like that for this reason: sometimes (not very often) an 
>>> external app modifies a field of the auth_user table (specifically, it sets 
>>> true or false a field that I use as a flag). However that change isn't 
>>> updated to auth.user. In order to do so, the user needs to logout and login 
>>> again. So I retrieve the auth_user record again and store it to 
>>> response.answer.
>>>
>>> Maybe it could be done like this:
>>> if auth.is_logged_in():
>>> auth.user = db.auth_user[auth.user.id]
>>>
>>> But I thought it could be break something with Auth methods, so I store 
>>> it in response.user.
>>>
>>
>> Got it. Yeah, don't replace auth.user -- create a separate variable.
>>  
>>
>>> Anyway, I set this topic as "no action needed" because I opened a new 
>>> topic, I've found some more info and I think the issue isn't related to 
>>> that sentence.
>>>
>>
>> But you indicated the select generated by that code was causing Postgres 
>> to hang. Are you sure that is the case? In other words, is the web2py code 
>> getting stuck at that line and ultimately causing your server to time out? 
>> Have you tried adding some logging statements to your code to determine 
>> exactly where it is getting stuck?
>>
>
> To be truth, I'm not exactly sure that is the line where the code hangs, I 
> supposed that because of the select query taking too long, but I can't be 
> sure.
> The problem is that the incident presents sporadically, and the worst part 
> is that I can't reproduce it. Also, as it happens in the production server, 
> I can't afford to modify the app code in production, giving that I would be 
> making changes to an application that is used by our customers, so I'm in a 
> tricky situation. 
>
> I've made have plans to move sessions to Redis, but as a developer, I 
> would still like to understand the root cause of the issue :)
>
> Anyway, I'll wait to the incident happens again, hoping that it happens in 
> an app of a "small" customer so I can do some tests.
>
>
>  
>
>>
>> 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: Updated Version of web2py and sending emails stopped working

2018-04-24 Thread Massimo Di Pierro
Notice that web2py in trunk supports sending emails from AWS+SNS

just do

mail.settings.server='aws'

the sender email must be authorized in the SNS config


On Wednesday, 4 April 2018 20:17:20 UTC-5, Dave S wrote:
>
>
>
> On Wednesday, April 4, 2018 at 6:13:06 PM UTC-7, Dave S wrote:
>>
>>
>>
>> On Wednesday, April 4, 2018 at 6:10:28 PM UTC-7, Dave S wrote:
>>>
>>>
>>>
>>> On Wednesday, April 4, 2018 at 5:08:22 PM UTC-7, James O' Driscoll wrote:

 Any insights??  Surely this is not preferable when people who have 
 clients and have to update web2py get no support.
>>>
>>>
>>> I updated from 2.14.6 to 2.15.4 with no issues to mail.  Not a very big 
>>> jump, perhaps, but it went okay.
>>>
>>> Perhaps you can do a -M yourapp -S and try the commands by hand, and 
>>> see if you get additional error messages.
>>>
>>> Is this code in a controller or a module?  Is it run during a normal 
>>> request, or from the scheduler?
>>>
>>>
>> Also, are you connecting to a third-party mail service such as Google or 
>> SparkPost?
>>
>
> [I don't; I have an AWS Linux machine with a local sendmail, which may 
> color my answers]
>
> And see Massimo's comments from last June:
> 
>
> /dps
>  
>

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


[web2py] Re: FYI: A tutorial on how to customize export in SQLFORM.grid

2018-04-24 Thread Massimo Di Pierro
fee free to create a better mechanism for that. We should really re-factor 
forms and grid

On Wednesday, 4 April 2018 03:46:46 UTC-5, Dave S wrote:
>
>
>
> On Tuesday, April 3, 2018 at 7:49:43 AM UTC-7, Alex Beskopilny wrote:
>>
>> Hi! 
>> exporter example
>>
>> 0 pip install xlwt 
>> 1 at end of gluon/sqlhtml.py 
>>
>> class ExporterXLS(ExportClass):
>> label = 'XLS'
>> file_ext = "xls"
>> content_type = ".xls"
>> # https://gist.github.com/brendano/22764
>> # https://groups.google.com/forum/#!topic/web2py/MR_8JzzP9o4
>> def __init__(self, rows):
>> ExportClass.__init__(self, rows)
>>
>> def export(self):
>> import xlwt, cStringIO
>> if len(self.rows) == 0:
>>   return 'empty rows-table'
>>
>> rows_colnames= [name.translate(None,'"') for name in 
>> self.rows.colnames ]
>>
>> (table_name, _)= rows_colnames[0].split('.')
>> book = xlwt.Workbook()
>> sheet = book.add_sheet(table_name)
>> first_xls_row= 0
>> # rows.db.licence.fld2.represent(row.fld2,3)
>>
>> def list2xls(row_num,line_list):
>> for col_num, value in enumerate(line_list):
>>  if value is None:
>>  value=''
>>  elif isinstance(value, long):
>>  value= str(value)
>>  elif isinstance(value, str):
>>  value= value.decode('utf8')
>>  elif isinstance(value,  datetime.date):
>>  value= value.strftime('%d.%m.%Y')
>>  elif isinstance(value, datetime.datetime):
>>  value= value.strftime('%d.%m.%Y %H:%M:%S')
>>  else:
>>  value=''
>>  sheet.write(row_num, col_num, value)
>>
>> fields=[]; labels=[]
>> for col in rows_colnames:
>> (t,f) = col.split('.')
>> fields.append(f)
>> labels.append( self.rows.db[t][f].label )
>> list2xls(first_xls_row, labels)
>>
>> for r_num, row in enumerate (self.rows, first_xls_row + 1):
>>  llist=[ row[f]  for f in fields]
>>  list2xls(r_num, llist)
>>
>> s = cStringIO.StringIO()
>> book.save(s)
>> return s.getvalue()
>>
>> 2  gluon/sqlhtml.py 
>> 2517 exportManager = dict(
>> 2518 axls=(ExporterXLS, 'XLS', T('Excell file')), # myfix
>> 2519 csv_with_hidden_cols=(ExporterCSV_hidden, 'CSV (hidden 
>> cols)', T('Comma-separated export including columns not shown; fields from 
>> other tables are exported as raw values  for faster export')),
>> ...
>>
>> 3 it's work for me :)
>>
>>
>>
> It looks like that has to be done each time you have a new version of 
> web2py.
>
> /dps
>  
>
>> воскресенье, 1 апреля 2018 г., 10:08:30 UTC+3 пользователь Ray (a.k.a. 
>> Iceberg) написал:
>>>
>>> Stumbled upon this blog post "Export in web2py's SQLFORM.grid 
>>> " by Prasad Muley. It 
>>> provides concrete example on how to customize an exporter TO REMOVE THE 
>>> TABLE PREFIX IN CSV HEADER LINE. That is easier to digest than the standard 
>>> web2py book's one-liner 
>>> 
>>>  
>>> "(exporters) are all defined in gluon/sqlhtml.py. Take a look at those for 
>>> creating your own exporter.".
>>>
>>> Hope that helps! Enjoy!
>>>
>>> Regards,
>>> Ray
>>>
>>>
>>>

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


Re: [web2py] How do I upload the .w2py file?

2018-04-24 Thread Massimo Di Pierro
I confirm. I use that all the time (but there is no dash)

tar zxvf web2py_app.w2p


On Tuesday, 3 April 2018 23:33:12 UTC-5, 黄祥 wrote:
>
> like marco said, it's just tar.gz file, think you can extract it in 
> web2py/applications folder with the command (not tested)
> tar -xzvf web2py_file.w2p 
>
> 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: HOW CAN I PRINT THIS

2018-04-24 Thread Dave S


On Tuesday, April 24, 2018 at 1:30:42 PM UTC-7, Ayron Rangel wrote:
>
> Like this: 
>
> {{for row in results:}}
> 
> {{=row.id}}
> {{=row.product}}
>
>
> appears erros
>
>
>
For us to comment intelligently about the errors, you have to provide the 
error details.  Is there a ticket generated?   No ticket, but the results 
are wrong?

If that's all the code you have in the view, you may be missing the "pass" 
statement.  In views, "if" and and "for" require a "pass" to replace normal 
end-by-unindent of regular python.

BTW, I prefer not to "return locals", as that may include information that 
you didn't want to leak.  An explicit
"return dict(results=results)" seems like a better idea to me.


/dps

Em terça-feira, 24 de abril de 2018 16:59:11 UTC-3, Dave S escreveu:
>>
>>
>>
>> On Tuesday, April 24, 2018 at 6:49:57 AM UTC-7, Ayron Rangel wrote:
>>>
>>> Guys, 
>>>
>>> How can i print this in HTML (CUSTOM) DAL :
>>> def stock ():
>>>sum = db.input_inventory.input_price.sum()
>>>count = db.input_inventory.product.count()
>>>results = db(db.input_inventory).select(db.input_inventory.product, 
>>> count, sum, groupby = db.product)
>>>return locals()
>>>
>>> HMTL:
>>> {{row in results:}}
>>>   {{}}
>>>
>>>
>>
>> You can fill in the table yourself using a for-loop:
>> 
>> or you could use SQLTABLE.   I have examples of both in my projects.
>>
>> I think SQLFORM.grid can also be used, but you may have to set writable 
>> FALSE for everything if you don't want it edited.
>>
>> Then there's Datatables and similiar libraries if you want spreadsheet 
>> behavior.
>> 
>> 
>>
>> /dps
>>
>>
>>

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


[web2py] Re: Docker Image for CentOS and Alpine

2018-04-24 Thread David Sperling
We are looking for a way to bypass the admin application security checks 
when running in a container.  Any suggestions?

The issue and detailed questions are here:
https://github.com/web2py/web2py/issues/1913

On Friday, April 20, 2018 at 11:32:45 AM UTC-7, David Sperling wrote:
>
> We have been using Web2py for several years and are now Dockerizing our 
> solution for a cloud deployment.
>
> After looking through the existing Docker solutions, we did not find a 
> project that met our requirements:
>
>- Based on CentOS (Alpine is supported as well)
>- Void of HTTPS support - we handle this with a separate Docker 
>container running nginx
>- Supports both uWSGI for deployment and HTTP for developer testing
>- Supports all Web2py versions
>- Minimalistic with very few layers and following Dockerfile best 
>practices
>
> If anyone has similar requirements or would like to help us test these new 
> images, you can find them here.
>
> https://github.com/smithmicro/web2py
>
> or
>
> docker run -p 8080:8080 smithmicro/web2py
>
> Many thanks to the Web2py community!
>
> Cheers,
> Dave Sperling
> Smith Micro
>
>

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

2018-04-24 Thread Ayron Rangel
Like this: 

{{for row in results:}}

{{=row.id}}
{{=row.product}}


appears erros


Em terça-feira, 24 de abril de 2018 16:59:11 UTC-3, Dave S escreveu:
>
>
>
> On Tuesday, April 24, 2018 at 6:49:57 AM UTC-7, Ayron Rangel wrote:
>>
>> Guys, 
>>
>> How can i print this in HTML (CUSTOM) DAL :
>> def stock ():
>>sum = db.input_inventory.input_price.sum()
>>count = db.input_inventory.product.count()
>>results = db(db.input_inventory).select(db.input_inventory.product, 
>> count, sum, groupby = db.product)
>>return locals()
>>
>> HMTL:
>> {{row in results:}}
>>   {{}}
>>
>>
>
> You can fill in the table yourself using a for-loop:
> 
> or you could use SQLTABLE.   I have examples of both in my projects.
>
> I think SQLFORM.grid can also be used, but you may have to set writable 
> FALSE for everything if you don't want it edited.
>
> Then there's Datatables and similiar libraries if you want spreadsheet 
> behavior.
> 
> 
>
> /dps
>
>
>

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


[web2py] Re: Insert not inserting data

2018-04-24 Thread Kenneth
The function that contains this does a lot of things, but nothing else 
regarding this table. And no values are not hard coded, just trying to find 
out the problem so I made it as simple as possible. 

If I look at the table in MySQL prompt is see that highest record ID is 
lets say 24030, I run the controller 10 times and look at the table again, 
still highest record is 24030. If I at this moment insert a record manually 
from MySQL prompt it'll get ID, 24041. 


Kenneth

Den tisdag 24 april 2018 kl. 04:16:34 UTC+3 skrev Anthony:
>
> Can we get more context? What does the real code look like (I assume you 
> don't really have a line at the top level of a controller file that inserts 
> the same hard-coded record on every request to the controller)? How are you 
> determining that no new records are inserted but the id is 
> auto-incrementing?
>
> Anthony
>
> On Sunday, April 22, 2018 at 6:55:18 PM UTC-4, Kenneth wrote:
>>
>> Hello,
>>
>> I can't understand this simple problem. 
>>
>> tracker = db.usage_tracker.insert(client = 6728, product_group = 2, 
>> product = 15)
>>
>> nothing appears in the database. ID counter is updated. If I look 
>> at db._lastsql I get 
>>
>> INSERT INTO usage_tracker(logged_in,product,client,product_group) VALUES 
>> ('2018-04-23 01:51:34.001992',15,6728,2);
>>
>> this is in a normal controller. 
>>
>> If I put the same tracker = db.usage_tracker.insert(client = 6728, 
>> product_group = 2, product = 15) in an own function in controller it works. 
>>
>>
>> Kenneth
>>
>>

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

2018-04-24 Thread Dave S


On Tuesday, April 24, 2018 at 6:49:57 AM UTC-7, Ayron Rangel wrote:
>
> Guys, 
>
> How can i print this in HTML (CUSTOM) DAL :
> def stock ():
>sum = db.input_inventory.input_price.sum()
>count = db.input_inventory.product.count()
>results = db(db.input_inventory).select(db.input_inventory.product, 
> count, sum, groupby = db.product)
>return locals()
>
> HMTL:
> {{row in results:}}
>   {{}}
>
>

You can fill in the table yourself using a for-loop:

or you could use SQLTABLE.   I have examples of both in my projects.

I think SQLFORM.grid can also be used, but you may have to set writable 
FALSE for everything if you don't want it edited.

Then there's Datatables and similiar libraries if you want spreadsheet 
behavior.



/dps


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


[web2py] Re: change the record of a table

2018-04-24 Thread Anthony
On Tuesday, April 24, 2018 at 2:37:37 PM UTC-4, Vash wrote:
>
> say I have a table
> db.define_table('mytable',
>Field('is_public', 'boolean', default=False),
> )
> I want to toggle this to true if user clicked on the icon
> if request.args(0) is not None:
> q = ((db.checklists.user_email == auth.user.email) & (db.checklists.id == 
> request.args(0)))
> row=db(q).select().first()
> row.update_record(is_public=not is_public)
> would this work?
>

You've got the code, so can't you test it? Does it not do what you are 
expecting? Without more context, it's hard to say, though from what you 
have shown, the "is_public" variable is not defined. Perhaps you meant to 
use row.is_public. Alternatively, you could do is_public=not 
db.checklists.is_public, which will reverse whatever the current value is.

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] change the record of a table

2018-04-24 Thread Vash
say I have a table
db.define_table('mytable',
   Field('is_public', 'boolean', default=False),
)
I want to toggle this to true if user clicked on the icon
if request.args(0) is not None:
q = ((db.checklists.user_email == auth.user.email) & (db.checklists.id == 
request.args(0)))
row=db(q).select().first()
row.update_record(is_public=not is_public)
would this work?

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


[web2py] Re: how to use tornado with ssl?

2018-04-24 Thread António Ramos
typo
python gluon/contrib/websocket_messaging.py -k mykey -p 1 -s keyfile.pem
 *-c cert.pem*


2018-04-24 16:39 GMT+01:00 António Ramos :

> how do i generate the 2 pem files below?
>
> python gluon/contrib/websocket_messaging.py -k mykey -p 1 -s
> keyfile.pem
>
> regards?
>

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


[web2py] how to use tornado with ssl?

2018-04-24 Thread António Ramos
how do i generate the 2 pem files below?

python gluon/contrib/websocket_messaging.py -k mykey -p 1 -s keyfile.pem

regards?

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


Re: [web2py] Re: web2py 2.16.1 is OUT

2018-04-24 Thread Richard Vézina
Here : https://github.com/web2py/web2py/issues/1911

On Tue, Apr 24, 2018 at 11:20 AM, Richard Vézina <
ml.richard.vez...@gmail.com> wrote:

> Also, to my understanding it only log an error, it no big deal, as long as
> the welcome app package is there... What we could do it to log an error
> when there is actually no welcome app pacakge as it break web2py
> functionality other then that as long as the welcome package is there the
> only issue is that it will be out dated which is not ideal, but might be
> better then having a broken app creation utility...
>
> I open an issue..
>
> Richard
>
> On Tue, Apr 24, 2018 at 11:09 AM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>> Yes but even then, in the end you don't want to create a new welcome
>> package if it not a new install as it gonna slow things down... So it will
>> end slow down thing and always create an new welcome package, no??
>>
>> I would leave it like that and add a NEWINSTALL empty file in the
>> repository...
>>
>> We definetly open an issue...
>>
>> Richard
>>
>> On Tue, Apr 24, 2018 at 8:51 AM, Carlos Cesar Caballero Díaz <
>> carlos.caball...@cfg.jovenclub.cu> wrote:
>>
>>> I think we should check if the file exists before try to delete it.
>>>
>>> or move the unlik() function to a new "try-except" block, something like:
>>>
>>> if welcome.w2p is correctly created:
>>>
>>> try:
>>>
>>> os.unlink('NEWINSTALL')
>>>
>>> except FileNotFoundError:
>>>
>>> nothing to do
>>>
>>> except:
>>>
>>> error removing 'NEWINSTALL' file
>>>
>>>
>>> Greetings.
>>>
>>> El 23/04/18 a las 13:33, Richard Vézina escribió:
>>>
>>> Actually it already inside a try... And it only logging an error...
>>> Should this be an error or a warning?? I guess this is done for the
>>> appadmin to allow it to create new app as it base on welcome... The welcome
>>> template is provision at first web2py run once install and derived from the
>>> welcome app...
>>>
>>> I guess it wouldn't be a good solution to track this NEWINSTALL file in
>>> the repo, as it could trigger some other issue... But at the same time, if
>>> you manage your web2py install with git, it might just make sens that
>>> whenever you update your local repo, that this file get recreated and the
>>> template being updated??
>>>
>>> Richard
>>>
>>> On Mon, Apr 23, 2018 at 1:28 PM, Richard Vézina <
>>> ml.richard.vez...@gmail.com> wrote:
>>>
 I guess we could had a simple "try" there...

 Richard

 On Mon, Apr 23, 2018 at 1:26 PM, Richard Vézina <
 ml.richard.vez...@gmail.com> wrote:

> Yeah this file is not there when we clone web2py... But I just check
> and it's there when you download web2py build from web2py.com...
>
> What's weird is that I didn't have the issue...
>
> Richard
>
> On Mon, Apr 23, 2018 at 12:39 PM, Carlos Cesar Caballero Díaz <
> carlos.caball...@cfg.jovenclub.cu> wrote:
>
>> Ok, I have found the issue:
>>
>> 
>> Traceback (most recent call last):
>>   File "/home/carlos.caballero/test/w2ptest/gluon/fileutils.py",
>> line 270, in create_welcome_w2p
>> os.unlink('NEWINSTALL')
>> FileNotFoundError: [Errno 2] No such file or directory: 'NEWINSTALL'
>> 
>>
>> El 23/04/18 a las 11:48, Richard Vézina escribió:
>>
>> In gluon/fileutil.py
>>
>> Richard
>>
>> On Mon, Apr 23, 2018 at 11:47 AM, Richard Vézina <
>> ml.richard.vez...@gmail.com> wrote:
>>
>>> The python3 welcome.w2p creation issue??
>>>
>>> I think it a dependency issue that might be obufuscated by _compat.py
>>>
>>> You can try to replace this line :
>>>
>>> w2p_pack('welcome.w2p', 'applications/welcome')
>>>
>>> By
>>>
>>> w2p_pack('welcome.w2p', 'applications', 'welcome')
>>>
>>> And report here if it help...
>>>
>>> Richard
>>>
>>> On Mon, Apr 23, 2018 at 11:42 AM, Carlos Cesar Caballero Díaz <
>>> carlos.caball...@cfg.jovenclub.cu> wrote:
>>>
 I have the same issue, using the current master branch in Ubuntu.

 Greetings.

 El 21/04/18 a las 08:21, Richard Vézina escribió:

 Actually I can't reproduced... It could it be a permission error??

 Try to clone it fresh some where you have full access with this
 command :

 git clone --recursive https://github.com/web2py/web2py.git

 Then

 cd web2py
 python3 web2py.py

 Enter password


 Richard

 On Sat, Apr 21, 2018 at 8:01 AM, Richard Vézina <
 ml.richard.vez...@gmail.com> wrote:

> Can you open an issue?
>
> I think it related to this : https://github.com/web2py/we

Re: [web2py] Re: web2py 2.16.1 is OUT

2018-04-24 Thread Richard Vézina
Also, to my understanding it only log an error, it no big deal, as long as
the welcome app package is there... What we could do it to log an error
when there is actually no welcome app pacakge as it break web2py
functionality other then that as long as the welcome package is there the
only issue is that it will be out dated which is not ideal, but might be
better then having a broken app creation utility...

I open an issue..

Richard

On Tue, Apr 24, 2018 at 11:09 AM, Richard Vézina <
ml.richard.vez...@gmail.com> wrote:

> Yes but even then, in the end you don't want to create a new welcome
> package if it not a new install as it gonna slow things down... So it will
> end slow down thing and always create an new welcome package, no??
>
> I would leave it like that and add a NEWINSTALL empty file in the
> repository...
>
> We definetly open an issue...
>
> Richard
>
> On Tue, Apr 24, 2018 at 8:51 AM, Carlos Cesar Caballero Díaz <
> carlos.caball...@cfg.jovenclub.cu> wrote:
>
>> I think we should check if the file exists before try to delete it.
>>
>> or move the unlik() function to a new "try-except" block, something like:
>>
>> if welcome.w2p is correctly created:
>>
>> try:
>>
>> os.unlink('NEWINSTALL')
>>
>> except FileNotFoundError:
>>
>> nothing to do
>>
>> except:
>>
>> error removing 'NEWINSTALL' file
>>
>>
>> Greetings.
>>
>> El 23/04/18 a las 13:33, Richard Vézina escribió:
>>
>> Actually it already inside a try... And it only logging an error...
>> Should this be an error or a warning?? I guess this is done for the
>> appadmin to allow it to create new app as it base on welcome... The welcome
>> template is provision at first web2py run once install and derived from the
>> welcome app...
>>
>> I guess it wouldn't be a good solution to track this NEWINSTALL file in
>> the repo, as it could trigger some other issue... But at the same time, if
>> you manage your web2py install with git, it might just make sens that
>> whenever you update your local repo, that this file get recreated and the
>> template being updated??
>>
>> Richard
>>
>> On Mon, Apr 23, 2018 at 1:28 PM, Richard Vézina <
>> ml.richard.vez...@gmail.com> wrote:
>>
>>> I guess we could had a simple "try" there...
>>>
>>> Richard
>>>
>>> On Mon, Apr 23, 2018 at 1:26 PM, Richard Vézina <
>>> ml.richard.vez...@gmail.com> wrote:
>>>
 Yeah this file is not there when we clone web2py... But I just check
 and it's there when you download web2py build from web2py.com...

 What's weird is that I didn't have the issue...

 Richard

 On Mon, Apr 23, 2018 at 12:39 PM, Carlos Cesar Caballero Díaz <
 carlos.caball...@cfg.jovenclub.cu> wrote:

> Ok, I have found the issue:
>
> 
> Traceback (most recent call last):
>   File "/home/carlos.caballero/test/w2ptest/gluon/fileutils.py", line
> 270, in create_welcome_w2p
> os.unlink('NEWINSTALL')
> FileNotFoundError: [Errno 2] No such file or directory: 'NEWINSTALL'
> 
>
> El 23/04/18 a las 11:48, Richard Vézina escribió:
>
> In gluon/fileutil.py
>
> Richard
>
> On Mon, Apr 23, 2018 at 11:47 AM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>> The python3 welcome.w2p creation issue??
>>
>> I think it a dependency issue that might be obufuscated by _compat.py
>>
>> You can try to replace this line :
>>
>> w2p_pack('welcome.w2p', 'applications/welcome')
>>
>> By
>>
>> w2p_pack('welcome.w2p', 'applications', 'welcome')
>>
>> And report here if it help...
>>
>> Richard
>>
>> On Mon, Apr 23, 2018 at 11:42 AM, Carlos Cesar Caballero Díaz <
>> carlos.caball...@cfg.jovenclub.cu> wrote:
>>
>>> I have the same issue, using the current master branch in Ubuntu.
>>>
>>> Greetings.
>>>
>>> El 21/04/18 a las 08:21, Richard Vézina escribió:
>>>
>>> Actually I can't reproduced... It could it be a permission error??
>>>
>>> Try to clone it fresh some where you have full access with this
>>> command :
>>>
>>> git clone --recursive https://github.com/web2py/web2py.git
>>>
>>> Then
>>>
>>> cd web2py
>>> python3 web2py.py
>>>
>>> Enter password
>>>
>>>
>>> Richard
>>>
>>> On Sat, Apr 21, 2018 at 8:01 AM, Richard Vézina <
>>> ml.richard.vez...@gmail.com> wrote:
>>>
 Can you open an issue?

 I think it related to this : https://github.com/web2py/we
 b2py/blob/fb4c114d85494ad6d79d69539adaae103d76e5ce/gluon/fil
 eutils.py#L269

 Path string that has to be manipulated differently in python 3

 Explanation

 https://www.scivision.co/python-idiomatic-pathlib-use/

 On Fri, Apr 

Re: [web2py] Re: web2py 2.16.1 is OUT

2018-04-24 Thread Richard Vézina
Yes but even then, in the end you don't want to create a new welcome
package if it not a new install as it gonna slow things down... So it will
end slow down thing and always create an new welcome package, no??

I would leave it like that and add a NEWINSTALL empty file in the
repository...

We definetly open an issue...

Richard

On Tue, Apr 24, 2018 at 8:51 AM, Carlos Cesar Caballero Díaz <
carlos.caball...@cfg.jovenclub.cu> wrote:

> I think we should check if the file exists before try to delete it.
>
> or move the unlik() function to a new "try-except" block, something like:
>
> if welcome.w2p is correctly created:
>
> try:
>
> os.unlink('NEWINSTALL')
>
> except FileNotFoundError:
>
> nothing to do
>
> except:
>
> error removing 'NEWINSTALL' file
>
>
> Greetings.
>
> El 23/04/18 a las 13:33, Richard Vézina escribió:
>
> Actually it already inside a try... And it only logging an error... Should
> this be an error or a warning?? I guess this is done for the appadmin to
> allow it to create new app as it base on welcome... The welcome template is
> provision at first web2py run once install and derived from the welcome
> app...
>
> I guess it wouldn't be a good solution to track this NEWINSTALL file in
> the repo, as it could trigger some other issue... But at the same time, if
> you manage your web2py install with git, it might just make sens that
> whenever you update your local repo, that this file get recreated and the
> template being updated??
>
> Richard
>
> On Mon, Apr 23, 2018 at 1:28 PM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>> I guess we could had a simple "try" there...
>>
>> Richard
>>
>> On Mon, Apr 23, 2018 at 1:26 PM, Richard Vézina <
>> ml.richard.vez...@gmail.com> wrote:
>>
>>> Yeah this file is not there when we clone web2py... But I just check and
>>> it's there when you download web2py build from web2py.com...
>>>
>>> What's weird is that I didn't have the issue...
>>>
>>> Richard
>>>
>>> On Mon, Apr 23, 2018 at 12:39 PM, Carlos Cesar Caballero Díaz <
>>> carlos.caball...@cfg.jovenclub.cu> wrote:
>>>
 Ok, I have found the issue:

 
 Traceback (most recent call last):
   File "/home/carlos.caballero/test/w2ptest/gluon/fileutils.py", line
 270, in create_welcome_w2p
 os.unlink('NEWINSTALL')
 FileNotFoundError: [Errno 2] No such file or directory: 'NEWINSTALL'
 

 El 23/04/18 a las 11:48, Richard Vézina escribió:

 In gluon/fileutil.py

 Richard

 On Mon, Apr 23, 2018 at 11:47 AM, Richard Vézina <
 ml.richard.vez...@gmail.com> wrote:

> The python3 welcome.w2p creation issue??
>
> I think it a dependency issue that might be obufuscated by _compat.py
>
> You can try to replace this line :
>
> w2p_pack('welcome.w2p', 'applications/welcome')
>
> By
>
> w2p_pack('welcome.w2p', 'applications', 'welcome')
>
> And report here if it help...
>
> Richard
>
> On Mon, Apr 23, 2018 at 11:42 AM, Carlos Cesar Caballero Díaz <
> carlos.caball...@cfg.jovenclub.cu> wrote:
>
>> I have the same issue, using the current master branch in Ubuntu.
>>
>> Greetings.
>>
>> El 21/04/18 a las 08:21, Richard Vézina escribió:
>>
>> Actually I can't reproduced... It could it be a permission error??
>>
>> Try to clone it fresh some where you have full access with this
>> command :
>>
>> git clone --recursive https://github.com/web2py/web2py.git
>>
>> Then
>>
>> cd web2py
>> python3 web2py.py
>>
>> Enter password
>>
>>
>> Richard
>>
>> On Sat, Apr 21, 2018 at 8:01 AM, Richard Vézina <
>> ml.richard.vez...@gmail.com> wrote:
>>
>>> Can you open an issue?
>>>
>>> I think it related to this : https://github.com/web2py/we
>>> b2py/blob/fb4c114d85494ad6d79d69539adaae103d76e5ce/gluon/fil
>>> eutils.py#L269
>>>
>>> Path string that has to be manipulated differently in python 3
>>>
>>> Explanation
>>>
>>> https://www.scivision.co/python-idiomatic-pathlib-use/
>>>
>>> On Fri, Apr 20, 2018 at 9:15 PM, lyn2py  wrote:
>>>
 I just git cloned the latest web2py and started it up with
 *python3*
 Version 2.16.1-stable+timestamp.2018.03.08.10.23.01
 Database drivers available: sqlite3, imaplib, pymysql, pyodbc

 I got this error in console
 ERROR:root:New installation error: unable to create welcome.w2p
 file

 When I quit the python server and restart with python2 or python3,
 the error does not come up anymore.




 On Tuesday, November 14, 2017 at 1:59:52 PM UTC+8, Massimo Di
 Pierro wrote:
>

[web2py] Re: create users manually

2018-04-24 Thread Anthony
You can use the auth.register_bare() method to loop through a set of user 
records, register each, and then send an email with the temporary password. 
I think you can also leave out the password altogether, in which case, 
users will have to go through the password reset process to create a 
password and log in.

Anthony

On Monday, April 23, 2018 at 8:12:33 AM UTC-4, Yebach wrote:
>
> Hello
>
> I would like to create or import users into auth_users table and then send 
> them e-mails with temp passwords that they could change to login into my 
> app.
> I know it is not the most secure way but so far this is the only solution.
>
> How could I achieve that? Or what would be the best way to do that?
>
> thank you
>

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


[web2py] HOW CAN I PRINT THIS

2018-04-24 Thread Ayron Rangel
Guys, 

How can i print this in HTML (CUSTOM) DAL :
def stock ():
   sum = db.input_inventory.input_price.sum()
   count = db.input_inventory.product.count()
   results = db(db.input_inventory).select(db.input_inventory.product, 
count, sum, groupby = db.product)
   return locals()

HMTL:
{{row in results:}}
  {{}}

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

2018-04-24 Thread Carlos Cesar Caballero Díaz

I think we should check if the file exists before try to delete it.

or move the unlik() function to a new "try-except" block, something like:

if welcome.w2p is correctly created:

    try:

    os.unlink('NEWINSTALL')

    except FileNotFoundError:

    nothing to do

    except:

    error removing 'NEWINSTALL' file


Greetings.


El 23/04/18 a las 13:33, Richard Vézina escribió:
Actually it already inside a try... And it only logging an error... 
Should this be an error or a warning?? I guess this is done for the 
appadmin to allow it to create new app as it base on welcome... The 
welcome template is provision at first web2py run once install and 
derived from the welcome app...


I guess it wouldn't be a good solution to track this NEWINSTALL file 
in the repo, as it could trigger some other issue... But at the same 
time, if you manage your web2py install with git, it might just make 
sens that whenever you update your local repo, that this file get 
recreated and the template being updated??


Richard

On Mon, Apr 23, 2018 at 1:28 PM, Richard Vézina 
> wrote:


I guess we could had a simple "try" there...

Richard

On Mon, Apr 23, 2018 at 1:26 PM, Richard Vézina
>
wrote:

Yeah this file is not there when we clone web2py... But I just
check and it's there when you download web2py build from
web2py.com...

What's weird is that I didn't have the issue...

Richard

On Mon, Apr 23, 2018 at 12:39 PM, Carlos Cesar Caballero Díaz
> wrote:

Ok, I have found the issue:


Traceback (most recent call last):
  File
"/home/carlos.caballero/test/w2ptest/gluon/fileutils.py",
line 270, in create_welcome_w2p
    os.unlink('NEWINSTALL')
FileNotFoundError: [Errno 2] No such file or directory:
'NEWINSTALL'


El 23/04/18 a las 11:48, Richard Vézina escribió:

In gluon/fileutil.py

Richard

On Mon, Apr 23, 2018 at 11:47 AM, Richard Vézina
> wrote:

The python3 welcome.w2p creation issue??

I think it a dependency issue that might be
obufuscated by _compat.py

You can try to replace this line :

w2p_pack('welcome.w2p', 'applications/welcome')

By

w2p_pack('welcome.w2p', 'applications', 'welcome')

And report here if it help...

Richard

On Mon, Apr 23, 2018 at 11:42 AM, Carlos Cesar
Caballero Díaz > wrote:

I have the same issue, using the current master
branch in Ubuntu.

Greetings.


El 21/04/18 a las 08:21, Richard Vézina escribió:

Actually I can't reproduced... It could it be a
permission error??

Try to clone it fresh some where you have full
access with this command :

git clone --recursive
https://github.com/web2py/web2py.git


Then

cd web2py
python3 web2py.py

Enter password


Richard

On Sat, Apr 21, 2018 at 8:01 AM, Richard Vézina
> wrote:

Can you open an issue?

I think it related to this :

https://github.com/web2py/web2py/blob/fb4c114d85494ad6d79d69539adaae103d76e5ce/gluon/fileutils.py#L269



Path string that has to be manipulated
differently in python 3

Explanation

https://www.scivision.co/python-idiomatic-pathlib-use/


On Fri, Apr 20, 2018 at 9:15 PM, lyn2py
>
wrote:

I just git 

[web2py] Re: json-rpc

2018-04-24 Thread 黄祥
trying to learn rpc
*controllers/default.py*
from gluon.tools import Service
service = Service()

def call():
return service()

@service.xmlrpc
@service.jsonrpc
@service.jsonrpc2
def add(a, b):
return a + b

*using curl*
curl -X GET -d '{"jsonrpc":"2.0","method":"add","params":["1","2"] }' -i 
http://127.0.0.1:8000/test/default/call/jsonrpc2

*result :*
HTTP/1.1 200 OK
X-Powered-By: web2py
Set-Cookie:  
session_id_test=127.0.0.1-e4f82a2b-19ab-4331-9744-711988008e68; httponly; 
Path=/
Expires: Tue, 24 Apr 2018 06:43:49 GMT
Pragma: no-cache
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, 
pre-check=0
Content-Type: application/json; charset=utf-8
Date: Tue, 24 Apr 2018 06:43:49 GMT
Server: Rocket 1.2.6 Python/2.7.10
Content-Length: 0
Connection: keep-alive

*using postman with get method*
http://127.0.0.1:8000/test/default/call/jsonrpc2

*result :*
{"jsonrpc": "2.0", "id": null, "error": {"message": "Parse error. Invalid 
JSON was received by the server.", "code": -32700, "data": "An error 
occurred on the server while parsing the JSON text."}}

*using postman** with get method*
http://127.0.0.1:8000/test/default/call/jsonrpc

*result :*
Traceback (most recent call last):
  File "/Users/MacBookPro/project/python/web2py/gluon/restricted.py", line 
219, in restricted
exec(ccode, environment)
  File 
"/Users/MacBookPro/project/python/web2py/applications/test/controllers/default.py",
 
line 73, in 
  File "/Users/MacBookPro/project/python/web2py/gluon/globals.py", line 
419, in 
self._caller = lambda f: f()
  File 
"/Users/MacBookPro/project/python/web2py/applications/test/controllers/default.py",
 
line 64, in call
return service()
  File "/Users/MacBookPro/project/python/web2py/gluon/tools.py", line 5483, 
in __call__
return self.serve_jsonrpc()
  File "/Users/MacBookPro/project/python/web2py/gluon/tools.py", line 5207, 
in serve_jsonrpc
data = json.loads(request.body.read())
  File 
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py",
 
line 338, in loads
return _default_decoder.decode(s)
  File 
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py",
 
line 366, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File 
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py",
 
line 384, in raw_decode
raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded

any idea?

*n.b.*
web2y latest version scaffolding welcome didn't declare service module in 
db.py

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