[web2py] Re: Not seeing logging.error messages in nginx error_log

2016-05-04 Thread Chris Guest
Hi DaveS,

So to clarify when I used mod_wsgi & apache I used to get logging.error 
messages saved into my apache error.log .
Now that I use uwsgi & nginx this doesn't happen.
I am not sure what your answer means as I am not familiar with what a 
logging.conf file is. I cannot find a logging.conf file in either 
/etc/uwsgi /etc/nginx or under my web2py instance.
I am not particularly trying to consolidate logs - I am not seeing these 
messages in any log. 

Thanks,
Chris

-- 
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: Not seeing logging.error messages in nginx error_log

2016-05-04 Thread Dave S


On Wednesday, May 4, 2016 at 6:09:58 PM UTC-7, Dave S wrote:
>
> On Wednesday, May 4, 2016 at 5:32:47 PM UTC-7, Chris Guest wrote:
>>
>> Not seeing logging.error in nginx error_log
>>
>>
>> I have a mostly successful install of web2py application with uwsgi and 
>> nginx on centos using setup-web2py-nginx-uwsgi-centos70.sh .
>>
>> But I can't figure out how to configure nginx, uwsgi and wsgihandler.py 
>> so that logging.error messages appear in the error_log file. 
>> I have been able to configure it so that nginx [notice] and [info] 
>> messages appear but these are generated by nginx itself and are not coming 
>> from logging.notice or logging.info calls in the web2py application. 
>>  
>> Can someone post a recipe as to how this is done?
>>
>> Thanks,
>> Chris
>>
>
>
> Doesn't this also involve configuring web2py's logging?  The default 
> logging.conf uses either the web2py directory or web2py/logs (depending on 
> version, IIRC), and writes the logging messages to a file therein.  
>


The part above is fine, the part below is a late-afternoon moment of 
misreading.

 

> Most logging messages, though, aren't really intended to be seen by users, 
> and some of them reveal internal details that shouldn't be seen by 
> [hostile] users.
>
> Even the ticket system is intended to just say "oops, we broke something. 
>  Tell our webmaster to check it out."
>
> HTML error codes are intended to be returned to the user (e.g., HTML 404).
>
>
Ooops, you didn't say "to the user", you were just trying to consolidate 
logs.

/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: Not seeing logging.error messages in nginx error_log

2016-05-04 Thread Dave S
On Wednesday, May 4, 2016 at 5:32:47 PM UTC-7, Chris Guest wrote:
>
> Not seeing logging.error in nginx error_log
>
>
> I have a mostly successful install of web2py application with uwsgi and 
> nginx on centos using setup-web2py-nginx-uwsgi-centos70.sh .
>
> But I can't figure out how to configure nginx, uwsgi and wsgihandler.py so 
> that logging.error messages appear in the error_log file. 
> I have been able to configure it so that nginx [notice] and [info] 
> messages appear but these are generated by nginx itself and are not coming 
> from logging.notice or logging.info calls in the web2py application. 
>  
> Can someone post a recipe as to how this is done?
>
> Thanks,
> Chris
>


Doesn't this also involve configuring web2py's logging?  The default 
logging.conf uses either the web2py directory or web2py/logs (depending on 
version, IIRC), and writes the logging messages to a file therein.  Most 
logging messages, though, aren't really intended to be seen by users, and 
some of them reveal internal details that shouldn't be seen by [hostile] 
users.

Even the ticket system is intended to just say "oops, we broke something. 
 Tell our webmaster to check it out."

HTML error codes are intended to be returned to the user (e.g., HTML 404).

/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] Not seeing logging.error messages in nginx error_log

2016-05-04 Thread Chris Guest
Not seeing logging.error in nginx error_log


I have a mostly successful install of web2py application with uwsgi and 
nginx on centos using setup-web2py-nginx-uwsgi-centos70.sh .

