Re: [web2py] Re: How to intercept download request

2014-05-23 Thread Mandar Vaze / मंदार वझे
Derek,

On Fri, May 23, 2014 at 1:29 AM, Derek sp1d...@gmail.com wrote:

 no, i don't see how you could. web2py leaves it up to the webserver to
 send the file. you'd need to modify the webserver, but since the webserver
 is handed off the path of the file then you have no way of raising an
 error, unless you want transfers to block the web2py process...


Not possible is acceptable answer (to me).
The explanation helps answer why not

Thanks !!

-Mandar




 On Thursday, May 22, 2014 10:46:00 AM UTC-7, Mandar Vaze wrote:

 Sorry for the delayed response.


 On Wed, May 14, 2014 at 12:14 PM, Niphlod nip...@gmail.com wrote:

 let's ask another question then. Can you post a link generated by your
 app that downloads something ? just the part after the domain is enough.


 This question definitely helped.
 Turns out download is request.args(0) (just like new edit etc.)
 I am now able to intercept the download request.

 Next Question :
 So checking request.args(0) only tells me that someone attempted the
 download.
 Is there a way to find out if they cancelled or actually completed the
 downloaded ?

 -Mandar

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


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


Re: [web2py] how string_agg for groupby?

2014-05-23 Thread Joe Barnhart
It's super-easy Richard.  You can provide a list of Field objects or a list 
of colnames in table.field format and it will return a Rows object for 
you.  It's almost too easy!

rows=db.executesql(select id,code,name from lsc,
colnames=['lsc.id','lsc.code','lsc.name'])


-- Joe

On Tuesday, May 20, 2014 7:26:24 AM UTC-7, Richard wrote:

 Yes you are right... I just puch as far as I can for this one to touch the 
 limit... Though the reason was to make use of Row and dot notation to 
 access data because I manipulate them a lot and using slicing would make my 
 code much less redable.

 I think there is a way to initialise Row on db.executesql, I will have 
 read about that.

 Thanks

 Richard


 On Fri, May 16, 2014 at 9:42 PM, Joe Barnhart 
 joe.ba...@gmail.comjavascript:
  wrote:

 Hi Richard --

 When using special DB features, sometimes it's best just to fall back to 
 the old executesql function.  It works really well for those complex 
 joins and special functions that are just too seldom-used to be 
 special-cased in the DAL.

 In fact, when I was forced to use it not long ago, I was amazed at how 
 simple and direct it was.  It really made a messy query into a clean one.

 -- Joe


 On Wednesday, May 14, 2014 7:46:20 AM UTC-7, Richard wrote:

 Hello,

 Is there a way to do string_agg() with in web2py for a query that have 
 groupby clause?

 Richard

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




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


Re: [web2py] Re: How to intercept download request

2014-05-23 Thread Niphlod
because there's not native event on a completed download nor a callback 
to use in ANY browser. 
Simply put, there aren't tools in the HTML word to report back a finished 
download.

On Friday, May 23, 2014 8:33:32 AM UTC+2, Mandar Vaze wrote:

 Derek,

 On Fri, May 23, 2014 at 1:29 AM, Derek sp1...@gmail.com javascript:wrote:

 no, i don't see how you could. web2py leaves it up to the webserver to 
 send the file. you'd need to modify the webserver, but since the webserver 
 is handed off the path of the file then you have no way of raising an 
 error, unless you want transfers to block the web2py process...


 Not possible is acceptable answer (to me).
 The explanation helps answer why not

 Thanks !!

 -Mandar

  


 On Thursday, May 22, 2014 10:46:00 AM UTC-7, Mandar Vaze wrote:

 Sorry for the delayed response.


 On Wed, May 14, 2014 at 12:14 PM, Niphlod nip...@gmail.com wrote:

 let's ask another question then. Can you post a link generated by your 
 app that downloads something ? just the part after the domain is enough.


 This question definitely helped.
 Turns out download is request.args(0) (just like new edit etc.)
 I am now able to intercept the download request.

 Next Question :
 So checking request.args(0) only tells me that someone attempted the 
 download.
 Is there a way to find out if they cancelled or actually completed the 
 downloaded ?

 -Mandar

  -- 
 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/nWDCgA10REY/unsubscribe.
 To unsubscribe from this group and all its topics, send an email to 
 web2py+un...@googlegroups.com javascript:.
 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] URL() and HTTPS

2014-05-23 Thread Niphlod
Again.. it's not over and over.. it happens the only first 
request that comes in pointing to anything http(ish). Second, third, etc 
will point to https already.

On Thursday, May 22, 2014 3:08:01 PM UTC+2, Richard wrote:

 Yeah you are right, I forget about relative URL, since I was trying to 
 create a link for an email sent by the app...

 Thanks for clarifying.

 60 ms over and over could have been a great improvement overall if there 
 was no relative url though.

 :)

 Richard


 On Wed, May 21, 2014 at 4:35 PM, Niphlod nip...@gmail.com 
 javascript:wrote:

 URL() generates relative links by default. No http or https...plain 
 /app/controller/function links.
 that being said, URL has scheme and host parameters that can generate 
 absolute links.

 Back to the performance side. Usually the redirection from http to 
 https is required at the very first access to the website, and is handled 
 directly by the webserver that is usually in front of web2py. 
 It takes generally 40 to 60 ms. 
 If your app uses relative links always, once you get to the https main 
 page, all links will point to https, without you worrying to pass host and 
 scheme all the time (that can surely hurt your page weight on average, in 
 addition to your tipings skills.) 
 Just to put things in perspective, this means that you're worrying over 
 60 ms in the whole user experience of your app (even in a supersimple 
 website, users should stay there at least a minute in the app ?!?). 

 You'd better waste sleep hours on something else :-P 

 BTW: it's all here 
 http://web2py.com/books/default/chapter/29/04/the-core#URL


 On Wednesday, May 21, 2014 9:53:07 PM UTC+2, Richard wrote:

 Hello,

 I am searching a way to make URL() return an address with HTTPS 
 instead of plain HTTP. I didn't find a way to do that...

 There is :

 request.is_https
 request.requires_https()

 But they seem to be for preventing access to plain HTTP.

 So, that mean that URL() always redirect to HTTP and never to HTTPS... 
 That may reduce performance, I had read long time ago that reducing 
 redirection is rule number 1 for improving loading speed...

 Maybe it could be a good idea to add a flag that let generate URL() with 
 HTTPS instead of only HTTP??

 Richard

  -- 
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 --- 
 You received this message because you are subscribed to the Google Groups 
 web2py-users group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to web2py+un...@googlegroups.com javascript:.
 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: Confusion: Web2py scheduler spawning a new child process for every task?

