[web2py] Uploading file through restful webservice

2013-11-21 Thread Raj Chinna
Can someone give me a pointer.. I am waiting for the response..

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


[web2py] Select Image In Custom Registration

2013-11-21 Thread Noah Corradin
I have a custom registration form and i am getting a good grasp of the 
concepts behind customizing the auth_table.  I was curious about one thing 
i could not find a good direction for.

I want users to be able to select an image from a drop down menu at the 
registration page for their avatar.  Any tips or suggestions on how to 
accomplish this?
Much appreciated 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/groups/opt_out.


[web2py] DAL table definition behaves differently in model ...versus... a module method ??

2013-11-21 Thread floydpetrus

Hi there fellow web2py-users !

At the moment I'm working with / supervising a web2py-driven project 
.in which we use both  db.define_table( .   (in model)  and   
current.db.define_table( .   (in some module methods that handles the 
creation of data-relations from user-triggered events ).

In the outcome of the mentioned module methods ..the DAL table 
definition creates the actual tables in the database   before any 
inserts occurs on these   which is a fine and desired behavior in our 
situation.

Our fixed table definitions in the model  on the other hand are not 
giving rise to actual table creations in database until any inserts occur 
on these definitions  .this behavior is suitable for the majority of 
our fixed table definitions ... except for some smaller number of them for 
which select-operations, trough DAL, need to be possible even if no 
data have been inserted yet.

With the described situation as background I have two general questions to 
raise:

  1. Why does the DAL table definitions in the module methods produce 
actual table creations in database ( before any inserts ) ?

  2. What is the most correct / intended method / way to achieve actual 
table creations in database from DAL-definitions in the model ( before any 
inserts ) ?


Additional remark :  we prepare the availability of the DAL-object in the 
module's current instance by adding the following in the model:

from gluon import current

current.db = db
 

  I'm indeed sincerely thankful in advance for any answers ...that 
helps resolving my two questions.

  Sending my best regards !   / Peter  

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


[web2py] Re: {{=form.custom.widget.fieldname}} for Remember me checkbox

2013-11-21 Thread Anthony
Because that field is not part of the database table, it isn't part of the 
SQLFORM and therefore not in form.custom.widget. Instead, it is added to 
the form DOM after the form has been created. If you want just the checkbox 
widget, you can do:

{{=form.element('input#auth_user_remember')}}

Anthony

On Thursday, November 21, 2013 2:50:14 PM UTC-5, Michael Gheith wrote:

 My controller is:

 def index():
 return dict(form=auth.login())


 I'm trying to customize the web2py login form in the view like the 
 following:

 {{=form.custom.begin}}
 E-mail: div{{=form.custom.widget.email}}/div
 Password: div{{=form.custom.widget.password}}/div
 Login: {{=form.custom.submit}}
 {{=form.custom.end}}

 I would like to add the checkbox to this for the Remember me (for 30 
 days) but I can't figure it out for the life of me.  Any help would be 
 greatly appreciated.  I did a lot of research on this already and tried 
 lots of things to make it happen without success.  Please help :)




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


[web2py] UWSGI memory error

2013-11-21 Thread Johann Spies
I am testing out nginx/uwsgi on our production server over an ssh tunnel.

The server is working hard (load average of 9-14 constantly) and I am
running long running queries (some more than 40 minutes).

I have seen this in the logs now and am a bit concerned about it and would
like to know how can I find out what is causing it:

Thu Nov 21 13:58:18 2013 - Memory Error detected
!!!

Traceback (most recent call
last):

  File /home/www-data/web2py/gluon/main.py, line 651, in
app_with_logging
ret[0] = wsgiapp(environ,
responder2)

  File /home/www-data/web2py/gluon/main.py, line 546, in
wsgibase
e = RestrictedError('Framework', '', '',
locals())

  File /home/www-data/web2py/gluon/restricted.py, line 144, in
__init__
self.snapshot =
{}

MemoryError

[pid: 18123|app: 0|req: 26/112] 127.0.0.1 () {48 vars in 1047 bytes} [Thu
Nov 21 13:53:51 2013] GET /init/isi/l1_countrynames$
Thu Nov 21 13:58:18 2013 - ...The work of process 18123 is done.
Seeya!
Thu Nov 21 13:58:19 2013 - Respawned uWSGI worker 1 (new pid:
18992)
Thu Nov 21 13:58:19 2013 - set cpu affinity for worker 1 toThu Nov 21
13:58:19 2013 -  0Thu Nov 21 13:58:19 2013 -
ERROR:web2py:no traceback because template parsing
error
Thu Nov 21 14:01:13 2013 - Memory Error detected
!!!

Traceback (most recent call
last):

  File /home/www-data/web2py/gluon/main.py, line 651, in
app_with_logging
ret[0] = wsgiapp(environ,
responder2)

  File /home/www-data/web2py/gluon/main.py, line 546, in
wsgibase
e = RestrictedError('Framework', '', '',
locals())

  File /home/www-data/web2py/gluon/restricted.py, line 144, in
__init__
self.snapshot =
{}

MemoryError

Regards
Johann

-- 
Because experiencing your loyal love is better than life itself,
my lips will praise you.  (Psalm 63:3)

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


Re: [web2py] Re: DAL db.table.field.contains

2013-11-21 Thread Niphlod
why contains instead of == ?
db(db.Book.Author == Author.id).select(db.Book.ALL, orderby=db.Book.Name)

On Thursday, November 21, 2013 4:31:53 PM UTC+1, Richard wrote:

 Ok, figured out, I think, what happen is that you use index to get record 
 in l (that actually is a pretty bad variable name since it could be 
 confused with 1 - ONE with some fonts)... By using an index you always get 
 only the first row in rows because your l variable is a rows object that 
 contains many row(s)... So you only get the first one each time.

 You don't have to make complicated code like so...

 This should work better :

 thead = THEAD(TR(TH(Author), TH(Books)))
 tr = []
 for Author in AL:
 rows = db(db.Book.Author.contains(Author.id)).select(db.Book.ALL, 
 orderby=db.Book.Name)

 tr.append(TR(TD(Author.Name), TD([row.Name for row in rows])))

 table = TABLE(thead, TBODY(tr))

 return dict(table=table)

 In your view :

 {{=table}}



 Richard





 On Thu, Nov 21, 2013 at 10:16 AM, BlueShadow kevin@gmail.comjavascript:
  wrote:

 def Authors():
 AL=db().select(db.Author.ALL, orderby=db.Author.Name)
 TheList=[]
 for Author in AL:
 l=db(db.Book.Author.contains(Author.id)).select(db.Book.ALL, 
 orderby=db.Book.Name)
 if len(l)0:
 TheList.append([l[0]])
 else:
 TheList.append([])
 return dict(AL=AL,BookList=TheList)
 here is my controller funktion
 and my view:
 table
 {{i=0}}
 {{for Author in AL:}}
 tr
 td{{=Author.Name}}/tdtd/td
 /tr
 {{for b in BookList[i]:}}
 tr
 td/tdtd{{=b.Name}}/td
 /tr
 {{pass}}
 {{i+=1}}
 {{pass}}
 /table
 its supposed to give an alphabetical list of all authors which it does.
 and list all their books (only one is displayed)


  -- 
 Resources:
 - 
 http://web2py.comhttp://www.google.com/url?q=http%3A%2F%2Fweb2py.comsa=Dsntz=1usg=AFQjCNE7x6wflFTAQ11b-FhtMwFfvltXeg
 - 
 http://web2py.com/bookhttp://www.google.com/url?q=http%3A%2F%2Fweb2py.com%2Fbooksa=Dsntz=1usg=AFQjCNFAv433a0RL4nfaYxTbZ4cHi4Q78A(Documentation)
 - 
 http://github.com/web2py/web2pyhttp://www.google.com/url?q=http%3A%2F%2Fgithub.com%2Fweb2py%2Fweb2pysa=Dsntz=1usg=AFQjCNHSwgWBkjuiIoo30014e8BB_iCDag(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/groups/opt_out.




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


Re: [web2py] Re: Virtual Field and sqlform.grid

2013-11-21 Thread Eduardo Cruz
I does not work, sadly.

On Wednesday, November 20, 2013 6:52:56 PM UTC-4, Tim Richardson wrote:

 Also, my experience with virtual fields is limited to returning 
 non-iterable types, not lists. 

 On Thursday, November 21, 2013 9:48:57 AM UTC+11, Tim Richardson wrote:

 I can't see what's wrong.
 Why don't you simply pass the id
 (ie lambda row: get_category_list(row.Post.id)

  

 and then use breakpoints to see if that is working as you expect



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


Re: [web2py] Re: Virtual Field and sqlform.grid

2013-11-21 Thread Massimo Di Pierro
What do you mean by does not work? Can you show a traceback? There should 
be no problem to returning lists.

On Thursday, 21 November 2013 06:29:36 UTC-6, Eduardo Cruz wrote:

 I does not work, sadly.

 On Wednesday, November 20, 2013 6:52:56 PM UTC-4, Tim Richardson wrote:

 Also, my experience with virtual fields is limited to returning 
 non-iterable types, not lists. 

 On Thursday, November 21, 2013 9:48:57 AM UTC+11, Tim Richardson wrote:

 I can't see what's wrong.
 Why don't you simply pass the id
 (ie lambda row: get_category_list(row.Post.id)

  

 and then use breakpoints to see if that is working as you expect



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


Re: [web2py] DAL db.table.field.contains

2013-11-21 Thread Kevin Bethke
each book has one author but I want to select all Books which have Author
id=7


On Thu, Nov 21, 2013 at 3:30 PM, Richard Vézina ml.richard.vez...@gmail.com
 wrote:

 Each book that refer to an Author will only has one Author what the
 problem there?

 You may want to aggregate the book for one author in the same cell of a
 table that is another thing that you could address in different way... Most
 probably iter over all the book for an author and build manually a table
 with web2py helpers...

 Richard




 On Thu, Nov 21, 2013 at 9:20 AM, BlueShadow kevin.bet...@gmail.comwrote:

 Hi
 I got two tables Books and Authors
 Book(Name,List:Author,...)
 each book has at least one author
 now I want to have a list of all the books one Author has written.
 So I came up with this line of code:
 l=db(db.Books.Author.contains(Author.id)).select(db.Books.ALL, orderby=db
 :Books.Name)
 which works but it only gives me one Book per Author.
 I got no clue why this happens I know that I have several Authors which
 have more than one 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/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 a topic in the
 Google Groups web2py-users group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/web2py/bnP-qe7Nwwk/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/groups/opt_out.


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


Re: [web2py] DAL db.table.field.contains

2013-11-21 Thread Richard Vézina
Each book that refer to an Author will only has one Author what the problem
there?

You may want to aggregate the book for one author in the same cell of a
table that is another thing that you could address in different way... Most
probably iter over all the book for an author and build manually a table
with web2py helpers...

Richard




On Thu, Nov 21, 2013 at 9:20 AM, BlueShadow kevin.bet...@gmail.com wrote:

 Hi
 I got two tables Books and Authors
 Book(Name,List:Author,...)
 each book has at least one author
 now I want to have a list of all the books one Author has written.
 So I came up with this line of code:
 l=db(db.Books.Author.contains(Author.id)).select(db.Books.ALL, orderby=db:
 Books.Name)
 which works but it only gives me one Book per Author.
 I got no clue why this happens I know that I have several Authors which
 have more than one 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/groups/opt_out.


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


Re: [web2py] Re: Bootstrap modal window with date widget

2013-11-21 Thread Richard Vézina
z-index

Richard


On Wed, Nov 20, 2013 at 7:55 PM, webpypy ad...@aqar-riyadh.com wrote:

 Hi,

 in version 2.7.4, , the calendar popup pops up behind the modal window.

 Ashraf

 --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)

 ---
 You received this message because you are subscribed to the Google Groups
 web2py-users group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to web2py+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.


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


Re: [web2py] UWSGI memory error

2013-11-21 Thread Roberto De Ioris

 I am testing out nginx/uwsgi on our production server over an ssh tunnel.

 The server is working hard (load average of 9-14 constantly) and I am
 running long running queries (some more than 40 minutes).

 I have seen this in the logs now and am a bit concerned about it and would
 like to know how can I find out what is causing it:

 Thu Nov 21 13:58:18 2013 - Memory Error detected
 !!!



Check if you have limit-as option or some other memory limit in place


-- 
Roberto De Ioris
http://unbit.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/groups/opt_out.


[web2py] Re: DAL db.table.field.contains

2013-11-21 Thread BlueShadow
def Authors():
AL=db().select(db.Author.ALL, orderby=db.Author.Name)
TheList=[]
for Author in AL:
l=db(db.Book.Author.contains(Author.id)).select(db.Book.ALL, orderby
=db.Book.Name)
if len(l)0:
TheList.append([l[0]])
else:
TheList.append([])
return dict(AL=AL,BookList=TheList)
here is my controller funktion
and my view:
table
{{i=0}}
{{for Author in AL:}}
tr
td{{=Author.Name}}/tdtd/td
/tr
{{for b in BookList[i]:}}
tr
td/tdtd{{=b.Name}}/td
/tr
{{pass}}
{{i+=1}}
{{pass}}
/table
its supposed to give an alphabetical list of all authors which it does.
and list all their books (only one is displayed)


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


[web2py] Re: {{=form.custom.widget.fieldname}} for Remember me checkbox

2013-11-21 Thread Michael Gheith
Great, thanks for this Anthony!

On Thursday, November 21, 2013 2:31:18 PM UTC-6, Anthony wrote:

 Because that field is not part of the database table, it isn't part of the 
 SQLFORM and therefore not in form.custom.widget. Instead, it is added to 
 the form DOM after the form has been created. If you want just the checkbox 
 widget, you can do:

 {{=form.element('input#auth_user_remember')}}

 Anthony

 On Thursday, November 21, 2013 2:50:14 PM UTC-5, Michael Gheith wrote:

 My controller is:

 def index():
 return dict(form=auth.login())


 I'm trying to customize the web2py login form in the view like the 
 following:

 {{=form.custom.begin}}
 E-mail: div{{=form.custom.widget.email}}/div
 Password: div{{=form.custom.widget.password}}/div
 Login: {{=form.custom.submit}}
 {{=form.custom.end}}

 I would like to add the checkbox to this for the Remember me (for 30 
 days) but I can't figure it out for the life of me.  Any help would be 
 greatly appreciated.  I did a lot of research on this already and tried 
 lots of things to make it happen without success.  Please help :)




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


[web2py] Re: DAL table definition behaves differently in model ...versus... a module method ??

2013-11-21 Thread Niphlod
generally, as soon as the table is defined and the corresponding .table 
file is not found on the databases/ folder, it will be created.
generally applies to every scenario unless lazy_tables = True. 
In that case, the table is actually defined as soon as there is an attempt 
to access it (that's why they're lazy after all).


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


[web2py] DAL db.table.field.contains

2013-11-21 Thread BlueShadow
Hi
I got two tables Books and Authors
Book(Name,List:Author,...)
each book has at least one author
now I want to have a list of all the books one Author has written.
So I came up with this line of code:
l=db(db.Books.Author.contains(Author.id)).select(db.Books.ALL, orderby=db:
Books.Name)
which works but it only gives me one Book per Author.
I got no clue why this happens I know that I have several Authors which 
have more than one 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/groups/opt_out.


[web2py] version 2.7.4 (windows) cannot edit files in the Browser

2013-11-21 Thread Dreamer
Hi all,
I just updated Web2py from 2.4 to 2.7.4 ; However i cannot edit any file 
(web2py file) in the browser...any reason why that might be happening the 
rest all works jus fine...i am using google chrome as my default browser..

Regards
Cshekhar

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


Re: [web2py] Re: DAL db.table.field.contains

2013-11-21 Thread Richard Vézina
Ok, figured out, I think, what happen is that you use index to get record
in l (that actually is a pretty bad variable name since it could be
confused with 1 - ONE with some fonts)... By using an index you always get
only the first row in rows because your l variable is a rows object that
contains many row(s)... So you only get the first one each time.

You don't have to make complicated code like so...

This should work better :

thead = THEAD(TR(TH(Author), TH(Books)))
tr = []
for Author in AL:
rows = db(db.Book.Author.contains(Author.id)).select(db.Book.ALL,
orderby=db.Book.Name)

tr.append(TR(TD(Author.Name), TD([row.Name for row in rows])))

table = TABLE(thead, TBODY(tr))

return dict(table=table)

In your view :

{{=table}}



Richard





On Thu, Nov 21, 2013 at 10:16 AM, BlueShadow kevin.bet...@gmail.com wrote:

 def Authors():
 AL=db().select(db.Author.ALL, orderby=db.Author.Name)
 TheList=[]
 for Author in AL:
 l=db(db.Book.Author.contains(Author.id)).select(db.Book.ALL,
 orderby=db.Book.Name)
 if len(l)0:
 TheList.append([l[0]])
 else:
 TheList.append([])
 return dict(AL=AL,BookList=TheList)
 here is my controller funktion
 and my view:
 table
 {{i=0}}
 {{for Author in AL:}}
 tr
 td{{=Author.Name}}/tdtd/td
 /tr
 {{for b in BookList[i]:}}
 tr
 td/tdtd{{=b.Name}}/td
 /tr
 {{pass}}
 {{i+=1}}
 {{pass}}
 /table
 its supposed to give an alphabetical list of all authors which it does.
 and list all their books (only one is displayed)


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


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


[web2py] Re: version 2.7.4 (windows) cannot edit files in the Browser

2013-11-21 Thread Dave S
On Thursday, November 21, 2013 5:39:26 PM UTC-8, Dreamer wrote:

 Hi all,
 I just updated Web2py from 2.4 to 2.7.4 ; However i cannot edit any file 
 (web2py file) in the browser...any reason why that might be happening the 
 rest all works jus fine...i am using google chrome as my default browser..



I think I already have this t-shirt:  try clearing your browser cache, so 
that the static .js files get updated on your client.

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


[web2py] {{=form.custom.widget.fieldname}} for Remember me checkbox

2013-11-21 Thread Michael Gheith
My controller is:

def index():
return dict(form=auth.login())


I'm trying to customize the web2py login form in the view like the 
following:

{{=form.custom.begin}}
E-mail: div{{=form.custom.widget.email}}/div
Password: div{{=form.custom.widget.password}}/div
Login: {{=form.custom.submit}}
{{=form.custom.end}}

I would like to add the checkbox to this for the Remember me (for 30 
days) but I can't figure it out for the life of me.  Any help would be 
greatly appreciated.  I did a lot of research on this already and tried 
lots of things to make it happen without success.  Please help :)


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