But I can't figure out how to configure nginx, uwsgi and wsgihandler.py so 
that logging.error messages appear in the error_log file. 
I have been able to configure it so that nginx [notice] and [info] messages 
appear but these are generated by nginx itself and are not coming from 
logging.notice or logging.info calls in the web2py application. 
 
Can someone post a recipe as to how this is done?

Thanks,
Chris

-- 
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 2.14.4 is OUT

2016-05-04 Thread Derek
PYTDS is now DBAPI 2.0 compliant, which means you can now use it with 
Web2py. It's fully python not dependent on any installed libraries, for 
your MSSQL needs. That means you can use this in pypy or ironpython as 
well... 

On Tuesday, April 12, 2016 at 2:29:26 PM UTC-7, Massimo Di Pierro wrote:
>
> web2py 2.14.4 is out.
>
> It fixes some a problem with CAS and some style issues with examples.
> It also includes (and passes) a lot of new tests. 
>
> Thanks to Richard Vezina, Simone and Leonel for doing most of the work in 
> this release.
>
> 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.


[web2py] Re: View SQL generated by SQLFORM.grid

2016-05-04 Thread Jim S
I did what you suggested and I get this statement:

SELECT workorder.workorderId, workorder.parent_workorder, workorder.siteId, 
workorder.created, workorder.needed, workorder.productId, 
workorder.productName, workorder.productSiteId, workorder.pullFromStock, 
workorder.bomId, workorder.quantity, workorder.uom, 
workorder.mixerId, workorder.approvedById, workorder.actualQuantity, 
workorder.completed, workorder.hasMolasses, workorder.brixLevel, 
workorder.hasUrea, workorder.ureaConcentration, workorder.rfLevel, 
workorder.phLevel, workorder.tankNumber, workorder.sent, 
workorder.allowToFinalize, workorder.temperature, workorder.transaction_date, 
workorder.scale_weight 
FROM workorder 
WHERE (workorder.workorderId = 47291) LIMIT 1 OFFSET 0;


about 43 times.


And about an equal number of select statements on auth_membership and 
auth_permission


But, nowhere do I see the SQL Statement that should be driving my SQLFORM.grid 
SELECT statement.  I know it should include my 'product' table (I have it 
specified on the 'left' argument).  But, searching the page, there are no 
references to it.


Any way to get it from the grid object returned from SQLFORM.grid?


-Jim


On Wednesday, May 4, 2016 at 3:23:52 PM UTC-5, Niphlod wrote:
>
> response.toolbar() shows db statistics, I guess is the fastest method out 
> there.
>
> On Wednesday, May 4, 2016 at 9:32:10 PM UTC+2, Jim S wrote:
>>
>> I pass a query to SQLFORM.grid.  Is there a way to see the SQL that last 
>> executed on behalf of the grid?  I'm trying to tune my db for the SQL 
>> statement used to show the list of records.
>>
>> -Jim
>>
>>

-- 
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] Strange trouble with password_reset

2016-05-04 Thread Kirill Shatalaev
Hello, I'm using web2py 2.14.5-stable+timestamp.2016.04.14.03.26.16

mail = logging for testing purposes.

So, controller:

def user():
return dict(form=auth())


Registering new user goes as it must. Email verification (this is console 
output):


2016-05-05 01:21:14,601 - web2py - WARNING - email not sent

From: nore...@example.com
To: h...@bb.com
Subject: Email verification

Click on the link 
http://127.0.0.1:8000/myblog/default/user/verify_email/17b4d0ed-4af0-4c28-ae77-e6d9b14e109b
 to verify your email



Click this link, so user successfully registered and can login.

But when I try to retrieve_password this is result email:

2016-05-05 01:24:46,313 - web2py - WARNING - email not sent

From: nore...@example.com
To: h...@bb.com
Subject: 

None


So its subject and body is absolutely empty. The reset password key is 
created for user  h...@bb.com and I can see it on my database.

What can I do to fix it?

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


