[web2py] multiple forms created by for in:

2014-05-22 Thread 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(),

[web2py] Re: How to improve performance for db queries

2014-05-22 Thread Anthony
Would help to see some code. 4-5 seconds sounds much too long. You might also look into http://dev.s-cubism.com/plugin_lazy_options_widget. Anthony On Thursday, May 22, 2014 12:17:42 AM UTC-4, Sarbjit wrote: Hi, I am using cascading drop-down based on the slice posted on

[web2py] Re: multiple forms created by for in:

2014-05-22 Thread Anthony
You could do something like form.process(formname='form%s' % row.id). But then you don't want to have to create and process all the forms when just a single form is submitted, so include some logic to check for a form submission, and in that case, just construct the single form that has been

[web2py] Re: multiple forms created by for in:

2014-05-22 Thread Anthony
Also, you can't keep overwriting the form variable in your loop. Instead, you'll want to create a list of forms to send to the view. On Thursday, May 22, 2014 7:21:34 AM UTC-4, Anthony wrote: You could do something like form.process(formname='form%s' % row.id). But then you don't want to

[web2py] Web2py Hosting

2014-05-22 Thread 'sasogeek' via web2py-users
I've been looking around for python hosting websites that I can get my web2py deployed on but none of them is easy to work with. I'd rather prefer the ease to work on my application than having the headache of getting online, which really should be easy to do. I tried the solution given me in

Re: [web2py] Web2py Hosting

2014-05-22 Thread Yoel Benitez Fonseca
pythonanywhre !!! 2014-05-22 6:26 GMT-05:00 'sasogeek' via web2py-users web2py@googlegroups.com: I've been looking around for python hosting websites that I can get my web2py deployed on but none of them is easy to work with. I'd rather prefer the ease to work on my application than having the

[web2py] Re: Web2py Hosting

2014-05-22 Thread Anthony
I've been happy with Digital Ocean, though it probably takes a bit more effort to set up than Pythonanywhere. Anthony On Thursday, May 22, 2014 7:26:13 AM UTC-4, sasogeek wrote: I've been looking around for python hosting websites that I can get my web2py deployed on but none of them is

[web2py] Re: How to improve performance for db queries

2014-05-22 Thread Sarbjit
Hi Anthony, Code is almost identical to the code posted in slice with change in field names and number of records. Only additonal difference is that I am using orderby in the query before returing the results. Surprisingly, sometime the result appears fast (within 2-3 seconds) but some time

[web2py] Re: How to improve performance for db queries

2014-05-22 Thread Sarbjit
Hi Anthony, Code is almost identical to the code posted in slice with change in field names and number of records. Only additonal difference is that I am using orderby in the query before returing the results. Surprisingly, sometime the result appears fast (within 2-3 seconds) but some time

Re: [web2py] URL() and HTTPS

2014-05-22 Thread Richard Vézina
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

Re: [web2py] Re: How to improve performance for db queries

2014-05-22 Thread Richard Vézina
Do you have index on your table? Richard On Thu, May 22, 2014 at 8:39 AM, Sarbjit sarbjit1...@gmail.com wrote: Hi Anthony, Code is almost identical to the code posted in slice with change in field names and number of records. Only additonal difference is that I am using orderby in the

Re: [web2py] Post Request Data

2014-05-22 Thread Cory
On Wednesday, May 21, 2014 6:35:31 AM UTC-7, marco mansilla wrote: El Tue, 20 May 2014 15:27:29 -0700 (PDT) Cory cory...@gmail.com javascript: escribió: Hi, I am trying to access the contents of a post request made to a url on my website. To test this I have been trying to send

[web2py] Re: global name 'db' is not defined

2014-05-22 Thread Henrik Holm
I have a model file 'application.py' wherein I define some tables, and it is executed before the db.py file. Thus I get the name 'db' is not defined error. For now I have renamed the file to x_application.py, but this seems like kind of a kludge. Is there a way to work around the alphabetical

[web2py] How to import python functions

2014-05-22 Thread Maurice Waka
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) -

[web2py] Re: How do I define this item

2014-05-22 Thread Maurice Waka
Thanks! it worked On Wednesday, May 21, 2014 1:01:46 PM UTC+3, Maurice Waka wrote: When I iterate through the controller as this: def return_post: form = SQLFORM(db.post) for c in form: form1= post.body form2 = form1.split()return dict(form2=form2) I get an error

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

