[web2py:15497] Re: Does a web2py app have the equivalent of main()?

2009-01-27 Thread Timothy Farrell
I'm not sure what you're getting at here, but if you consider Python is a very dynamic language. Whenever a module is imported, it is essentially run in it's own namespace. In the case of your plugin (driver) system (which I haven't looked at yet), you could have an SQLDBFactory function tha

[web2py:15498] Re: Does a web2py app have the equivalent of main()?

2009-01-27 Thread billf
Tim Thanks for your response. I'm still a Python newbie, especially with some of the more esoteric stuff. With the plugin demo I have code in sql.py outside any class that appears to only run the once (when sql.py is imported I assume) and, as you suggest, it loads details of the available db-pl

[web2py:15499] Re: Does a web2py app have the equivalent of main()?

2009-01-27 Thread achipa
The problem is that first start is a very relative term depending on how you run web2py, it's not the same for standalone/cherrypy, CGI, MOD_WSGI, parallel versions of these, etc. This means that your startup code could be executed in a whole lot of places, not always where you want it. You also h

[web2py:15500] Re: Does a web2py app have the equivalent of main()?

2009-01-27 Thread Timothy Farrell
I think you're confusing things see below achipa wrote: > The problem is that first start is a very relative term depending on > how you run web2py, it's not the same for standalone/cherrypy, CGI, > MOD_WSGI, parallel versions of these, etc. Correct...sorta. We really have three categories h

[web2py:15501] Re: Does a web2py app have the equivalent of main()?

2009-01-27 Thread Timothy Farrell
OK, so I've looked at it. I like it. Achipa is right that you'll have to protect drivers[] and known_plugins{} (possibly others) during load-time. I think you should just use a lock-type rather than cache.ram(). Cool, while web2py already supports many large databases, this will certainly c

[web2py:15502] Re: Does a web2py app have the equivalent of main()?

2009-01-27 Thread achipa
One itsy-bitsy note about the persistence of WSGI/FCGI/standalone - out of these, only the standalone has serious persistence. WSGI and FCGI can (and will) get restarted on the web server's whim (some webservers come with a predefined number of requests after which they restart the process, just i

[web2py:15503] Re: Does a web2py app have the equivalent of main()?

2009-01-27 Thread Robin B
hey bill, try this: # in models/0.py: def mod_import(name): mod = __import__(name) for part in name.split('.')[1:]: mod = getattr(mod,part) return mod config = mod_import('applications. %s.modules.config'%request.application) # in modules/config.py import datetime boottime = datetim

[web2py:15504] db operations seems slow in a web2py on GAE

2009-01-27 Thread Iceberg
Hi pals, Don't know whether this is a web2py problem or a GAE problem, anyway I still post it here and hope to get some kindly hints. I started my GAE experience just today. I managed to upload web2py 1.55.2 and its welcome application and later one of my homebrew "no-db- required" application,

[web2py:15505] Re: Does a web2py app have the equivalent of main()?

2009-01-27 Thread Timothy Farrell
Yes, but WSGI/FCGI web-servers always have several new processes ready for requests rather than having to wait for a process to start as soon as a request is received. Be careful about the multiple processes thing. Separate processes can import the same module and not be sharing data or code

[web2py:15506] Re: db operations seems slow in a web2py on GAE

2009-01-27 Thread Robin B
Hey, > Did I miss something? Do you guys encounter same problem when playing > with GAE? Does your application successfully insert hundreds of > records during one request? Any feedback will be highly appreciated! On GAE, writes are very expensive because each record is actually written to disk,

[web2py:15507] Re: Is there anyway to have multiple forms on a page without explicitly defining them in the controller?

2009-01-27 Thread jlegler
I tried that last night which fixed the cosmetic issue of it always posting the update message to the top div; however, it still only updates the first record. At least now it says it updates the first record in the correct div though. ;) I am fundamentally misunderstanding how the submit button

[web2py:15508] More info in errors

2009-01-27 Thread Tamas
Hello, I'm using web2py and find it very nice. However, I would like to request a feature: it would be very useful if the tickets that are generated when an error happens would not only have the call stack and the exception that occured, but also the request.vars parameters (or even the whole req

[web2py:15509] Re: Is there anyway to have multiple forms on a page without explicitly defining them in the controller?

2009-01-27 Thread jlegler
I think I may have figured out a way to do it. Let me play around with it a bit and I will get back to you. Thanks for all your help. -Jason On Jan 27, 9:00 am, jlegler wrote: > I tried that last night which fixed the cosmetic issue of it always > posting the update message to the top div; ho

[web2py:15510] Re: Does a web2py app have the equivalent of main()?