[web2py] Re: User group names based on username instead of id

2016-05-04 Thread Antonio Salazar
I actually read that section two days ago, when the requirements were still 
being defined. I don't know why I forgot it.

Probably the ominous warning *"The creation of the group can be disabled 
[...] although we do not suggest doing so."* got me thinking why and the 
rest slipped my mind.
Later I found it wasn't so ominous after all: 
https://groups.google.com/forum/#!msg/web2py/C5BHvXMyq7s/YZ6Gdx78mesJ

On Wednesday, May 4, 2016 at 3:24:50 PM UTC-5, Niphlod wrote:
>
> http://web2py.com/books/default/chapter/29/09/access-control#Authorization
>
> On Wednesday, May 4, 2016 at 9:59:13 PM UTC+2, Antonio Salazar wrote:
>>
>> Thank you!
>>
>> For some reason I was thinking of this setting as a boolean, and figuring 
>> how to use a callback to rename the group :/
>>
>> P.S. for completeness.
>>
>> In db.py I changed this:
>> auth.settings.create_user_groups = None
>>
>> to this
>> auth.settings.create_user_groups = 'user_%(username)s'
>>
>>
>>
>>
>> On Wednesday, May 4, 2016 at 2:01:16 PM UTC-5, Niphlod wrote:
>>>
>>> from the source it seems that the setting
>>>
>>> create_user_groups 
>>>
>>> which has a default of 
>>>
>>> "user_%(id)s"
>>>
>>> can be used. in your case it seems that setting it to user_%(username)s 
>>> should do the trick.
>>>
>>> On Wednesday, May 4, 2016 at 8:48:49 PM UTC+2, Antonio Salazar wrote:

 I've disabled user group creation, but now I need user-specific 
 permissions, so I'm going to re-enable it and create the missing user 
 groups. I'd really like the groups to be user_[username] instead of 
 user_[user_id].
 Is there an upgrade-friendly way to base the group name on something 
 other than the user id?

 I know it's best practice to use the id because it's unique, but in my 
 case, the username is also unique and invariable. I'd bear the slight risk 
 of inconsistency in exchange for human-readable group names.

>>>

-- 
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: User group names based on username instead of id

2016-05-04 Thread Niphlod
http://web2py.com/books/default/chapter/29/09/access-control#Authorization

On Wednesday, May 4, 2016 at 9:59:13 PM UTC+2, Antonio Salazar wrote:
>
> Thank you!
>
> For some reason I was thinking of this setting as a boolean, and figuring 
> how to use a callback to rename the group :/
>
> P.S. for completeness.
>
> In db.py I changed this:
> auth.settings.create_user_groups = None
>
> to this
> auth.settings.create_user_groups = 'user_%(username)s'
>
>
>
>
> On Wednesday, May 4, 2016 at 2:01:16 PM UTC-5, Niphlod wrote:
>>
>> from the source it seems that the setting
>>
>> create_user_groups 
>>
>> which has a default of 
>>
>> "user_%(id)s"
>>
>> can be used. in your case it seems that setting it to user_%(username)s 
>> should do the trick.
>>
>> On Wednesday, May 4, 2016 at 8:48:49 PM UTC+2, Antonio Salazar wrote:
>>>
>>> I've disabled user group creation, but now I need user-specific 
>>> permissions, so I'm going to re-enable it and create the missing user 
>>> groups. I'd really like the groups to be user_[username] instead of 
>>> user_[user_id].
>>> Is there an upgrade-friendly way to base the group name on something 
>>> other than the user id?
>>>
>>> I know it's best practice to use the id because it's unique, but in my 
>>> case, the username is also unique and invariable. I'd bear the slight risk 
>>> of inconsistency in exchange for human-readable group names.
>>>
>>

-- 
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: View SQL generated by SQLFORM.grid

2016-05-04 Thread Niphlod
response.toolbar() shows db statistics, I guess is the fastest method out 
there.