Re: [web2py] DAL db.table.field.contains

2013-11-21 Thread Richard Vézina
Also, version of web2py and backend you use may be helpfull, if you found a
bug...

Richard



On Thu, Nov 21, 2013 at 10:08 AM, Richard Vézina 
ml.richard.vez...@gmail.com wrote:

 .contains() should do that...

 Could you post model and controller, the issue is maybe somewhere else in
 your code.

 Richard


 On Thu, Nov 21, 2013 at 9:59 AM, Kevin Bethke kevin.bet...@gmail.comwrote:

 each book has one author but I want to select all Books which have Author
 id=7


 On Thu, Nov 21, 2013 at 3:30 PM, Richard Vézina 
 ml.richard.vez...@gmail.com wrote:

 Each book that refer to an Author will only has one Author what the
 problem there?

 You may want to aggregate the book for one author in the same cell of a
 table that is another thing that you could address in different way... Most
 probably iter over all the book for an author and build manually a table
 with web2py helpers...

 Richard




 On Thu, Nov 21, 2013 at 9:20 AM, BlueShadow kevin.bet...@gmail.comwrote:

 Hi
 I got two tables Books and Authors
 Book(Name,List:Author,...)
 each book has at least one author
 now I want to have a list of all the books one Author has written.
 So I came up with this line of code:
 l=db(db.Books.Author.contains(Author.id)).select(db.Books.ALL, orderby=
 db:Books.Name)
 which works but it only gives me one Book per Author.
 I got no clue why this happens I know that I have several Authors which
 have more than one 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/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 a topic in the
 Google Groups web2py-users group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/web2py/bnP-qe7Nwwk/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/groups/opt_out.


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




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