2009-01-27 Thread mdipierro
I am skeptical about initialization code being initialized by the app because it may take time and web server may kill it. My approach is to create an initialization script in private and run it with web2py -S app -M -R private/script.py On Jan 27, 10:24 am, Timothy Farrell wrote: > Yes, but W

[web2py:15511] Re: More info in errors

2009-01-27 Thread mdipierro
Yes. Good point. Will look into it. Massimo On Jan 27, 11:16 am, Tamas wrote: > Hello, > > I'm using web2py and find it very nice. > However, I would like to request a feature: it would be very useful if > the tickets that are generated when an error happens would not only > have the call stack

[web2py:15512] Servers is blocked while "Checking for upgrades..." ?

2009-01-27 Thread hofmanndavid
When I shut down my network connection it finally detects that there was not possible to check for updates, but when I enable my connexion again, somehow it checks again for updates, and seems to block any subsequent request to the server I am sorry if I am wrong, it is my first time using this f

[web2py:15513] Re: Does a web2py app have the equivalent of main()?

2009-01-27 Thread Timothy Farrell
I didn't think we were talking on the app level. mdipierro wrote: > I am skeptical about initialization code being initialized by the app > because it may take time and web server may kill it. > > My approach is to create an initialization script in private and run > it with > > web2py -S app -M

[web2py:15514] Re: Servers is blocked while "Checking for upgrades..." ?

2009-01-27 Thread mdipierro
Thank you for your comments. Which version are you using? Massimo On Jan 27, 10:05 am, hofmanndavid wrote: > When I shut down my network connection it finally detects that there > was not possible to check for updates, but when I enable my connexion > again, somehow it checks again for updates,

[web2py:15515] Re: Does a web2py app have the equivalent of main()?

2009-01-27 Thread mdipierro
I oppose any initialization that is not at the app level. It would introduces hidden dependencies in the apps. Massimo On Jan 27, 12:01 pm, Timothy Farrell wrote: > I didn't think we were talking on the app level. > > > > mdipierro wrote: > > I am skeptical about initialization code being initi

[web2py:15516] Re: Session variable

2009-01-27 Thread annet
Massimo and Julius, Thanks for your replies, using the new generic.html pointed me in the right direction to solve the problem. Best regards, Annet. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py Web Fram

[web2py:15517] Re: Does a web2py app have the equivalent of main()?

2009-01-27 Thread Timothy Farrell
I think you're misunderstanding. We're talking about the database driver code that Bill coded together. This has nothing to do with any particular app. Rather how and when sql.py starts up. mdipierro wrote: > I oppose any initialization that is not at the app level. It would > introduces hid

[web2py:15518] Re: Servers is blocked while "Checking for upgrades..." ?

2009-01-27 Thread hofmanndavid
well, I just downloaded the latest for windows from this link http://mdp.cti.depaul.edu/examples/default/download 1.55.2 i think I have python 2.6.1 installed On Jan 27, 3:01 pm, mdipierro wrote: > Thank you for your comments. Which version are you using? > > Massimo > > On Jan 27, 10:05 am, ho

[web2py:15519] Re: Is there anyway to have multiple forms on a page without explicitly defining them in the controller?

2009-01-27 Thread jlegler
Yea, I got it. What I did was set up the form to generate unique ids for every form element being rendered and then in the controller class I take the number off of variable names so that the SQLFORM doesn't complain about the form being modified. I am sure there is a more elegant way to do it;

[web2py:15520] Re: Does a web2py app have the equivalent of main()?

2009-01-27 Thread billf
My original question was about app-level configuration - I maybe confused things by my post #3. The plugin stuff is really a separate tho' related thread. Re Massimo's post re "web2py -S app -M -R private/script.py" How does this work if you have an instance of web2py with several active appli

[web2py:15521] Re: Servers is blocked while "Checking for upgrades..." ?

2009-01-27 Thread mdipierro
You should be using python 2.5 since 2.6 is not supported although it should work fine. I believe what is happening is not that web server is blocking. But your admin session is locked until web2py can verify the current version. Is this when you have no network connection? Massimo On Jan 27,

[web2py:15522] Re: Does a web2py app have the equivalent of main()?

2009-01-27 Thread mdipierro
Right now you can run the script manually once for each app. Massimo On Jan 27, 12:52 pm, billf wrote: > My original question was about app-level configuration - I maybe > confused things by my post #3.  The plugin stuff is really a separate > tho' related thread. > > Re Massimo's post re  "web

[web2py:15523] Re: Does a web2py app have the equivalent of main()?

2009-01-27 Thread achipa
Just a thought - we could hook an application level startup script (or controller function) into cron. As cron already takes care of cgi/ fastcgi/wsgi/cherrypy, timings and some threading peculiarities it shouldn't be too hard to integrate. How do you feel about that ? -1 * * * * * web2py *applic