On Wednesday, May 4, 2016 at 9:32:10 PM UTC+2, Jim S wrote:
>
> I pass a query to SQLFORM.grid.  Is there a way to see the SQL that last 
> executed on behalf of the grid?  I'm trying to tune my db for the SQL 
> statement used to show the list of records.
>
> -Jim
>
>

-- 
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: User group names based on username instead of id

2016-05-04 Thread Antonio Salazar
Thank you!

For some reason I was thinking of this setting as a boolean, and figuring 
how to use a callback to rename the group :/

On Wednesday, May 4, 2016 at 2:01:16 PM UTC-5, Niphlod wrote:
>
> from the source it seems that the setting
>
> create_user_groups 
>
> which has a default of 
>
> "user_%(id)s"
>
> can be used. in your case it seems that setting it to user_%(username)s 
> should do the trick.
>
> On Wednesday, May 4, 2016 at 8:48:49 PM UTC+2, Antonio Salazar wrote:
>>
>> I've disabled user group creation, but now I need user-specific 
>> permissions, so I'm going to re-enable it and create the missing user 
>> groups. I'd really like the groups to be user_[username] instead of 
>> user_[user_id].
>> Is there an upgrade-friendly way to base the group name on something 
>> other than the user id?
>>
>> I know it's best practice to use the id because it's unique, but in my 
>> case, the username is also unique and invariable. I'd bear the slight risk 
>> of inconsistency in exchange for human-readable group names.
>>
>

-- 
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] View SQL generated by SQLFORM.grid

2016-05-04 Thread Jim S
I pass a query to SQLFORM.grid.  Is there a way to see the SQL that last 
executed on behalf of the grid?  I'm trying to tune my db for the SQL 
statement used to show the list of records.

-Jim

-- 
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: User group names based on username instead of id

2016-05-04 Thread Niphlod
from the source it seems that the setting

create_user_groups 

which has a default of 

"user_%(id)s"

can be used. in your case it seems that setting it to user_%(username)s 
should do the trick.

On Wednesday, May 4, 2016 at 8:48:49 PM UTC+2, Antonio Salazar wrote:
>
> I've disabled user group creation, but now I need user-specific 
> permissions, so I'm going to re-enable it and create the missing user 
> groups. I'd really like the groups to be user_[username] instead of 
> user_[user_id].
> Is there an upgrade-friendly way to base the group name on something other 
> than the user id?
>
> I know it's best practice to use the id because it's unique, but in my 
> case, the username is also unique and invariable. I'd bear the slight risk 
> of inconsistency in exchange for human-readable group names.
>

-- 
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] User group names based on username instead of id

2016-05-04 Thread Antonio Salazar
I've disabled user group creation, but now I need user-specific 
permissions, so I'm going to re-enable it and create the missing user 
groups. I'd really like the groups to be user_[username] instead of 
user_[user_id].
Is there an upgrade-friendly way to base the group name on something other 
than the user id?

I know it's best practice to use the id because it's unique, but in my 
case, the username is also unique and invariable. I'd bear the slight risk 
of inconsistency in exchange for human-readable group names.

-- 
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: Enabling Unicode characters in URL

2016-05-04 Thread Leonel Câmara
For functions, specially since in python 2 the identifiers must be ascii. 
If percent encoded args don't work then that's actually a bug/missing 
feature of web2py which doesn't unquote args. Please file an issue in 
github so the devs get properly motivated to close it. In the meantime you 
will have to use request.vars to put stuff.

-- 
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: login by ajax

2016-05-04 Thread Val K
Hi!
It seems, that  ajax_login isn't exist yet?

if not user:
self.log_event(self.messages['login_failed_log'],
   request.post_vars)
# invalid login
session.flash = self.messages.invalid_login
callback(onfail, None)
redirect(
self.url(args=request.args, 
vars=request.get_vars),
client_side=settings.client_side)