Re: [web2py] UWSGI memory error

2013-11-21 Thread Johann Spies
Thanks.

I have missed that one.  I have doubled it now from 512 to 1024.

Regards
Johann


On 21 November 2013 15:00, Roberto De Ioris robe...@unbit.it wrote:


  I am testing out nginx/uwsgi on our production server over an ssh tunnel.
 
  The server is working hard (load average of 9-14 constantly) and I am
  running long running queries (some more than 40 minutes).
 
  I have seen this in the logs now and am a bit concerned about it and
 would
  like to know how can I find out what is causing it:
 
  Thu Nov 21 13:58:18 2013 - Memory Error detected
  !!!
 


 Check if you have limit-as option or some other memory limit in place


 --
 Roberto De Ioris
 http://unbit.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/groups/opt_out.




-- 
Because experiencing your loyal love is better than life itself,
my lips will praise you.  (Psalm 63:3)

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


Re: [web2py] DAL db.table.field.contains

2013-11-21 Thread Richard Vézina
.contains() should do that...

Could you post model and controller, the issue is maybe somewhere else in
your code.

Richard


On Thu, Nov 21, 2013 at 9:59 AM, Kevin Bethke kevin.bet...@gmail.comwrote:

 each book has one author but I want to select all Books which have Author
 id=7


 On Thu, Nov 21, 2013 at 3:30 PM, Richard Vézina 
 ml.richard.vez...@gmail.com wrote:

 Each book that refer to an Author will only has one Author what the
 problem there?

 You may want to aggregate the book for one author in the same cell of a
 table that is another thing that you could address in different way... Most
 probably iter over all the book for an author and build manually a table
 with web2py helpers...

 Richard




 On Thu, Nov 21, 2013 at 9:20 AM, BlueShadow kevin.bet...@gmail.comwrote:

 Hi
 I got two tables Books and Authors
 Book(Name,List:Author,...)
 each book has at least one author
 now I want to have a list of all the books one Author has written.
 So I came up with this line of code:
 l=db(db.Books.Author.contains(Author.id)).select(db.Books.ALL, orderby=
 db:Books.Name)
 which works but it only gives me one Book per Author.
 I got no clue why this happens I know that I have several Authors which
 have more than one 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/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 a topic in the
 Google Groups web2py-users group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/web2py/bnP-qe7Nwwk/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/groups/opt_out.


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


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