[web2py:15524] Re: Does a web2py app have the equivalent of main()?

2009-01-27 Thread billf
achipa sorry that just sailed over my head. how would that work? what could it do? Bill On Jan 27, 7:47 pm, achipa wrote: > Just a thought - we could hook an application level startup script (or > controller function) into cron. As cron already takes care of cgi/ > fastcgi/wsgi/cherrypy, timin

[web2py:15525] Re: Some thoughts on authentication and its implementation

2009-01-27 Thread billf
I guessing this didn't push anyone's buttons but I thought I'd bring it to the top of the queue just one more time in case someone could respond :-) Apologies if this is a breach of forum etiquette. On Jan 27, 6:52 am, billf wrote: > 1. The idea of bundling Mail, Auth and Crud in tools.py seems

[web2py:15526] Portal using web2py (+ T2)

2009-01-27 Thread hcvst
Hi, first of all, thank you for web2py. It allowed me to build a simple, clean webapp without having to read tons of documentation or to think too much about design/code organization very quickly. I love the straight-forward, browser-based dev approach, although the admin UI would probably benefi

[web2py:15527] Re: Does a web2py app have the equivalent of main()?

2009-01-27 Thread mdipierro
yes, why not On Jan 27, 1:47 pm, achipa wrote: > Just a thought - we could hook an application level startup script (or > controller function) into cron. As cron already takes care of cgi/ > fastcgi/wsgi/cherrypy, timings and some threading peculiarities it > shouldn't be too hard to integrate.

[web2py:15528] An example of MSSQL database connection and installing modules to support it

2009-01-27 Thread kgingeri
Hi all, Still a noob here and I have not found any complete examples of using MSSQL. I have purchased and downloaded the PDF manual but no help. I am on a Mac (but use Linux also). I get an error: NameError: global name 'pyodbc' is not defined and have installed pyodbc using easy_instal

[web2py:15529] Re: Does a web2py app have the equivalent of main()?

2009-01-27 Thread achipa
We have internal cron functionality since not so long ago, which allows us to schedule execution of 3rd party scripts, web2py environment wrapped scripts (this is "web2py -S app -M -R private/ script.py" ) and controller functions. Each app has it's own cron settings (check applications/cron/cront

[web2py:15530] Re: Does a web2py app have the equivalent of main()?

2009-01-27 Thread billf
This sounds like a good solution - I will have a play with it. Being a bit lazy, what would be the setting for a "run once, straightaway" entry in the crontab? On Jan 27, 10:44 pm, achipa wrote: > We have internal cron functionality since not so long ago, which > allows us to schedule execution

[web2py:15531] Re: Restricted left outer join

2009-01-27 Thread Baron
thanks Massimo - that works. Previously I had tried db.sales.on(db.sales.name==db.item.name) (db.user.name=='bob') but it caused an error. Do you know in what cases this form is allowed? Baron On Jan 27, 5:23 pm, mdipierro wrote: > this should work > > db().select(db.item.name,db.sales.price,l

[web2py:15532] Error log format

2009-01-27 Thread Baron
I noticed that the admin error log shows a list of all files in the errors folder. This is a problem if the errors folder contains other files such as .svn. (I added the errors folder to my repository because without it the admin interface throws an error.) Could this error list be restricted to f

[web2py:15533] Re: Does a web2py app have the equivalent of main()?

2009-01-27 Thread achipa
Err, just noted above :) Put the following line in applications/myapp/ cron/crontab -1 * * * * web2py *applications/myapp/private/script.py if your startup script is a regular python script OR -1 * * * * web2py *mycontroller/myfunc if you want to execute a controller function. The -1 is a clue

[web2py:15534] Re: An example of MSSQL database connection and installing modules to support it

2009-01-27 Thread achipa
Try starting a regular python console and type in import pyodbc If this gives an error, there's something wrong with your pyodbc install (=not a web2py issue). Did easy_install give any errors ? Do you perchance have multiple versions of python installed ? On Jan 27, 11:06 pm, kgingeri wrote:

[web2py:15535] Re: An example of MSSQL database connection and installing modules to support it

2009-01-27 Thread kgingeri
Sorry, I should have mentioned that the normal import works fine in Python (see ver below). No errors on easy_install-ing - or when I did the manual install - 'python setup.py install' from the untar'd archive directory. ...here's my /usr/bin results: $ ls /usr/bin/python* /usr/bin/python

[web2py:15536] Re: An example of MSSQL database connection and installing modules to support it

2009-01-27 Thread kgingeri
...on a little further investigation, I found... KarlsMacBook:~ kgingeri$ l /Library/Python/ total 0 drwxrwxr-x 4 root admin 136 2 Sep 17:17 2.3 drwxrwxr-x 4 root admin 136 2 Sep 17:16 2.5 KarlsMacBook:~ kgingeri$ find /Library/Python/2.3/site-packages/ -name \*odbc\* -print KarlsMacBoo