On Saturday, March 2, 2013 at 5:46:53 PM UTC+3, Phyo Arkar wrote:
>
> If you worry about your credentials visibility over the wire , SSL.
> If you worry about your credentials visibility on the screen , None 
> actually.
>
> On Sat, Mar 2, 2013 at 5:54 AM, Alan Etkin  > wrote:
>
>> +1 for auth,ajax_login()
>>
>>
>> I'm also interested in a bare ajax login feature, but, what about the 
>> security risks of passing credentials with javascript in the background? 
>> What are the issues to take in account for that feature? I there any 
>> standard way of securing the passwords and other sensible data that can be 
>> used?
>>
>> -- 
>>  
>> --- 
>> 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] Re: Enabling Unicode characters in URL

2016-05-04 Thread Kenneth
Hi Niphld,

Do I need to configure "routes.py" to accept percent-encoded function? is 
it "args_match" that I need to configure?

Just tried to pass encoded string "%ED%95%9C%EA%B8%80" as argument, I am 
getting "Invalid request".

Thank you.


On Wednesday, May 4, 2016 at 8:09:22 AM UTC-4, Niphlod wrote:
>
> BTW: you NEED to get your hands dirty with routes.py because a 
> percent-encoded fragment won't ever be mapped to a function or a controller.
>
> On Wednesday, May 4, 2016 at 1:55:53 PM UTC+2, Leonel Câmara wrote:
>>
>> I don't think that's possible, they need to come pre-encoded, don't worry 
>> the browser will show the unicode characters in the adress bar and not 
>> those ugly percents.
>>
>

-- 
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: db is not defined in other model files

2016-05-04 Thread Anthony
Does it work locally?

On Wednesday, May 4, 2016 at 11:56:07 AM UTC-4, Vic Ding wrote:
>
> Hi all,
>
> I have a weird problem with web2py on apache. I created db1.py and created 
> defined tables in it and it works fine. I created another model, name is 
> my_list.py and it does not work. Error is db is not defined in my_list.py. 
> Any idea what the problem might be?
> 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] db is not defined in other model files

2016-05-04 Thread Vic Ding
Hi all,

I have a weird problem with web2py on apache. I created db1.py and created 
defined tables in it and it works fine. I created another model, name is 
my_list.py and it does not work. Error is db is not defined in my_list.py. 
Any idea what the problem might be?
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] create file outside of web2py using IDE

2016-05-04 Thread Vic Ding
Hi all,

I am using Pycharm together with web2py. I created a model file 
models/db1.py in IDE and sync it back to the server through SSH. The file 
is pickup by the server (I can see it in the web IDE) however, I get a 
complain when visiting the site
name 'db' is not defined
How can I deal with this situation?

Thanks!

Cheers,
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: How to get rows in right format

2016-05-04 Thread Anthony
I'm not sure there is a "standard" way, but if you want to use the DAL API 
to generate the query, then you'll have to manipulate the data using Python 
after retrieving the results.

Alternatively, you could generate the SQL code manually and use 
group_concat (if using MySQL or SQLite -- there are similar alternatives 
for Postgres and others) to get the database to return the results in the 
format you want. Once you have the SQL code, you can use db.executesql() to 
run the query.

Anthony

