[web2py] Function in view in model less app

2014-11-30 Thread Ruud Schroen
Hi there, I'm building a webapp with the model less app approach by Bruno Rocha and I stumble upon a problem. Usually when you use models you can define function which can later be used inside a view. How would I do this with a model less approach? -- Resources: - http://web2py.com -

[web2py] how to get just one instance of a complex class ?

2014-11-30 Thread Stef Mientki
hello, I've a class, that reads a huge file and parses it. Therefor I want just one instance per session or even one over all sessions. # The next code (placed in controler default.py) generates an error if session.Book_Loaded is None : session.Book_Loaded = PuntHoofd_support.PuntHoofd_Doc (

[web2py] Re: Function in view in model less app

2014-11-30 Thread Niphlod
you're the one choosing an app without models :P there's nothing on modules that is available globally on views if not a model. That being said, the model-less approach was done in a time where the thing that hurted performances was table definitions, that later got the possibility to be

[web2py] Re: are expired session files deleted automatically?

2014-11-30 Thread Niphlod
folders do not create a performance issue on ntfs. if you want to keep it clean for aestethical reasons, do it with another step in your batch... On Sunday, November 30, 2014 8:23:50 AM UTC+1, Dmitry Ermolaev wrote: but folders not deleted (( I make .bat file for WIN ===

[web2py] Re: jQuery - Examples from book not working.

2014-11-30 Thread Niphlod
something extremely wrong is going on with your javascript. the ready call is pretty much the default way of handling events once the document has been loaded. On Sunday, November 30, 2014 7:16:04 AM UTC+1, Jeremiah Peterson wrote: Here's the example from the book, which isn't working for me.

Re: [web2py] Re: Function in view in model less app

2014-11-30 Thread Ruud Schroen
Hmm i didnt't know about that, i really need to check out lazy_tables. Saves me alot of time :P thanks for the info Op 30-nov.-2014 13:38 schreef Niphlod niph...@gmail.com: you're the one choosing an app without models :P there's nothing on modules that is available globally on views if not a

[web2py] Re: add task and wait the result

2014-11-30 Thread Niphlod
when nothing is going wrong, and with default values, you can expect to queue a task and have it assigned in 15 seconds. if that's not the case, something is going wrong (other tasks are being processed, workers not ready, db contention, etc etc etc) On Friday, November 28, 2014 8:02:15 PM

[web2py] Re: web2py with bootstrap-slider bootstrap-typeahead

2014-11-30 Thread Niphlod
use some javascript 101 course before digging into javascript. One issue with your code is that you're not waiting the document to be ready before calling the javascript bit. Use $(document).ready(function() {}) to wrap any javascript in the page. On Friday, November 28, 2014 8:49:35 PM UTC+1,

Re: [web2py] Re: Web2py's included connection pooling VS external pooling software

2014-11-30 Thread Niphlod
did you restart the webserver ? I don't think that changing pool_size at runtime when connections are still open will make the number of active connection dropped. On Friday, November 28, 2014 8:48:07 PM UTC+1, Lisandro wrote: Mmm... I see. That was my understanding in the first place. At

[web2py] Re: add task and wait the result

2014-11-30 Thread nick name
Is that true even with immediate=True? If so, what is the recommended way to reduce this to 0.5 seconds or so? I have an app in which a user requests somethng; that request launches 1-10 other web requests, and the user keeps refreshing until they all complete for the summarized result. (I will

[web2py] Function in view in model less app

2014-11-30 Thread Anthony
Of course, if you define a function in a module, you will need to explicitly import it. You can import it in a model file if you like. Anthony -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) -

[web2py] Re: jQuery - Examples from book not working.

2014-11-30 Thread Jeremiah Peterson
I did load the example in a new dummy app and it works like it should. Any idea what would have changed, or what I could look at in my real app? Could this template I used have messed something up? Thanks for looking. On Sunday, November 30, 2014 6:40:52 AM UTC-6, Niphlod wrote: something

Re: [web2py] Re: Web2py's included connection pooling VS external pooling software

2014-11-30 Thread Lisandro Rostagno
Yes in deed. I've restarted the webserver and the database server. Recently I've tried setting pool_size to 1 for every app, that is, for every website. Restarted postgresql and webserver (lighttpd). And then I used this SQL statement to check the total count of connections for every database (or

[web2py] Re: how to get just one instance of a complex class ?

2014-11-30 Thread Anthony
I think your options are: - Make the object pickleable https://docs.python.org/2/library/pickle.html#pickling-and-unpickling-extension-types and store it in the session (this is only necessary if you really need a separate object for each user's session). - Store the object in

[web2py] Re: jQuery - Examples from book not working.

2014-11-30 Thread Anthony
Do you accidentally load jQuery twice? On Sunday, November 30, 2014 9:28:38 AM UTC-5, Jeremiah Peterson wrote: I did load the example in a new dummy app and it works like it should. Any idea what would have changed, or what I could look at in my real app? Could this template I used have

[web2py] Re: jQuery - Examples from book not working.

2014-11-30 Thread Jeremiah Peterson
I don't believe so. In my app that I'm working on where the .ready isn't working, I've created a completely new controller and view with nothing in it except for the example code and the example doesn't work there either on that. On Sunday, November 30, 2014 9:28:30 AM UTC-6, Anthony wrote:

[web2py] Re: jQuery - Examples from book not working.

2014-11-30 Thread Jeremiah Peterson
It seems to be this layout that's causing the issue. http://www.web2py.com/layouts/static/plugin_layouts/layouts/Emporium/index.html 1. I created a new app and just used the generic jquery example code and it works great. 2. I upload that layout and then directly after it no longer works. I

[web2py] Re: jQuery - Examples from book not working.

2014-11-30 Thread Jeremiah Peterson
@Anthony, Thanks for the tip. I found this in the layout.html. Since I'm not using any drop down menus I've just removed it and everything seems to be working as expected now. script jQuery(document).ready(function(){jQuery('ul.web2py-menu').superfish({delay:400});}); /script I think

Re: [web2py] Re: Web2py's included connection pooling VS external pooling software

2014-11-30 Thread Michele Comitini
pool_size==number of threads in a web2py process. I suggest to work around the problem by setting the number of threads to 1 in you flup server. I.e. no threading. You should also see smoother performance across applications on higher loads. 2014-11-30 15:51 GMT+01:00 Lisandro Rostagno

Re: [web2py] Re: Web2py's included connection pooling VS external pooling software

2014-11-30 Thread Michele Comitini
p.s. by no threading I mean to use processes in place of threads. The number of processes is something you must tune based on server resources, 2xn where n is the number of cores is a safe choice. 2014-11-30 20:04 GMT+01:00 Michele Comitini michele.comit...@gmail.com: pool_size==number of

[web2py] PostgreSQL migrate / fake_migrate_all failure with relation does not exists

2014-11-30 Thread Tom Øyvind Hogstad
My migrations suddenly failed with Error: class 'gluon.contrib.pg8000.errors.ProgrammingError' ('ERROR', '42P01', 'relation wiki_page does not exist') This will happen for any relation trying to commenting them out etc. Running a fake_migrate_all and the problem still persists, so I can not

[web2py] Form input show decimal fields with 4 decimals? (How to format input field in forms?)

2014-11-30 Thread Tom Øyvind Hogstad
I have the following field declaration Field('test_BOF', 'decimal(10,2)', label='BOF (mg/l)', requires=IS_EMPTY_OR(IS_DECIMAL_IN_RANGE(dot=',')) In a SQLFORM this vil output as a number with a for numbered fraction e.g. 12,3000 input class=decimal id=plant_service_test_BOF

[web2py] Re: Forking/multiprocessing bug triggered by Web2Py launch directory

2014-11-30 Thread Roshan Mathews
It's been a month since my post, so I was wondering if anyone has any hints they might want to share about this. Thanks, rm On Friday, 31 October 2014 19:32:06 UTC+5:30, Roshan Mathews wrote: Hi, I have a weird bug that seems to be triggered when using the multiprocessing module, if

[web2py] form warning

2014-11-30 Thread Alen Cerovic
how to make a warning message in form based on some condition but allow to proceed validator? thnx -- 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

[web2py] Re: Dynamic Upload Uploadfolder

2014-11-30 Thread Massimo Di Pierro
You cannot do this uploadfolder= lambda r:... But this is a chicken-egg problem. You want r to be the row but the row is not created until after the file is uploaded therefore you cannot specify the upload folder as function of something that happens after. Please explain to us in english of

[web2py] Re: Dynamic Upload Uploadfolder

2014-11-30 Thread James Burke
Thank you for your help Massimo. My model is defined as follows: ## Repository db.define_table('repository', Field('name', type='string'), Field('directory', default='applications/init/uploads'), format='%(name)s') ## Workbench - workbenches stored in the repository

[web2py] Re: form warning

2014-11-30 Thread Massimo Di Pierro
It depends on where you want to do. Personally I would not do this inside the validators. I would instead implement the checks after the form is accepted (since you want it to proceed anyway) form = SQLFORM.factory(Field('number','double')) if form.process().accepted: if not

Re: [web2py] PostgreSQL migrate / fake_migrate_all failure with relation does not exists

2014-11-30 Thread Johann Spies
My migrations suddenly failed with Error: class 'gluon.contrib.pg8000.errors.ProgrammingError' ('ERROR', '42P01', 'relation wiki_page does not exist') If the relation does exist in Postgresql (which is why you want to migrate), try and move the related file in /app/databases/ for that

Re: [web2py] Re: multiple select plugin and list reference

2014-11-30 Thread Johann Spies
On 28 November 2014 at 13:13, Kevin Bethke kevin.bet...@gmail.com wrote: How do I open up the console to check for javascript errors? If you use Firefox, open Firebug (you may have to install it) in the developer menu. Chrome also have a menu item for developer tools and so Opera. Regards

[web2py] syntax for making var appear in view

2014-11-30 Thread Alex Glaros
Question one: This is in controller: vars=dict(Alex=99) This is in view: brAlex = {{ =response.get_vars.Alex}} br error is: 'NoneType' object has no attribute 'Alex'. I assume this is not the way to get a var to show up in view. What is correct syntax? Question two: bAlex var is in