2014-05-22 Thread thehuman trashcan
Hi Andrew, The URL line now says: d3.json({{=URL('default', 'dashboard_data.json', scheme=True, host=True)}} , function (data) { This doesn't make the information come back though. Does it matter that I am using pythonanywhere - it looks like they have https:// in place? Thanks!! On

[web2py] Translate html file to python file

2014-05-22 Thread ilyas toxanbayev
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:

[web2py] Re: How to improve performance for db queries

2014-05-22 Thread Anthony
Would still help to see your specific model code. Is the field in question a reference field with a represent attribute? If so, you'll get separate queries for each item in order to lookup the represent value. How many records in the table? Do you have an index on the field being searched? If

[web2py] Re: How to improve performance for db queries

2014-05-22 Thread Sarbjit
Below is the snippets from code (I have changed few field names as I can't share the exact field names) -- Data base db.define_table('Table1', Field('Release'), format='%(Release)s') db.define_table('Table2',

Re: [web2py] Re: Web2py Hosting

2014-05-22 Thread António Ramos
I have an account with webfaction Its is very good. For 20 usd i get 100GB disk space and 600GB/Month traffic and 1GB RAM Also the tickets are replied quickly. Also avaliable some script to setup a lot of frameworks , one of them is for web2py/apache. So far very good. Regards António

[web2py] Re: How to improve performance for db queries

2014-05-22 Thread Anthony
First, you can simplify your function as follows: def getResults(): tab2results = db(db.Table2.Release == request.vars.release_name).select( db.Table2.id, db.Table2.Year, orderby=~db.Table2.id) return SELECT([OPTION(r.Year, _value=r.id) for r in tab2results],

[web2py] Re: How to improve performance for db queries

2014-05-22 Thread 黄祥
perhaps you can follow the books advise on :

[web2py] Re: How to improve performance for db queries

2014-05-22 Thread Sarbjit
Thanks Anthony, I will try and will update. I am new to web2py (web apps in general). Could you please provide me an example on how to create index on table and once created, what changes i have to do in controller, do i need to change the getResults function? -Sarbjit On Thursday, May 22,

Re: [web2py] Re: How to improve performance for db queries

2014-05-22 Thread Kiran Subbaraman
In addition to this, and assuming that the data doesn't change frequently (days vs minutes), maybe a select-cache, with TTL of 24 hours would help? http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Caching-selects Kiran

Re: [web2py] Re: How to improve performance for db queries

2014-05-22 Thread Kiran Subbaraman
Sarbjit, The index creation is something that you would do on the database. Web2py doesn't have a role to play there. For postgres: http://www.postgresql.org/docs/9.3/static/sql-createindex.html Kiran Subbaraman http://subbaraman.wordpress.com/about/

Re: [web2py] How to import python functions

2014-05-22 Thread Marco Mansilla
El Wed, 21 May 2014 22:17:07 -0700 (PDT) Maurice Waka mauricew...@gmail.com escribió: 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

[web2py] Re: multiple forms created by for in:

2014-05-22 Thread Lucas Schreiber
but how can i create a list of forms? this code does not work since form is a string ( or, at least, no int, double float,...) for row in row_db: form_element=FORM('Your name:', SELECT(), INPUT(_type='submit', _value = 'HERE'))

Re: [web2py] Re: How to improve performance for db queries

2014-05-22 Thread Sarbjit
Yes, In-fact the data is expected to change once in week. Regarding Index on table, I know DAL doesn't provides a direct way of doing it, my question is once i have created an index on my table, do i need to modify anything in my controller? -Sarbjit On Thursday, May 22, 2014 7:54:54 PM

Re: [web2py] Post Request Data

2014-05-22 Thread Marco Mansilla
El Wed, 21 May 2014 08:54:50 -0700 (PDT) Cory coryb...@gmail.com escribió: On Wednesday, May 21, 2014 6:35:31 AM UTC-7, marco mansilla wrote: El Tue, 20 May 2014 15:27:29 -0700 (PDT) Cory cory...@gmail.com javascript: escribió: Hi, I am trying to access the contents of a

Re: [web2py] Re: How to improve performance for db queries

2014-05-22 Thread Anthony
On Thursday, May 22, 2014 10:31:51 AM UTC-4, Sarbjit wrote: Yes, In-fact the data is expected to change once in week. Regarding Index on table, I know DAL doesn't provides a direct way of doing it, my question is once i have created an index on my table, do i need to modify anything in

[web2py] Re: multiple forms created by for in:

2014-05-22 Thread Anthony
form_list = [] for row in row_db: form_list.append(FORM(...)) You're not making one big form -- it is a list of separate forms. You would then have to iterate over the list in the view in order to display them all. Anthony On Thursday, May 22, 2014 10:29:30 AM UTC-4, Lucas

[web2py] Re: How to import python functions

2014-05-22 Thread Anthony
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

Re: [web2py] How to import python functions

2014-05-22 Thread Maurice Waka
I dont understand, which fileam also using python2.7...so the print is not :print(mesage...') On Thursday, May 22, 2014 5:31:12 PM UTC+3, marco mansilla wrote: El Wed, 21 May 2014 22:17:07 -0700 (PDT) Maurice Waka mauri...@gmail.com javascript: escribió: I have this example code in

[web2py] Open static folder to be indexed by Search Engine

2014-05-22 Thread Craig Field
How's it going? I'd like the contents of a folder to be found by search Engines. New static .html files are automatically created daily with randomized names. The folder would be /static/html/ It doesn't appear to be currently found. Are the security features of Web2py preventing this? Is there

[web2py] Re: Web2py Hosting

2014-05-22 Thread Annet
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

Re: [web2py] Re: Web2py Hosting

2014-05-22 Thread Adnan Smajlovic
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

[web2py] Re: AWS Elastic Beanstalk installation Recipe

2014-05-22 Thread Diogo Munaro
Hey Massimo, and how could I replace command: django-admin.py syncdb --noinput ? I need migrate=False because I have a loadbalancer with elastic beanstalk Em quinta-feira, 25 de julho de 2013 11h45min05s UTC-3, Aladdin Teng escreveu: Thank you very much. On Thursday, July 25, 2013

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

2014-05-22 Thread Mandar Vaze / मंदार वझे
Sorry for the delayed response. On Wed, May 14, 2014 at 12:14 PM, Niphlod niph...@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

Re: [web2py] How to import python functions

2014-05-22 Thread Anthony
On Thursday, May 22, 2014 10:52:02 AM UTC-4, Maurice Waka wrote: I dont understand, which fileam also using python2.7...so the print is not :print(mesage...') In Python 2.x, print is a statement, not a function. When you do: print(message) it looks like you're calling a function, but I

[web2py] Re: How to improve performance for db queries

2014-05-22 Thread Derek
your print statement is probably making this a lot slower than it needs to be. console output is slow. Also, you may want to take a look at my cascading dropdowns since I do it in a more web2py way. It may also be easier to understand. You shouldn't create the html 'by hand' like you are doing

[web2py] Re: Open static folder to be indexed by Search Engine

2014-05-22 Thread Derek
check your robots.txt file. also, I don't believe that directory contents will be listed. You would probably want to create a sitemap that has links to all those html files and submit your sitemap to the crawlers. If you are generating files with random names in hopes that search engines are

[web2py] Re: global name 'db' is not defined

2014-05-22 Thread Derek
rename db.py to 0.py. it doesn't have to be named db.py. On Wednesday, May 21, 2014 9:20:16 AM UTC-7, Henrik Holm wrote: I have a model file 'application.py' wherein I define some tables, and it is executed before the db.py file. Thus I get the name 'db' is not defined error. For now I

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

2014-05-22 Thread Derek
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... On Thursday,

[web2py] Re: global name 'db' is not defined

2014-05-22 Thread Dave S
On Thursday, May 22, 2014 12:53:34 PM UTC-7, Derek wrote: rename db.py to 0.py. it doesn't have to be named db.py. Isn't that the same sort of kludge as application.py --- x_application.py? But to answer Henrik ... no, there's no workaround other than observing the naming conventions. I

[web2py] Re: global name 'db' is not defined

2014-05-22 Thread Anthony
For now I have renamed the file to x_application.py, but this seems like kind of a kludge. Is there a way to work around the alphabetical order restriction? What kind of workaround do you envision? Anthony -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) -

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

2014-05-22 Thread Andrew W
I'm not at a desktop machine so I'll be brief. D3 expects an array, you have provided a dict. When you reference data such as in the foreach, try data.dashboard_data which will reference the array. Syntax is probably not quite correct. Also, if you're not sure add console.log stmts to show the

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

2014-05-22 Thread Andrew W
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