On Wednesday, May 4, 2016 at 4:01:49 AM UTC-4, Marko Seppälä wrote:
>
> I need to do very complex queries. Actually so complex that I don't even 
> know how to do it properly, even though I managed to get it work without 
> list reference. I discussed with one expert yesterday and he recommended 
> not to use list reference in my case.
>
> So currently I'm wondering what is the efficient way to reorganize my data 
> to right format. Following example from web2py book's is usually part of my 
> queries:
>
> >>> persons_and_things = db((db.person.id == db.ownership.person) &
> (db.thing.id == db.ownership.thing))
>
> >>> for row in persons_and_things.select():
> print row.person.name, row.thing.name
> Alex BoatAlex ChairBob ShoesCurt Boat
>
> Is there any "standard" way to get the results in the following format, 
> even though you're not using list reference? That format is more natural to 
> handle in controllers and views, so I need to reorganize the data somehow.
>
> Alex Boat, ChairBob ShoesCurt Boat
>
>
> Should be probably some kind of dictionary containing keys person and 
> things, and then things is list of individual things.
>
>
> maanantai 2. toukokuuta 2016 20.11.33 UTC+3 Anthony kirjoitti:
>>
>> On Sunday, May 1, 2016 at 3:17:49 PM UTC-4, Marko Seppälä wrote:
>>>
>>> It works, thanks! I forgot the whole thing. When I started with web2py, 
>>> one expert recommended me not to use list references but do all 
>>> intermediary tables yourself.
>>>
>>> Is there any drawbacks to use list reference instead of doing those 
>>> intermediary tables yourself?
>>>
>>
>> It depends on how you will need to query the data. If you typically just 
>> need to list the property IDs for individual "things", then list:reference 
>> might be a reasonable approach. However, if you need to do more complex 
>> queries involving attributes of things and their properties, then your 
>> original approach will allow more flexibility.
>>
>> 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] Re: Flash messages not showing correctly

2016-05-04 Thread Krzysztof Socha
Thanks... It is just this 'tweaking' that I am worried about... It is not
always easy to test every functionality of the page to make sure that I
have done all the tweaking necessary...

Thanks anyway.
Krzysztof.

On Tue, May 3, 2016 at 5:58 PM, Anthony  wrote:

> For the most part, you would replace the files in the scaffolding app that
> are not customizable (i.e., web2py.js, web2py_ajax.html, appadmin.py,
> appadmin.html, the generic views, etc.). In some cases, you may also need
> to tweak layout.html, but that depends on how much of its original
> functionality you retained.
>
> Anthony
>
>
> On Tuesday, May 3, 2016 at 11:47:26 AM UTC-4, Krzysztof Socha wrote:
>>
>> Worked! Thanks!
>>
>> BTW: I keep running into issues when updating old web2py applications to
>> new releases of web2py... Is there a recommended way of doing it? It is not
>> very clear which files in my application folder should be
>> changed/replaced/updated/edited when updating web2py.
>>
>> Krzysztof.
>>
>> On Tuesday, May 3, 2016 at 5:31:52 PM UTC+2, Anthony wrote:
>>>
>>> In layout.html, have you tried changing the class of the flash div from
>>> "flash" to "w2p_flash"?
>>>
>>> Anthony
>>>
>>> On Tuesday, May 3, 2016 at 11:22:07 AM UTC-4, Krzysztof Socha wrote:

 I have issues with showing "flash"-type messages recently. First I
 could not get them to show at all. I updated several files in my
 application based on the recent version of web2py (R-2.14.5), such as
 web2py.js, web2py-ajax.html, and the like.

 Now it shows the flash message, but the formatting is all wrong. It
 just shows it on top of the page. Some digging revealed that the flash
 messages are put in a DIV with class="flash", while web2py.js is expecting
 class="w2p_flash". Anyone has an idea why it is like that and what to do to
 fix it?

 Krzysztof.

>>> --
> 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/QaCC_IaBZ5A/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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


[web2py] Re: Enabling Unicode characters in URL

2016-05-04 Thread Niphlod
BTW: you NEED to get your hands dirty with routes.py because a 
percent-encoded fragment won't ever be mapped to a function or a controller.

On Wednesday, May 4, 2016 at 1:55:53 PM UTC+2, Leonel Câmara wrote:
>
> I don't think that's possible, they need to come pre-encoded, don't worry 
> the browser will show the unicode characters in the adress bar and not 
> those ugly percents.
>

-- 
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: Enabling Unicode characters in URL

2016-05-04 Thread Leonel Câmara
I don't think that's possible, they need to come pre-encoded, don't worry 
the browser will show the unicode characters in the adress bar and not 
those ugly percents.