2014-05-23 Thread Niphlod


On Wednesday, May 21, 2014 11:09:02 PM UTC+2, Apoorve Mohan wrote:

 Hello All

 I am running my web2py app over apache. At backend I start a a web2py 
 scheduler using *python web2py.py -K my-app*. When I do a *ps -ef* 
 on my console, before adding any task to the queue, I see a single process 
 being created for the scheduler. When I add task to the queue and as soon 
 as they get picked up by the schduler I see a child process being created 
 for each task that is being executed when I do *ps -ef* again on my 
 console (andd offcourse a new task is not picked until the previous gets 
 completed). 

 I would like to know that is this the correct behaviour of the scheduler 
 .i.e. should it spawn child processes for each new task or am I doing 
 something wrong?


it's the correct behaviour
 


 Also, I would like to know is it possible to stop the spawing of child 
 processes i.e. can't just the parent process work like an infinite loop and 
 processing the queue itself rather than spawning a child process for each 
 task? Can I make it spawn a thread for each task instead?


no, you can't. The underlying problem is that a thread in python can't be 
killed, only processes. 
 

-- 
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 improve performance for db queries

2014-05-23 Thread Sarbjit
HI Anthony,

Changes suggested by you in the controller to reduce the complexity of the 
function actually worked, now the drop down options are changed instantly.

However, I am observing one strange problem now. Somehow the getResults() 
function is not called when the drop down options are changed from within 
the GRID view/edit pages.

So, basically in my form, I am displaying the results as GRID. Once, I get 
the results from grid based on the options selected in drop-downs, If I 
open any record from grid using VIEW/EDIT option from GRID, second drop 
down is never populated. Infact I noticed that this function is not called 
if I am inside the view/edit option. 

Do you have any idea on what could be the problem.

-Sarbjit

-- 
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] Record representation : multiple levels of references

2014-05-23 Thread Louis Amon
Say I have a table like this:

db.define_table('person', Field('first_name'), Field('last_name'), 
format='%(first_name)s %(last_name)s'

Now if I build a new table:

db.define_table('key', Field('person_id', 'reference person', 
requires=IS_IN_DB(db, db.person, label=db.person._format)))

My new table 'key' will represent its references using 'person' table's 
format.


But what if I have another table like this:

db.define_table('other_table', Field('key_id', 'reference key', 
requires=IS_IN_DB(db, db.key, label='%(first_name)s %(last_name)s 
(%(key_id)s)'???)))


How do I define the label in 'other_table' so that it shows the 'person' 
that this key is actually referring to ?


-- 
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 modal with an if condition

2014-05-23 Thread LoveWeb2py
Is this possible? I basically want to try and write a function that says 

if the result == 3:
popup a modal box

I followed this example:
http://getbootstrap.com/2.3.2/javascript.html#modals

But I just can't figure out how to make the modal pop up in the same 
window. I am thinking it will be something along the lines of AJAX or using 
LOAD?

-- 
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: multiple forms created by for in:

2014-05-23 Thread Lucas Schreiber
Alright, now i understand. Thats a pretty good structur, thank you very 
much :)

Am Donnerstag, 22. Mai 2014 13:12:19 UTC+2 schrieb Lucas Schreiber:

 Hey,
 i'm sorry, i need help again :)
 i have a db table, and i want to create a üage where for every row is a 
 form. my idea looks like this:

 row_db = dba(dba.user.user_id == user_id).select(dba.user.ALL)
 for row in row_db:
 form=FORM('Your name:',
SELECT(),
INPUT(_type='submit', _value = 'HERE'))
 if form.process(formname='form_one').accepted:

 but it does not work since every time the form variable gets replaced. Has 
 anyone an idea? maybe it is possible to create something like this?
 form_'a'=FORM('Your name:',...
 and 'a' changes with every loop? but i don't think it'll work like that.
 Does anyone has an idea?


-- 
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 Hosting

2014-05-23 Thread António Ramos
my ping rtt to webfaction account is 60ms
my ping rtt to digitalOcean account is 85ms


2014-05-22 18:27 GMT+01:00 Adnan Smajlovic adnan.smajlo...@gmail.com:

 I switched to Digital Ocean based Anthony's previous suggestion, and have
 only words of praise (price/speed/support)!!! Got nginx+ubuntu and just
 needed to run the web2py installation script to set everything up. That was
 it, and all worked perfect.



 On Thu, May 22, 2014 at 1:17 PM, Annet anneve...@googlemail.com wrote:

 Hi,

 I also have an account at Webfaction, you instal  web2py in 5 steps:

 1.Go to: https://wiki.webfaction.com/wiki/InstallScripts
 2.Scroll to web2py (Latest stable source), click the Install link. The
 create a new application form appears.
 3.In the Name field, enter a name for the application (w2p).
 4.In the Extra info field enter a password for web2py’s administrative
 interface
 5.Click the Add application button.

 In the control panel you can add a domain without the www


 Kind regards,

 Annet

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


-- 
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 Hosting

2014-05-23 Thread Philip Kilner
Hi,

On 23/05/14 11:07, António Ramos wrote:
 my ping rtt to webfaction account is 60ms
 my ping rtt to digitalOcean account is 85ms
 

Not sure of the significance of that if we don't know where you're
pinging /from/?

We use Linode for the big stuff and DO for the small stuff, FWIW. I have
nothing but praise for Linode. DO are pretty good, but nowhere near as
polished as Linode, and do not (yet) inspire the confidence that Linode
does.

Two issues with DO that are worth mentioning: -

- No IPv6
This is just slack! It's gone into private beta very recently, I
understand - what I don't understand is why it was not there from day one!

- No swapfile
Can be a gotcha depending on your needs, but easily remedied [1].


[1]
https://www.digitalocean.com/community/articles/how-to-add-swap-on-ubuntu-12-04


-- 

Regards,

PhilK


'a bell is a cup...until it is struck'

-- 
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 Hosting

2014-05-23 Thread António Ramos
where do i find a promo code for linode?




2014-05-23 11:19 GMT+01:00 Philip Kilner phil.kil...@gmail.com:

 Hi,

 On 23/05/14 11:07, António Ramos wrote:
  my ping rtt to webfaction account is 60ms
  my ping rtt to digitalOcean account is 85ms
 

 Not sure of the significance of that if we don't know where you're
 pinging /from/?

 We use Linode for the big stuff and DO for the small stuff, FWIW. I have
 nothing but praise for Linode. DO are pretty good, but nowhere near as
 polished as Linode, and do not (yet) inspire the confidence that Linode
 does.

 Two issues with DO that are worth mentioning: -

 - No IPv6
 This is just slack! It's gone into private beta very recently, I
 understand - what I don't understand is why it was not there from day one!

 - No swapfile
 Can be a gotcha depending on your needs, but easily remedied [1].


 [1]

 https://www.digitalocean.com/community/articles/how-to-add-swap-on-ubuntu-12-04


 --

 Regards,

 PhilK


 'a bell is a cup...until it is struck'

 --
 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] multiple models in a plugin component

2014-05-23 Thread Louis Amon
I am trying to build a big 'plugin component', with a plugin manager and 
therefore using the full naming conventions specified in the doc.

My model is starting to be huge (1000+ lines) and I'm trying to split it 
into multiple files.


Is there a way to name these files so that web2py still understands that 
they're part of my plugin ?

-- 
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 Hosting

2014-05-23 Thread Anthony
And when you hit the $20+ level, Linode is now price competitive with 
Digital Ocean (but DO also offers $5 and $10 plans, whereas the cheapest 
Linode is $20).

Anthony

On Friday, May 23, 2014 6:19:27 AM UTC-4, Philip Kilner wrote:

 Hi, 

 On 23/05/14 11:07, António Ramos wrote: 
  my ping rtt to webfaction account is 60ms 
  my ping rtt to digitalOcean account is 85ms 
  

 Not sure of the significance of that if we don't know where you're 
 pinging /from/? 

 We use Linode for the big stuff and DO for the small stuff, FWIW. I have 
 nothing but praise for Linode. DO are pretty good, but nowhere near as 
 polished as Linode, and do not (yet) inspire the confidence that Linode 
 does. 

 Two issues with DO that are worth mentioning: - 

 - No IPv6 
 This is just slack! It's gone into private beta very recently, I 
 understand - what I don't understand is why it was not there from day one! 

 - No swapfile 
 Can be a gotcha depending on your needs, but easily remedied [1]. 


 [1] 

 https://www.digitalocean.com/community/articles/how-to-add-swap-on-ubuntu-12-04
  


 -- 

 Regards, 

 PhilK 


 'a bell is a cup...until it is struck' 



-- 
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: Record representation : multiple levels of references

2014-05-23 Thread Anthony
You can use a lambda:

db.define_table('other_table',
Field('key_id', 'reference key',
  requires=IS_IN_DB(db, 'key.id', lambda r: '%s %s (%s)' % (r.
person_id.first_name,
r.
person_id.last_name, r.id

Anthony

On Friday, May 23, 2014 5:38:21 AM UTC-4, Louis Amon wrote:

 Say I have a table like this:

 db.define_table('person', Field('first_name'), Field('last_name'), 
 format='%(first_name)s %(last_name)s'

 Now if I build a new table:

 db.define_table('key', Field('person_id', 'reference person', 
 requires=IS_IN_DB(db, db.person, label=db.person._format)))

 My new table 'key' will represent its references using 'person' table's 
 format.


 But what if I have another table like this:

 db.define_table('other_table', Field('key_id', 'reference key', 
 requires=IS_IN_DB(db, db.key, label='%(first_name)s %(last_name)s 
 (%(key_id)s)'???)))


 How do I define the label in 'other_table' so that it shows the 'person' 
 that this key is actually referring to ?




-- 
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 improve performance for db queries

2014-05-23 Thread Anthony
Not sure I follow. Please show the code.

Also, I'm surprised that code change made such a difference. My code did 
limit the select to just the necessary fields. Does that table include 
other fields that contain large amounts of data (e.g., a blob field)?

Anthony

On Friday, May 23, 2014 4:53:15 AM UTC-4, Sarbjit wrote:

 HI Anthony,

 Changes suggested by you in the controller to reduce the complexity of the 
 function actually worked, now the drop down options are changed instantly.

 However, I am observing one strange problem now. Somehow the 
 getResults() function is not called when the drop down options are 
 changed from within the GRID view/edit pages.

 So, basically in my form, I am displaying the results as GRID. Once, I get 
 the results from grid based on the options selected in drop-downs, If I 
 open any record from grid using VIEW/EDIT option from GRID, second drop 
 down is never populated. Infact I noticed that this function is not called 
 if I am inside the view/edit option. 

 Do you have any idea on what could be the problem.

 -Sarbjit



-- 
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] run web2py in a read only filesystem

2014-05-23 Thread Carlos Cesar Caballero Díaz
Hi, is possible to run web2py (windows and linux versions) in a 
read-only filesystem (like a cd or dvd) using sqlite, assuming that the 
application does not require write changes to the database?.


--

Este mensaje le ha llegado mediante el servicio de correo electronico que 
ofrece Infomed para respaldar el cumplimiento de las misiones del Sistema 
Nacional de Salud. La persona que envia este correo asume el compromiso de usar 
el servicio a tales fines y cumplir con las regulaciones establecidas

Infomed: http://www.sld.cu/

--
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] URL() and HTTPS

2014-05-23 Thread Richard Vézina
You don't follow my reflexion... I just say that if there were no relative
URL and the behaviour you describe... 60 ms over and over could have been a
great improvement...

Thanks again for you answer Niphold.

Richard


On Fri, May 23, 2014 at 4:27 AM, Niphlod niph...@gmail.com wrote:

 Again.. it's not over and over.. it happens the only first
 request that comes in pointing to anything http(ish). Second, third, etc
 will point to https already.


 On Thursday, May 22, 2014 3:08:01 PM UTC+2, Richard wrote:

 Yeah you are right, I forget about relative URL, since I was trying to
 create a link for an email sent by the app...

 Thanks for clarifying.

 60 ms over and over could have been a great improvement overall if there
 was no relative url though.

 :)

 Richard


 On Wed, May 21, 2014 at 4:35 PM, Niphlod nip...@gmail.com wrote:

 URL() generates relative links by default. No http or https...plain
 /app/controller/function links.
 that being said, URL has scheme and host parameters that can generate
 absolute links.

 Back to the performance side. Usually the redirection from http to
 https is required at the very first access to the website, and is handled
 directly by the webserver that is usually in front of web2py.
 It takes generally 40 to 60 ms.
 If your app uses relative links always, once you get to the https main
 page, all links will point to https, without you worrying to pass host and
 scheme all the time (that can surely hurt your page weight on average, in
 addition to your tipings skills.)
 Just to put things in perspective, this means that you're worrying over
 60 ms in the whole user experience of your app (even in a supersimple
 website, users should stay there at least a minute in the app ?!?).

 You'd better waste sleep hours on something else :-P

 BTW: it's all here http://web2py.com/books/default/chapter/29/04/the-
 core#URL


 On Wednesday, May 21, 2014 9:53:07 PM UTC+2, Richard wrote:

 Hello,

 I am searching a way to make URL() return an address with HTTPS
 instead of plain HTTP. I didn't find a way to do that...

 There is :

 request.is_https
 request.requires_https()

 But they seem to be for preventing access to plain HTTP.

 So, that mean that URL() always redirect to HTTP and never to HTTPS...
 That may reduce performance, I had read long time ago that reducing
 redirection is rule number 1 for improving loading speed...

 Maybe it could be a good idea to add a flag that let generate URL()
 with HTTPS instead of only HTTP??

 Richard

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

 For more options, visit https://groups.google.com/d/optout.


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


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


[web2py] web2py and whoosh

2014-05-23 Thread Carlos Cesar Caballero Díaz
Hi, I'm using web2py and whoosh in an application that stores documents 
and makes google-like searches, using 
https://github.com/mdipierro/web2py-haystack as starting point, but I'm 
having problems with the character encoding when Latin letters (á é í 
etc ...) appears. Someone has faced this before or have any suggestions 
for solving this?


--

Este mensaje le ha llegado mediante el servicio de correo electronico que 
ofrece Infomed para respaldar el cumplimiento de las misiones del Sistema 
Nacional de Salud. La persona que envia este correo asume el compromiso de usar 
el servicio a tales fines y cumplir con las regulaciones establecidas

Infomed: http://www.sld.cu/

--
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 to use modal with an if condition

2014-05-23 Thread Richard Vézina
We will need more background and code...

What result is? a field that a user is actually filling or the content of a
variable that you can determine at the controller level?

If the later it is easy :

{{if result == 3:}}
modal html
modal javacript
in the javascript trigger the modal
{{pass}}

Richard


On Fri, May 23, 2014 at 5:41 AM, LoveWeb2py atayloru...@gmail.com wrote:

 Is this possible? I basically want to try and write a function that says

 if the result == 3:
 popup a modal box

 I followed this example:
 http://getbootstrap.com/2.3.2/javascript.html#modals

 But I just can't figure out how to make the modal pop up in the same
 window. I am thinking it will be something along the lines of AJAX or using
 LOAD?

  --
 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: Record representation : multiple levels of references

2014-05-23 Thread Louis Amon
wicked cool

thanks a bunch !

On Friday, May 23, 2014 3:28:43 PM UTC+2, Anthony wrote:

 You can use a lambda:

 db.define_table('other_table',
 Field('key_id', 'reference key',
   requires=IS_IN_DB(db, 'key.id', lambda r: '%s %s (%s)' % (r.
 person_id.first_name,
 r.
 person_id.last_name, r.id

 Anthony

 On Friday, May 23, 2014 5:38:21 AM UTC-4, Louis Amon wrote:

 Say I have a table like this:

 db.define_table('person', Field('first_name'), Field('last_name'), 
 format='%(first_name)s %(last_name)s'

 Now if I build a new table:

 db.define_table('key', Field('person_id', 'reference person', 
 requires=IS_IN_DB(db, db.person, label=db.person._format)))

 My new table 'key' will represent its references using 'person' table's 
 format.


 But what if I have another table like this:

 db.define_table('other_table', Field('key_id', 'reference key', 
 requires=IS_IN_DB(db, db.key, label='%(first_name)s %(last_name)s 
 (%(key_id)s)'???)))


 How do I define the label in 'other_table' so that it shows the 'person' 
 that this key is actually referring to ?




-- 
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 and whoosh

2014-05-23 Thread Derek
I've seen this before when the layout.html didn't include the character 
coding portion.

On Friday, May 23, 2014 7:49:39 AM UTC-7, Carlos Cesar Caballero Díaz wrote:

 Hi, I'm using web2py and whoosh in an application that stores documents 
 and makes google-like searches, using 
 https://github.com/mdipierro/web2py-haystack as starting point, but I'm 
 having problems with the character encoding when Latin letters (á é í 
 etc ...) appears. Someone has faced this before or have any suggestions 
 for solving this? 

 -- 

 Este mensaje le ha llegado mediante el servicio de correo electronico que 
 ofrece Infomed para respaldar el cumplimiento de las misiones del Sistema 
 Nacional de Salud. La persona que envia este correo asume el compromiso de 
 usar el servicio a tales fines y cumplir con las regulaciones establecidas 

 Infomed: http://www.sld.cu/ 



-- 
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: There were changes in MS SQLServer driver?

2014-05-23 Thread Derek
if you read the whole thing, he changed the way it works.

db = DAL('mssql://dsn=192.168.0.52;user=usr1;password=pwd1;') 

hint: You have to use DBAPI 2.0 connection strings.

http://legacy.python.org/dev/peps/pep-0249/#footnotes

On Tuesday, May 20, 2014 10:17:09 PM UTC-7, Nguyen Minh Tuan wrote:

 Hi Jose,

 I'm now have the same error with you.
 and cannot connect to MSSQL server, I've read your self answer but can not 
 understand.
 Can you help me?

 db = DAL('mssql://usr1:pwd1@192.168.0.52/database_1')

 environment :
 - CentOS 6.4, Nginx, uWSGI
 - Python 2.7.6
 - Web2py 2.9.5

 Thanks,
 Tuan.

 On Saturday, October 20, 2012 3:26:03 AM UTC+7, Jose wrote:



 El viernes, 19 de octubre de 2012 15:48:26 UTC-3, Massimo Di Pierro 
 escribió:

 So, is the issue closed?


 Yes.

 Jose 



-- 
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 make session variables persist even after logout ?

2014-05-23 Thread Mandar Vaze
I have two applications using different versions of web2py

I'm using session variables to store some sort of user preferences.

First one uses version 2.3.2
Here - I set the session variables after user selects their preferences. 
These values are available even after user logs out and logs back in
This works well for me.

The second one uses version 2.9.5
Here - the code is similar (set session variables when user sets the 
preferences) - but when the user logs out - the session variables are lost.
So when user logs in again - the preferences are lost

In both cases - sessions are stored on the filesystem (default setup), 
neither have I modified any expiration values from the default 

I'm assuming this is due to some changes in how web2py handles sessions 
between 2.3.2 and 2.9.5

Is there a way to retain session variables even after user logs out - *in 
2.9.5* ?

I have seen suggestions to use cache options - but I would prefer to 
continue to use session variables (in 2.3.2 this was seemless - just 
set/get the variables - nothing more)

-Mandar

-- 
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: Translate html file to python file

2014-05-23 Thread Derek
the word you are looking for is 'render'.
response.render(dict)

Look at example 40 here.

http://www.web2py.com/init/default/examples

On Wednesday, May 21, 2014 6:30:33 AM UTC-7, ilyas toxanbayev wrote:

 How to convert html file to python file. Example:

 test.html :

 *pSomething/p *

 *{{for item in category}}*

 *{{=item}}*

 *{endfor}}*

  

 It nessesary to convert to python file test.py  which contain :

 *def index(): *

 *print pSomething/p*

 *for item in category: *

 *print item*


-- 
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 make session variables persist even after logout ?

2014-05-23 Thread Derek
A session should only be temporary storage related to the current session. 
If you are storing preferences in user accounts then you should store them 
with the user accounts, not using a session. I don't see what your problem 
is.

On Friday, May 23, 2014 10:58:40 AM UTC-7, Mandar Vaze wrote:

 I have two applications using different versions of web2py

 I'm using session variables to store some sort of user preferences.

 First one uses version 2.3.2
 Here - I set the session variables after user selects their preferences. 
 These values are available even after user logs out and logs back in
 This works well for me.

 The second one uses version 2.9.5
 Here - the code is similar (set session variables when user sets the 
 preferences) - but when the user logs out - the session variables are lost.
 So when user logs in again - the preferences are lost

 In both cases - sessions are stored on the filesystem (default setup), 
 neither have I modified any expiration values from the default 

 I'm assuming this is due to some changes in how web2py handles sessions 
 between 2.3.2 and 2.9.5

 Is there a way to retain session variables even after user logs out - *in 
 2.9.5* ?

 I have seen suggestions to use cache options - but I would prefer to 
 continue to use session variables (in 2.3.2 this was seemless - just 
 set/get the variables - nothing more)

 -Mandar



-- 
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 string_agg for groupby?

2014-05-23 Thread Richard Vézina
Nice!

Thanks Joe

:)

Richard


On Fri, May 23, 2014 at 3:28 AM, Joe Barnhart joe.barnh...@gmail.comwrote:

 It's super-easy Richard.  You can provide a list of Field objects or a
 list of colnames in table.field format and it will return a Rows object
 for you.  It's almost too easy!

 rows=db.executesql(select id,code,name from lsc,
 colnames=['lsc.id','lsc.code','lsc.name'])


 -- Joe

 On Tuesday, May 20, 2014 7:26:24 AM UTC-7, Richard wrote:

 Yes you are right... I just puch as far as I can for this one to touch
 the limit... Though the reason was to make use of Row and dot notation to
 access data because I manipulate them a lot and using slicing would make my
 code much less redable.

 I think there is a way to initialise Row on db.executesql, I will have
 read about that.

 Thanks

 Richard


 On Fri, May 16, 2014 at 9:42 PM, Joe Barnhart joe.ba...@gmail.comwrote:

 Hi Richard --

 When using special DB features, sometimes it's best just to fall back to
 the old executesql function.  It works really well for those complex
 joins and special functions that are just too seldom-used to be
 special-cased in the DAL.

 In fact, when I was forced to use it not long ago, I was amazed at how
 simple and direct it was.  It really made a messy query into a clean one.

 -- Joe


 On Wednesday, May 14, 2014 7:46:20 AM UTC-7, Richard wrote:

 Hello,

 Is there a way to do string_agg() with in web2py for a query that have
 groupby clause?

 Richard

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

 For more options, visit https://groups.google.com/d/optout.


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


-- 
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] Are MD5sums posted for Web2Py?

2014-05-23 Thread Dave S
I just downloaded the Normal (stable?) version and the Developer's 
(nightly?) version for use on a Centos machine, and I wanted to check 
that I got what I think I got.

The values I get are

# developer version
d083f552b19ac25d24020fdc6388baea

# normal
fe8e532990006964fda40478ef18d663

/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: Are MD5sums posted for Web2Py?

2014-05-23 Thread Dave S


On Friday, May 23, 2014 11:57:27 AM UTC-7, Dave S wrote:

 I just downloaded the Normal (stable?) version and the Developer's 
 (nightly?) version for use on a Centos machine,


Also, I can't see what I did wrong at startup, but the admin interface is 
disabled because of insecure channel.

I'm using a browser on the same machine, same user session.   The local IP 
is 10.xx.yy.zz, and I used -i 10.xx.yy.zz, and set a password on the 
first try,
and used -a 'recycle'  on the second try.  And that matches how I did 
it on the Fedora machine, where I don't have any problems.
Both are using Version 2.9.5-stable+timestamp.2014.03.16.02.35.39.

(I also have the Windows version working on Yet Another Machine (my 
laptop)).


/dps


 

 and I wanted to check that I got what I think I got.

 The values I get are

 # developer version
 d083f552b19ac25d24020fdc6388baea

 # normal
 fe8e532990006964fda40478ef18d663

 /dps



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


[web2py] Re: How to make session variables persist even after logout ?

2014-05-23 Thread Anthony
Yes, due to a security vulnerability, the behavior was changed -- now by 
default, a new session ID is created upon either login or logout, and upon 
logout, the session itself is cleared. The behavior can be controlled with 
these settings (default values shown):

auth.settings.renew_session_onlogin = True # change session ID
auth.settings.renew_session_onlogout = True # change session ID
auth.settings.keep_session_onlogin = True # keep session content
auth.settings.keep_session_onlogout = False # clear session content

To achieve what you want, do:

auth.settings.keep_session_onlogout = True

Though keeping in mind there may be a security risk if anything in the 
session should pertain only to the previously logged in user. If you want 
to keep only particular keys in the session upon logout, then make the 
setting as shown above, and create an auth.settings.logout_onlogout 
callback that clears all the keys in the session except those you want to 
keep.

Note, if necessary, you can also renew the session directly via:

session.renew(clear_session=[True|False])

That is the method called by Auth, depending on the above settings.

Anthony

On Friday, May 23, 2014 1:58:40 PM UTC-4, Mandar Vaze wrote:

 I have two applications using different versions of web2py

 I'm using session variables to store some sort of user preferences.

 First one uses version 2.3.2
 Here - I set the session variables after user selects their preferences. 
 These values are available even after user logs out and logs back in
 This works well for me.

 The second one uses version 2.9.5
 Here - the code is similar (set session variables when user sets the 
 preferences) - but when the user logs out - the session variables are lost.
 So when user logs in again - the preferences are lost

 In both cases - sessions are stored on the filesystem (default setup), 
 neither have I modified any expiration values from the default 

 I'm assuming this is due to some changes in how web2py handles sessions 
 between 2.3.2 and 2.9.5

 Is there a way to retain session variables even after user logs out - *in 
 2.9.5* ?

 I have seen suggestions to use cache options - but I would prefer to 
 continue to use session variables (in 2.3.2 this was seemless - just 
 set/get the variables - nothing more)

 -Mandar



-- 
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] Form validators: IS_IN_DB(..., _or=other_validator) ?

2014-05-23 Thread Louis Amon
Due to external constraints, I need to define two tables that are actually 
siblings and a third table's field that can choose from any of said tables.

e.g.:
db.define_table('melon')
db.define_table('watermelon')

I need the third table's field to be a reference to either of the two first 
tables.

Is there a way to define this in terms of field type and validators ?
I was thinking along the lines of:

db.define_table('my_table', Field('fruit_id', type=???, 
requires=IS_IN_DB(db, db.melon, _or=IS_IN_DB(db, db.watermelon)))

or maybe:

db.define_table('my_table', Field('fruit_id', type=???, 
requires=any([IS_IN_DB(db, db.melon), IS_IN_DB(db, db.watermelon)]))

But of course it doesn't work...


How can I work around this issue ?

-- 
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: Form validators: IS_IN_DB(..., _or=other_validator) ?

2014-05-23 Thread Anthony
How would you know whether the field stores an id of the melon table or the 
watermelon table?

On Friday, May 23, 2014 4:52:58 PM UTC-4, Louis Amon wrote:

 Due to external constraints, I need to define two tables that are actually 
 siblings and a third table's field that can choose from any of said tables.

 e.g.:
 db.define_table('melon')
 db.define_table('watermelon')

 I need the third table's field to be a reference to either of the two 
 first tables.

 Is there a way to define this in terms of field type and validators ?
 I was thinking along the lines of:

 db.define_table('my_table', Field('fruit_id', type=???, 
 requires=IS_IN_DB(db, db.melon, _or=IS_IN_DB(db, db.watermelon)))

 or maybe:

 db.define_table('my_table', Field('fruit_id', type=???, 
 requires=any([IS_IN_DB(db, db.melon), IS_IN_DB(db, db.watermelon)]))

 But of course it doesn't work...


 How can I work around this issue ?



-- 
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: Form validators: IS_IN_DB(..., _or=other_validator) ?

2014-05-23 Thread Louis Amon
Well in this particular case I needn't know wether I'm storing a melon or a 
watermelon's id.

I know it's kind of idiotic but I just need a 'fruit' id.

Think of it as a subclassing matter : the API I'm connecting to is doing 
something along the lines of subclassing anyway, and I need to store data about 
every transaction my program does with this poorly-designed API

 Le 23 mai 2014 à 23:03, Anthony abasta...@gmail.com a écrit :
 
 How would you know whether the field stores an id of the melon table or the 
 watermelon table?
 
 On Friday, May 23, 2014 4:52:58 PM UTC-4, Louis Amon wrote:
 Due to external constraints, I need to define two tables that are actually 
 siblings and a third table's field that can choose from any of said tables.
 
 e.g.:
 db.define_table('melon')
 db.define_table('watermelon')
 
 I need the third table's field to be a reference to either of the two first 
 tables.
 
 Is there a way to define this in terms of field type and validators ?
 I was thinking along the lines of:
 
 db.define_table('my_table', Field('fruit_id', type=???, 
 requires=IS_IN_DB(db, db.melon, _or=IS_IN_DB(db, db.watermelon)))
 
 or maybe:
 
 db.define_table('my_table', Field('fruit_id', type=???, 
 requires=any([IS_IN_DB(db, db.melon), IS_IN_DB(db, db.watermelon)]))
 
 But of course it doesn't work...
 
 
 How can I work around this issue ?
 
 
 -- 
 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/nd6ED9oScsA/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: Translate html file to python file

2014-05-23 Thread Anthony
Are you saying you want to take a web2py template and generate the 
intermediate representation in Python code? If so, you can do:

from gluon.template import parse_template
python_code = parse_template(open('path/to/template', 'rb'), path=
'path/to/views')

The path argument should be the path to the associated /views folder, 
which is needed in case the template extends or includes any other 
templates.

Note, if you want to convert the response.write() calls to print 
statements, you'll have to do some additional custom parsing of your own.

Anthony

On Wednesday, May 21, 2014 9:30:33 AM UTC-4, ilyas toxanbayev wrote:

 How to convert html file to python file. Example:

 test.html :

 *pSomething/p *

 *{{for item in category}}*

 *{{=item}}*

 *{endfor}}*

  

 It nessesary to convert to python file test.py  which contain :

 *def index(): *

 *print pSomething/p*

 *for item in category: *

 *print item*


-- 
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: Form validators: IS_IN_DB(..., _or=other_validator) ?

2014-05-23 Thread Anthony
I suppose you could just make it type='integer'. Then you could use the 
IS_IN_SET validator and construct a list of id's from the two tables 
(keeping in mind you should de-dup the list, as both tables will have many 
of the same id's). Of course, if you end up storing a value of say, 5, you 
won't know if it is referencing record #5 in the melon table or record #5 
in the watermelon table.

Anthony

On Friday, May 23, 2014 5:24:49 PM UTC-4, Louis Amon wrote:

 Well in this particular case I needn't know wether I'm storing a melon or 
 a watermelon's id.

 I know it's kind of idiotic but I just need a 'fruit' id.

 Think of it as a subclassing matter : the API I'm connecting to is doing 
 something along the lines of subclassing anyway, and I need to store data 
 about every transaction my program does with this poorly-designed API

 Le 23 mai 2014 à 23:03, Anthony abasta...@gmail.com a écrit :

 How would you know whether the field stores an id of the melon table or 
 the watermelon table?

 On Friday, May 23, 2014 4:52:58 PM UTC-4, Louis Amon wrote:

 Due to external constraints, I need to define two tables that are 
 actually siblings and a third table's field that can choose from any of 
 said tables.

 e.g.:
 db.define_table('melon')
 db.define_table('watermelon')

 I need the third table's field to be a reference to either of the two 
 first tables.

 Is there a way to define this in terms of field type and validators ?
 I was thinking along the lines of:

 db.define_table('my_table', Field('fruit_id', type=???, 
 requires=IS_IN_DB(db, db.melon, _or=IS_IN_DB(db, db.watermelon)))

 or maybe:

 db.define_table('my_table', Field('fruit_id', type=???, 
 requires=any([IS_IN_DB(db, db.melon), IS_IN_DB(db, db.watermelon)]))

 But of course it doesn't work...


 How can I work around this issue ?

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



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


Re: [web2py] URL() and HTTPS

2014-05-23 Thread Anthony
Yes, but to be clear, over and over really means once per user session, 
if and only if the user starts at an http URL, not once per request.

Regarding your original point, note that URL() generates neither http nor 
https URLs by default -- it generates relative URLs that start with /. 
So, if you are on an http page, the browser will end up requesting an http 
URL. If you want to override this for a given link, you can do so by 
specifying the scheme argument to URL(). What else do you suggest?

If you want to be able to write a mix of http and https URLs but don't want 
to keep specifying the scheme argument, then use functools.partial to 
create your own special functions with the value of that argument set to 
http and https.

Anthony

On Friday, May 23, 2014 10:25:37 AM UTC-4, Richard wrote:

 You don't follow my reflexion... I just say that if there were no relative 
 URL and the behaviour you describe... 60 ms over and over could have been a 
 great improvement...

 Thanks again for you answer Niphold.

 Richard


 On Fri, May 23, 2014 at 4:27 AM, Niphlod niph...@gmail.com wrote:

 Again.. it's not over and over.. it happens the only first 
 request that comes in pointing to anything http(ish). Second, third, etc 
 will point to https already.


 On Thursday, May 22, 2014 3:08:01 PM UTC+2, Richard wrote:

 Yeah you are right, I forget about relative URL, since I was trying to 
 create a link for an email sent by the app...

 Thanks for clarifying.

 60 ms over and over could have been a great improvement overall if there 
 was no relative url though.

 :)

 Richard


 On Wed, May 21, 2014 at 4:35 PM, Niphlod nip...@gmail.com wrote:

 URL() generates relative links by default. No http or https...plain 
 /app/controller/function links.
 that being said, URL has scheme and host parameters that can generate 
 absolute links.

 Back to the performance side. Usually the redirection from http to 
 https is required at the very first access to the website, and is handled 
 directly by the webserver that is usually in front of web2py. 
 It takes generally 40 to 60 ms. 
 If your app uses relative links always, once you get to the https 
 main page, all links will point to https, without you worrying to pass 
 host and scheme all the time (that can surely hurt your page weight on 
 average, in addition to your tipings skills.) 
 Just to put things in perspective, this means that you're worrying over 
 60 ms in the whole user experience of your app (even in a supersimple 
 website, users should stay there at least a minute in the app ?!?). 

 You'd better waste sleep hours on something else :-P 

 BTW: it's all here http://web2py.com/books/default/chapter/29/04/the-
 core#URL


 On Wednesday, May 21, 2014 9:53:07 PM UTC+2, Richard wrote:

 Hello,

 I am searching a way to make URL() return an address with HTTPS 
 instead of plain HTTP. I didn't find a way to do that...

 There is :

 request.is_https
 request.requires_https()

 But they seem to be for preventing access to plain HTTP.

 So, that mean that URL() always redirect to HTTP and never to HTTPS... 
 That may reduce performance, I had read long time ago that reducing 
 redirection is rule number 1 for improving loading speed...

 Maybe it could be a good idea to add a flag that let generate URL() 
 with HTTPS instead of only HTTP??

 Richard

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

 For more options, visit https://groups.google.com/d/optout.


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




-- 
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 import python functions

2014-05-23 Thread Maurice Waka

Thanks for the update. 

I wanted to know whether I cant import the function from the python module 
that contains the print 'message delivered' to the HTML view and have it 
printed e.g. 
{{extend 'layout.html'}}
{{=test()}}

OR do I have to change the python code.

Kind regards
On Thursday, May 22, 2014 5:47:56 PM UTC+3, Anthony wrote:

 Are you saying you need to know how to import code from a module, or just 
 that you want to know how to have text show up in an HTML page? If the 
 latter, it is just:

 {{=some_string}}

 For example, you might have a web2py action like this:

 def index():
 return dict(message='Message delivered')

 And in the view:

 {{=message}}

 Anthony

 On Thursday, May 22, 2014 1:17:07 AM UTC-4, Maurice Waka wrote:

 I have this example code in python module:

 def test():
 .code
 print('Message delivered')
 test()

 How do I import such a function to* print* in the html view the same 
 message as in the python code?



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


[web2py] Re: D3.js calling Json in View

2014-05-23 Thread thehuman trashcan
Thank you so much Andrew - you have given me plenty to work on...

When I'm back I'll give these a go and let you know how I get on.

Many thanks again

On Friday, 23 May 2014 05:41:16 UTC+1, Andrew W wrote:

 Also, try scheme='https' in your case. See Core chapter of book.

-- 
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] Simple loan system for library

2014-05-23 Thread john smith
I'm trying to create library system and have a little problem. Here's my 
current model:
db.define_table('tags', 
Field('name'),format='%(name)s') 
db.define_table('copies',
Field('is_active','boolean',default=True))

db.define_table('book',
Field('title',requires=IS_NOT_EMPTY(), label='Tytuł'),
Field('author', requires=IS_NOT_EMPTY(), label='Autor'),
Field('isbn', 'integer', requires=IS_LENGTH(13), label='ISBN'),
Field('release_year', 'integer', requires=IS_INT_IN_RANGE(-3000, 
request.utcnow.year+1), label='Rok wydania'),
Field('format', label='Format'),
Field('cover', 'upload', requires = IS_EMPTY_OR(IS_IMAGE()), 
label='Okładka'),
Field('publisher', label='Wydawca'),
Field('tags', 'list:reference tags', label='Tagi'), 
Field('copies', db.copies),
auth.signature)

db.book.tags.widget = SQLFORM.widgets.checkboxes.widget

Here is what I want to achieve: when a user adds new 'book' table record, 
he types number of copies of that book and that amount of records is 
automatically created in 'copies' table. Then a user will be able to loan a 
specific copy of a book (i will probably be able to figure this part out 
thanks to library example) but only for specific period. If you have other 
ideas on how to solve my problem, please share.
Also less important but i would like to change the style of my tags widget, 
so it would display either set number of tags per row or just display 
maximum number that will fit in screen.
Thanks in advance for all replies.

-- 
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] Post Request Timeout

2014-05-23 Thread Cory
Hi,
I have a url that is supposed to receive a post request that contains xml. 
This post request is a callback from an api. 
For some reason the post request cannot connect to the url I have 
specified. The view that is supposed to 
receive the request only contains 

fieldKeys = []
if request.post_vars:
for value in request.post_vars:
fieldKeys.append(value)
if fieldKeys[0]:
db.test_post.insert(field1 = fieldKeys[0])

I just do this for testing purposes to see if I receive the post at all. 
when I make a post request to myself I end up getting the 
post variables fine.

Does anyone know any possible reasons on why a post 
request from a 3rd party would not connect to a valid
url with the above code?

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: Web2py on EC2: site does not appear

2014-05-23 Thread Gaurav Kalyan
I am having the similar problem that is when I try to access my public dns 
apache ubuntu page appear nothing happens


On Wednesday, 18 July 2012 07:01:24 UTC+5:30, lyn2py wrote:

 Ok it works now!

 Thanks rdodev!

 On Wednesday, July 18, 2012 4:55:38 AM UTC+8, lyn2py wrote:

 Connection Timeout error. 

 On Wednesday, July 18, 2012 1:59:15 AM UTC+8, rdodev wrote:

 Was it a 404, timeout error or what?

 On Tuesday, July 17, 2012 11:49:14 AM UTC-4, lyn2py wrote:

 Another issue O.O
  
 Now that the whole script has installed, and I followed through with 
 the rest of the commands

 sudo -u www-data bash
 cd /home/www-data/web2py
 python -c from gluon.main import save_password; 
 save_password('hello',443)

 Accessed via the public DNS, but the site does not appear.

 What did I do wrong?



-- 
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: D3.js calling Json in View

2014-05-23 Thread thehuman trashcan
In my impatience I just quickly edited the file.  data.dashboard_data is 
all that was needed.

I have managed to leave Scheme=true.

I don't fully understand how data.dashboard_data converts my dictionary to 
an array, but I will be looking into this to understand.

In any case, thank you ever so much!


On Friday, 23 May 2014 05:41:16 UTC+1, Andrew W wrote:

 Also, try scheme='https' in your case. See Core chapter of book.

-- 
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: Simple loan system for library

2014-05-23 Thread Andrew W
Hi John,
One step at a time, looking at your database model,  how does 'copies' 
relate to a book ?  You are missing a foreign key reference.   Are there 
any other attributes that a copy may have ?


On Saturday, May 24, 2014 7:30:35 AM UTC+10, john smith wrote:

 I'm trying to create library system and have a little problem. Here's my 
 current model:
 db.define_table('tags', 
 Field('name'),format='%(name)s') 
 db.define_table('copies',
 Field('is_active','boolean',default=True))

 db.define_table('book',
 Field('title',requires=IS_NOT_EMPTY(), label='Tytuł'),
 Field('author', requires=IS_NOT_EMPTY(), label='Autor'),
 Field('isbn', 'integer', requires=IS_LENGTH(13), label='ISBN'),
 Field('release_year', 'integer', requires=IS_INT_IN_RANGE(-3000, 
 request.utcnow.year+1), label='Rok wydania'),
 Field('format', label='Format'),
 Field('cover', 'upload', requires = IS_EMPTY_OR(IS_IMAGE()), 
 label='Okładka'),
 Field('publisher', label='Wydawca'),
 Field('tags', 'list:reference tags', label='Tagi'), 
 Field('copies', db.copies),
 auth.signature)

 db.book.tags.widget = SQLFORM.widgets.checkboxes.widget

 Here is what I want to achieve: when a user adds new 'book' table record, 
 he types number of copies of that book and that amount of records is 
 automatically created in 'copies' table. Then a user will be able to loan a 
 specific copy of a book (i will probably be able to figure this part out 
 thanks to library example) but only for specific period. If you have other 
 ideas on how to solve my problem, please share.
 Also less important but i would like to change the style of my tags 
 widget, so it would display either set number of tags per row or just 
 display maximum number that will fit in screen.
 Thanks in advance for all replies.


-- 
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: D3.js calling Json in View

2014-05-23 Thread Andrew W
good work.  data just refers to the dictionary.  When you open up your json 
file you just see a dictionary with one key that points to an array.
By saying data.dashboard_data you are then directly referencing the value 
of the key, ie. the array in the dictionary.  

There are several ways to do this which I must post to web2pyslices soon, 
but yours is one of them, and it works !

web2py with d3 is a good combo.   I plan to do a lot more with the two 
combined.



On Friday, May 23, 2014 10:04:17 PM UTC+10, thehuman trashcan wrote:

 In my impatience I just quickly edited the file.  data.dashboard_data is 
 all that was needed.

 I have managed to leave Scheme=true.

 I don't fully understand how data.dashboard_data converts my dictionary to 
 an array, but I will be looking into this to understand.

 In any case, thank you ever so much!


 On Friday, 23 May 2014 05:41:16 UTC+1, Andrew W wrote:

 Also, try scheme='https' in your case. See Core chapter of book.



-- 
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 migrate to UUID references in db without messing up reference fields

2014-05-23 Thread Ian W. Scott
After 10 days I've received no help on this. Is there something about the 
question that is inappropriate?

On Wednesday, May 14, 2014 11:44:43 AM UTC-4, Ian W. Scott wrote:

 I need to take an existing db and implement a UUID referencing system so 
 that I can sync local db's with a central remote version. But I'm concerned 
 that this will break reference fields that refer to the newly synced rows.

 My understanding is that the UUID field is necessary because a csv import 
 will assign different row ids to the new entries in the target db than the 
 ones they had in the source db (especially if new records have been added 
 to the target db in the meantime). The UUID is supposed to overcome this, 
 by allowing the db to recognize that rows are equivalent even if they have 
 different ids. But in that case, won't reference fields in other tables 
 often be pointing to the wrong ID number in the target db? (i.e., they'll 
 keep the row ID of the db version in which they were created, and if this 
 ID changes in the target db they will then be referencing a different 
 record.)

 Sorry if this explanation is overly complicated. I'm just trying to get 
 things clear in my own mind.

 Thanks



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


[web2py] Re: How to make session variables persist even after logout ?

2014-05-23 Thread Mandar Vaze
Derek,

May be I misrepresented my scenario - These aren't exactly preferences.
In both the applications - user sees SQLFORM.grid with large number of 
records. User will use filter to reduce the count.
Depending on the user - user is likely to use same filters for quite some 
time - across logins/logouts
So these aren't exactly preferences.

I understand that using sessions across login/logout isn't the right thing 
to do - but since I got that behaviour in 2.3.2 - I want it in current 
version as well :)
Also - the kind of information I'm storing shouldn't lead to security 
issue AFAIK

What Anthony suggested is helpful.
 

 If you are storing preferences in user accounts then you should store them 
 with the user accounts


Can you provide additional details ? Do you mean auth.settings.extra_fields 
?

-Mandar

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