Re: [web2py] Re: Virtual Field and sqlform.grid

2013-11-21 Thread Tim Richardson


On Thursday, November 21, 2013 11:29:36 PM UTC+11, Eduardo Cruz wrote:

 I does not work, sadly.


Where does it fail? 

is the id passed to the function ok? 


 

 On Wednesday, November 20, 2013 6:52:56 PM UTC-4, Tim Richardson wrote:

 Also, my experience with virtual fields is limited to returning 
 non-iterable types, not lists. 

 On Thursday, November 21, 2013 9:48:57 AM UTC+11, Tim Richardson wrote:

 I can't see what's wrong.
 Why don't you simply pass the id
 (ie lambda row: get_category_list(row.Post.id)

  

 and then use breakpoints to see if that is working as you expect



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


[web2py] Form self-submit broken after redirection

2013-11-21 Thread weheh
I couldn't find this in my search of threads, so apologies if already 
answered. 

I'm opening a dialog and putting an ordinary form in the dialog. If the 
user presses the form's submit button, the form's controller gets called 
and the form.process().accepted step gets executed. Good so far.

However, if the user refreshes the browser, I cleverly have the main page 
load and then detect that the former state of the system and automatically 
open the dialog and redirect its contents to the form's controller. So the 
user returns to the same place as they were prior to refresh. Now, when the 
user presses the submit button, the form's controller does not get 
executed. Instead, the controller that redirected to the form gets 
executed. The result is the form gets redrawn and not submitted. So from 
the user's perspective, nothing happens when the Submit button is pressed 
after reloading the page.

How to disable this behavior and have the desired controller get executed? 
Do I need to submit the form via ajax or muck with the requesting URL?

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