[web2py:15537] Re: Some thoughts on authentication and its implementation

2009-01-27 Thread mdipierro
On Jan 27, 12:52 am, billf wrote: > 1. The idea of bundling Mail, Auth and Crud in tools.py seems > shortsighted. remember the purpose of web2py is to bring users up to speed as fast as possible and make the follow good practice. By providing CRUD with rola based access control out of the box we

[web2py:15538] Re: Portal using web2py (+ T2)

2009-01-27 Thread mdipierro
You can do what you ask but please wait one week when web2py 1.56 comes out. It will include new modules Auth and Crud. Once documented they do what you want and much better than T2. Massimo On Jan 27, 3:01 pm, hcvst wrote: > Hi, > > first of all, thank you for web2py. It allowed me to build a

[web2py:15539] Re-use HTML form / web2py form validation

2009-01-27 Thread mige harimurti
Hi all, I'm newbie in web2py. I have several HTML pages, some with multiple form inside one page. But the basic design are : 1. There is no server side HTML generated. On client side, only HTML + JS/AJAX . 2. Client only passing GET/POST via form-submit or AJAX or URL to server 3. Server only pa

[web2py:15540] Re: Restricted left outer join

2009-01-27 Thread mdipierro
db(a) is a set db(a)(b) is a subset db(a)(b)(c) is a subset of the subset etc. db(a)(b)(c).select(left=table.on(d)) is a join notice that table.on(d) is not a set, but a condition (that is why it is on the right hand side, not the left hand side). a,b,c,d etc can be expressions like (q1)&(q2)

[web2py:15541] Re: Error log format

2009-01-27 Thread mdipierro
It should be. Will fix it. Massimo On Jan 27, 5:17 pm, Baron wrote: > I noticed that the admin error log shows a list of all files in the > errors folder. This is a problem if the errors folder contains other > files such as .svn. (I added the errors folder to my repository > because without i

[web2py:15542] Re: Does a web2py app have the equivalent of main()?

2009-01-27 Thread mdipierro
I am still waiting for a copy of the lastest patch. The one you send me was rejected because not build against latest commit. Massimo On Jan 27, 5:55 pm, achipa wrote: > Err, just noted above :) Put the following line in applications/myapp/ > cron/crontab > > -1 * * * * web2py *applications/mya

[web2py:15543] Re: getting t2 to install on windows

2009-01-27 Thread Yannick
Welcome to this wonderful world of Web2Py... I installed T2 over the week-end through the Administrative console. >From there I "Upload the application" the T2 tar file and I rename it as "plugin_t2" and it works fine. Hope this helped. Cheers, Yannick P On Jan 26, 10:04 am, Yarko Tymciurak

[web2py:15544] Re: Re-use HTML form / web2py form validation

2009-01-27 Thread mdipierro
This is a bit too general. You can make an action like def mycallback(): # do something with request.vars # compute r, a response return response.json(r) In order to tell you how to propery use validators depends on how you want the action retrun error messages. Massimo On Jan

[web2py:15545] bad news and good news

2009-01-27 Thread mdipierro
Bad news: - Once again, in 2009, PyCon has rejected the web2py talk and web2py tutorial. Good news: - I have been invited to join a panel discussion with Guido van Rossum on ORM & GAE - PyCon 2009 registration is based on web2py and T2. It opened today!!! https://us.pycon.org/2009/register

[web2py:15546] Re: Demo of plugin system

2009-01-27 Thread mdipierro
Bill. I like your approach here (despite the fact that this is nothing to do with the talk on plugins as I define them). I am trying to understand how extensive is the work you have done here. Do you feel this is good enough that it can replace the current sql.py? If not, what is missing? If yes

[web2py:15547] Re: Re-use HTML form / web2py form validation

2009-01-27 Thread mige harimurti
Hmm ... sorry about that. Thank you very much for your idea. But my idea is to use the framework as much as possible, including the form validation. This would be decreasing my work load. Let's get into details a little bit. I have some table defined in web2py model, including some requirements

[web2py:15548] Re: Portal using web2py (+ T2)

2009-01-27 Thread hcvst
Thank you for your reply, Massimo. I look forward to 1.56 Thanks, HC --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubs

[web2py:15549] Re: Demo of plugin system

2009-01-27 Thread billf
My intention is that all the functionality in the sql.py on which the code was based (only 3 or 4 days ago) is in the demo version (new sql.py + plugins). Unfortunately, I can't say hand-on-heart that it could go into trunk without further testing. Hopefully, if the new sql.py works for one plug