-- 
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 add response headers to cache file?

2016-05-04 Thread Antonio
import os
cache.disk.folder = os.path.join('/home/minondoa/', 
'Appz/web2py/applications/Prueba/')
@cache.action(time_expire=21600, cache_model=cache.disk)
def index():
#response.headers['Content-Type'] = None
response.headers['Access-Control-Allow-Origin'] = 
request.env.http_origin
response.headers['Access-Control-Allow-Origin'] = "*"
response["Access-Control-Allow-Methods"] = "POST, GET, OPTIONS"

El martes, 3 de mayo de 2016, 18:20:13 (UTC+2), Niphlod escribió:
>
> how are you serving the "cachefiles" ? web2py caches - at most - the 
> rendered view, not the headers 
>
> On Tuesday, May 3, 2016 at 4:30:46 PM UTC+2, Antonio wrote:
>>
>> Hello again, 
>> I'm not really sure that I fomulated correctly the question, so sorry for 
>> that.
>> I'm using web2py to get some data with which to create a dictionary that 
>> I'll later use on a mobile app. The thing is that it takes a while to get 
>> all the information (which will stay the same for long periods of time) so 
>> I decided to create an application cache on disk.
>>
>> Before adding the cache everything worked fine. I just had to add 
>> response.headers['Access-Control-Allow-Origin'] = 
>> request.env.http_origin
>> response.headers['Access-Control-Allow-Origin'] = "*"
>> response["Access-Control-Allow-Methods"] = "POST, GET, OPTIONS"
>>
>> The problem is that once I added the cache, the first time I load the app 
>> it worked fine, but the second and the following times I get this error:
>> XMLHttpRequest cannot load 
>> http://127.0.0.1:8000/Prueba/gfs/index.json?latitude=43.4879176&longitude=-3.80055544.
>>  
>> No 'Access-Control-Allow-Origin' header is present on the requested 
>> resource. Origin 'http://localhost:8200 ' is 
>> therefore not allowed access. 
>>
>>
>> Is there a way to add headers to the response when getting the 
>> information from the cache files?
>> Thanks in advance.
>>
>

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


[web2py] Re: How to get rows in right format

2016-05-04 Thread Marko Seppälä
I need to do very complex queries. Actually so complex that I don't even 
know how to do it properly, even though I managed to get it work without 
list reference. I discussed with one expert yesterday and he recommended 
not to use list reference in my case.

So currently I'm wondering what is the efficient way to reorganize my data 
to right format. Following example from web2py book's is usually part of my 
queries:

>>> persons_and_things = db((db.person.id == db.ownership.person) &
(db.thing.id == db.ownership.thing))

>>> for row in persons_and_things.select():
print row.person.name, row.thing.name
Alex BoatAlex ChairBob ShoesCurt Boat

Is there any "standard" way to get the results in the following format, 
even though you're not using list reference? That format is more natural to 
handle in controllers and views, so I need to reorganize the data somehow.

Alex Boat, ChairBob ShoesCurt Boat


Should be probably some kind of dictionary containing keys person and 
things, and then things is list of individual things.


maanantai 2. toukokuuta 2016 20.11.33 UTC+3 Anthony kirjoitti:
>
> On Sunday, May 1, 2016 at 3:17:49 PM UTC-4, Marko Seppälä wrote:
>>
>> It works, thanks! I forgot the whole thing. When I started with web2py, 
>> one expert recommended me not to use list references but do all 
>> intermediary tables yourself.
>>
>> Is there any drawbacks to use list reference instead of doing those 
>> intermediary tables yourself?
>>
>
> It depends on how you will need to query the data. If you typically just 
> need to list the property IDs for individual "things", then list:reference 
> might be a reasonable approach. However, if you need to do more complex 
> queries involving attributes of things and their properties, then your 
> original approach will allow more flexibility.
>
> 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.