lemon-webmodules Mailing List for Lemon - Python Web Modules
Status: Beta
Brought to you by:
thejimmyg
You can subscribe to this list here.
2005 |
Jan
(21) |
Feb
(40) |
Mar
(5) |
Apr
(18) |
May
(3) |
Jun
(12) |
Jul
(8) |
Aug
(7) |
Sep
|
Oct
|
Nov
(2) |
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2010 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
From: oscar <os...@at...> - 2010-08-05 19:32:34
|
From: Felix S. <Fel...@we...> - 2005-11-17 07:44:46
|
Hi Duarte, X_jnduarte schrieb: > Reading the WebModules docs aparently all to make are include a line with > AddHandler /usr/bin/python .py in "my /etc/apache/httpd.conf". > I'm made this and restarted apache. But it don't work! > When I acess my http://localhost/hello.py the system don't execute the > example and prompts for the program to use for open the file "hello.py". First of all I think, your problem could be better described as "Python CGI scripts do not work with Apache". I did not use the AddHandler directive but: ScriptAlias /cgi-bin/ "/path/to/cgi-bin/" Please have a look at the apache log files (error.log and suexec.log) as they will give you valuable hints. -- Felix |
From: X_jnduarte <jnd...@mi...> - 2005-11-16 13:02:33
|
Hi, I'm a experienced programmer in a Desktop environment (C++, Python, Java), but I a newbie in WEB programming. So I decided make my first incursion in WEB programming with Web Modules and Python. I've a Apache 1.3 installed and running in a Debian Box (I use PHPMyAdmin and others PHP based utils). My Python is 2.35 version installed from deb packages, using Synaptic and runs fine (I develop with WxDesigner, Reading the WebModules docs aparently all to make are include a line with AddHandler /usr/bin/python .py in "my /etc/apache/httpd.conf". I'm made this and restarted apache. But it don't work! When I acess my http://localhost/hello.py the system don't execute the example and prompts for the program to use for open the file "hello.py". I am made some variations how: AddHandler .py /usr/bin/python AddHandler py /usr/bin/python AddHandler /usr/bin/python py No success... Can someone help me? Greetings Duarte dua...@mi... |
From: James G. <ja...@py...> - 2005-08-12 18:07:24
|
Hi Felix, Usually if you needed to do this you would set your session expire parameter fairly large (eg a day) and then if the application itself needed to keep accurate track of when it needed to expire, it would store an expire variable in the session store and behave accordingly. You wouldn't use the session expire time so directly to affect application behavior. The way you would normally write a pythonweb.org application is to use the web.auth module which has an expire parameter which is completely independent of the web.session expire parameter as long as the session doesn't expire. This itself is implemented using the suggestion above of storing an expire variable in a session store as a session variable. Are you not using web.auth? Perhaps we should think about how to implement this as a feature by setting multiple cookies or multiple session ids in the same cookie for different applications but at the moment the only other way I can think you could do it if you don't want to use the method suggested above is to use two different sets of database tables for the two applications and implement two session managers in the code. There is a parameter wher you can name a database table prepend. I believe the two session managers would behave completely independently unless the extremely unlikely event of the two managers randomly creating the same session ID occurs. If none of the ideas meets your requirements I'd be happy to discuss an extension to the API? James Felix Schwarz wrote: >Hi all, > >I'm trying to have several applications which share the same session >id. While looking a it I found some problems in the 0.5.3 API of >web.session. > >For example I have an application A which is an admin interface with >quite high security considerations and an application B which is only >used by normal users. > >I want to have a short session expiry time for application A (10 >minutes of inactivity) but a longer one for application B (more than >30 minutes). Both applications are using separate stores as suggested >by the docs. I don't see how this can be implemented in the current >API. > >The solution for this would be that every store has an expiry time and >one checks if a store is still valid. How do you solve that problem? > > > |
From: Felix S. <Fel...@we...> - 2005-08-12 08:21:34
|
Hi all, I'm trying to have several applications which share the same session id. While looking a it I found some problems in the 0.5.3 API of web.session. For example I have an application A which is an admin interface with quite high security considerations and an application B which is only used by normal users. I want to have a short session expiry time for application A (10 minutes of inactivity) but a longer one for application B (more than 30 minutes). Both applications are using separate stores as suggested by the docs. I don't see how this can be implemented in the current API. The solution for this would be that every store has an expiry time and one checks if a store is still valid. How do you solve that problem? -- Felix |
From: James G. <ja...@py...> - 2005-08-08 10:09:28
|
It works by importing it I'm afraid (using teud which uses pydoc). I was really suprised how quick it was to write.. took me about 5 hours so I can't really understand why docutils doesn't have something similar. My plan is to just use it until docutils has something similar and then because the API componets are quite separate, I can then adapt it to use the finalised docutils code. docutils doesn't seem to generate XML either, just psuedo-xml. If it generated XML then I could drop the pydoc and teud parts of pigeon and just use the docutils XML format which would be a bit cleaner. You can also write a new XML parser class very easily to make the output look completely different, or indeed generate a different output format altogether or use an XSLT transform if you prefer and have an XSLT processer installed. I've still got to document it properly, add an index in the bottom right frame (when you load the index.html file generated) and document code that is inherited or overrided as specifically being that but then it is finished so I guess if the docutils people are interested in it then it would be great to include it as part of docutils. The thing that excites me about it is that I can integrate it into the eggs format so that when a module is installed it can also be automatically documented. I can also use it to document eggs, bricks applications and other things rather than just modules alone.. all quite exciting! James > James Gardner wrote: > It sounds *very* interesting. There isn't a working part of docutils to > extract docstrings from code and generate API documentation. Maybe this > is it ;-) > > By the way - does it work by importing the code, or by compiling it ? > > Regards, > > Fuzzy > http://www.voidspace.org.uk/python > > >> James >> >> >> >> Michael Foord wrote: >> >>> Sounds good James. >>> >>> To save me having to look *too far* ;-) - I assume pigeon uses >>> docstrings ? Can you use reStructured Text format, or have you created >>> your own markup convention ? >>> >>> Regards, >>> >>> Fuzzy >>> http://www.voidspace.org.uk/python >>> -----Original Message----- >>> >From: "James Gardner"<ja...@py...> >>> >Sent: 07/08/05 17:46:55 >>> >To: >>> "lem...@li..."<lem...@li...> >>> >>> >Subject: [PythonWeb.org] New Releases and Roadmap >>> > >>> >Hi All, >>> > >>> >I'm pleased to announce a new release of the web modules, well sort >>> of! >I've written a document about where we were and where I'd like >>> to go: >>> > >>> >http://www.pythonweb.org/doc/pythonweb/ >>> > >>> >So far I've split all the code up into different modules and >>> released >them in the eggs format (described in the link above) and >>> also made a >SVN snapshot of all the code: >>> > >>> >http://www.pythonweb.org/doc/pythonweb/release/ >>> >http://www.pythonweb.org/snapshot/ >>> > >>> >I'm hoping to document them all over the next few weeks using a new >>> >documentation format named pigeon where the documentation is >>> written as >part of the code itself so hopefully it will be easier >>> to keep the >documentation up to date. Examples here: >>> > >>> >http://www.pythonweb.org/doc/ (looks like I can't spell pigeon on >>> the >front screen.. oops) >>> >http://www.pythonweb.org/doc/web.doc.html (web module specific code) >>> > >>> >There is a lot of work to do documenting everything before it can >>> really >be used so please consider everything Alpha until the >>> documentation is > >>> > >>> >>> [Message truncated. Tap Edit->Mark for Download to get remaining >>> portion.] >>> >>> >>> >>> ------------------------------------------------------- >>> SF.Net email is Sponsored by the Better Software Conference & EXPO >>> September 19-22, 2005 * San Francisco, CA * Development Lifecycle >>> Practices >>> Agile & Plan-Driven Development * Managing Projects & Teams * Testing >>> & QA >>> Security * Process Improvement & Measurement * >>> http://www.sqe.com/bsce5sf >>> _______________________________________________ >>> Lemon-webmodules mailing list >>> Lem...@li... >>> https://lists.sourceforge.net/lists/listinfo/lemon-webmodules >>> >>> >> >> >> >> ------------------------------------------------------- >> SF.Net email is Sponsored by the Better Software Conference & EXPO >> September 19-22, 2005 * San Francisco, CA * Development Lifecycle >> Practices >> Agile & Plan-Driven Development * Managing Projects & Teams * Testing & >> QA >> Security * Process Improvement & Measurement * >> http://www.sqe.com/bsce5sf >> _______________________________________________ >> Lemon-webmodules mailing list >> Lem...@li... >> https://lists.sourceforge.net/lists/listinfo/lemon-webmodules >> >> >> > > > > ------------------------------------------------------- > SF.Net email is Sponsored by the Better Software Conference & EXPO > September 19-22, 2005 * San Francisco, CA * Development Lifecycle > Practices > Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA > Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf > _______________________________________________ > Lemon-webmodules mailing list > Lem...@li... > https://lists.sourceforge.net/lists/listinfo/lemon-webmodules > |
From: Michael F. <mi...@pc...> - 2005-08-08 07:43:43
|
James Gardner wrote: > Thanks Michael, > > That's right, it uses reStructuredText in docstrings, uses Teud to turn > them to XML and then parses the XML into the API documentation, very > simple really. The idea is that the first docstring contains user > documentation (in grey at the top) and the rest provides API > documentation. I modeled it on the way the Ruby on Rails documentation > looks. I may make it so that the API docs and user docs are in separate > files. It isn't too clever but the docutils project didn't seem to have > a working version so I tweaked the best tools I could find to create > pigeon! > It sounds *very* interesting. There isn't a working part of docutils to extract docstrings from code and generate API documentation. Maybe this is it ;-) By the way - does it work by importing the code, or by compiling it ? Regards, Fuzzy http://www.voidspace.org.uk/python > James > > > > Michael Foord wrote: > >> Sounds good James. >> >> To save me having to look *too far* ;-) - I assume pigeon uses >> docstrings ? Can you use reStructured Text format, or have you created >> your own markup convention ? >> >> Regards, >> >> Fuzzy >> http://www.voidspace.org.uk/python >> -----Original Message----- >> >From: "James Gardner"<ja...@py...> >> >Sent: 07/08/05 17:46:55 >> >To: >> "lem...@li..."<lem...@li...> >> >> >Subject: [PythonWeb.org] New Releases and Roadmap >> > >> >Hi All, >> > >> >I'm pleased to announce a new release of the web modules, well sort >> of! >I've written a document about where we were and where I'd like >> to go: >> > >> >http://www.pythonweb.org/doc/pythonweb/ >> > >> >So far I've split all the code up into different modules and >> released >them in the eggs format (described in the link above) and >> also made a >SVN snapshot of all the code: >> > >> >http://www.pythonweb.org/doc/pythonweb/release/ >> >http://www.pythonweb.org/snapshot/ >> > >> >I'm hoping to document them all over the next few weeks using a new >> >documentation format named pigeon where the documentation is >> written as >part of the code itself so hopefully it will be easier >> to keep the >documentation up to date. Examples here: >> > >> >http://www.pythonweb.org/doc/ (looks like I can't spell pigeon on >> the >front screen.. oops) >> >http://www.pythonweb.org/doc/web.doc.html (web module specific code) >> > >> >There is a lot of work to do documenting everything before it can >> really >be used so please consider everything Alpha until the >> documentation is > >> > >> >> [Message truncated. Tap Edit->Mark for Download to get remaining >> portion.] >> >> >> >> ------------------------------------------------------- >> SF.Net email is Sponsored by the Better Software Conference & EXPO >> September 19-22, 2005 * San Francisco, CA * Development Lifecycle >> Practices >> Agile & Plan-Driven Development * Managing Projects & Teams * Testing >> & QA >> Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf >> _______________________________________________ >> Lemon-webmodules mailing list >> Lem...@li... >> https://lists.sourceforge.net/lists/listinfo/lemon-webmodules >> >> > > > > ------------------------------------------------------- > SF.Net email is Sponsored by the Better Software Conference & EXPO > September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices > Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA > Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf > _______________________________________________ > Lemon-webmodules mailing list > Lem...@li... > https://lists.sourceforge.net/lists/listinfo/lemon-webmodules > > > |
From: James G. <ja...@py...> - 2005-08-07 18:23:23
|
Thanks Michael, That's right, it uses reStructuredText in docstrings, uses Teud to turn them to XML and then parses the XML into the API documentation, very simple really. The idea is that the first docstring contains user documentation (in grey at the top) and the rest provides API documentation. I modeled it on the way the Ruby on Rails documentation looks. I may make it so that the API docs and user docs are in separate files. It isn't too clever but the docutils project didn't seem to have a working version so I tweaked the best tools I could find to create pigeon! James Michael Foord wrote: >Sounds good James. > >To save me having to look *too far* ;-) - I assume pigeon uses docstrings ? Can you use reStructured Text format, or have you created your own markup convention ? > >Regards, > >Fuzzy >http://www.voidspace.org.uk/python > >-----Original Message----- > >From: "James Gardner"<ja...@py...> > >Sent: 07/08/05 17:46:55 > >To: "lem...@li..."<lem...@li...> > >Subject: [PythonWeb.org] New Releases and Roadmap > > > >Hi All, > > > >I'm pleased to announce a new release of the web modules, well sort of! > >I've written a document about where we were and where I'd like to go: > > > >http://www.pythonweb.org/doc/pythonweb/ > > > >So far I've split all the code up into different modules and released > >them in the eggs format (described in the link above) and also made a > >SVN snapshot of all the code: > > > >http://www.pythonweb.org/doc/pythonweb/release/ > >http://www.pythonweb.org/snapshot/ > > > >I'm hoping to document them all over the next few weeks using a new > >documentation format named pigeon where the documentation is written as > >part of the code itself so hopefully it will be easier to keep the > >documentation up to date. Examples here: > > > >http://www.pythonweb.org/doc/ (looks like I can't spell pigeon on the > >front screen.. oops) > >http://www.pythonweb.org/doc/web.doc.html (web module specific code) > > > >There is a lot of work to do documenting everything before it can really > >be used so please consider everything Alpha until the documentation is > > > > > >[Message truncated. Tap Edit->Mark for Download to get remaining portion.] > > > >------------------------------------------------------- >SF.Net email is Sponsored by the Better Software Conference & EXPO >September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices >Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA >Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf >_______________________________________________ >Lemon-webmodules mailing list >Lem...@li... >https://lists.sourceforge.net/lists/listinfo/lemon-webmodules > > |
From: Michael F. <mi...@pc...> - 2005-08-07 18:15:12
|
Sounds good James. To save me having to look *too far* ;-) - I assume pigeon uses docstrings ? Can you use reStructured Text format, or have you created your own markup convention ? Regards, Fuzzy http://www.voidspace.org.uk/python -----Original Message----- >From: "James Gardner"<ja...@py...> >Sent: 07/08/05 17:46:55 >To: "lem...@li..."<lem...@li...> >Subject: [PythonWeb.org] New Releases and Roadmap > >Hi All, > >I'm pleased to announce a new release of the web modules, well sort of! >I've written a document about where we were and where I'd like to go: > >http://www.pythonweb.org/doc/pythonweb/ > >So far I've split all the code up into different modules and released >them in the eggs format (described in the link above) and also made a >SVN snapshot of all the code: > >http://www.pythonweb.org/doc/pythonweb/release/ >http://www.pythonweb.org/snapshot/ > >I'm hoping to document them all over the next few weeks using a new >documentation format named pigeon where the documentation is written as >part of the code itself so hopefully it will be easier to keep the >documentation up to date. Examples here: > >http://www.pythonweb.org/doc/ (looks like I can't spell pigeon on the >front screen.. oops) >http://www.pythonweb.org/doc/web.doc.html (web module specific code) > >There is a lot of work to do documenting everything before it can really >be used so please consider everything Alpha until the documentation is > > [Message truncated. Tap Edit->Mark for Download to get remaining portion.] |
From: James G. <ja...@py...> - 2005-08-07 16:46:47
|
Hi All, I'm pleased to announce a new release of the web modules, well sort of! I've written a document about where we were and where I'd like to go: http://www.pythonweb.org/doc/pythonweb/ So far I've split all the code up into different modules and released them in the eggs format (described in the link above) and also made a SVN snapshot of all the code: http://www.pythonweb.org/doc/pythonweb/release/ http://www.pythonweb.org/snapshot/ I'm hoping to document them all over the next few weeks using a new documentation format named pigeon where the documentation is written as part of the code itself so hopefully it will be easier to keep the documentation up to date. Examples here: http://www.pythonweb.org/doc/ (looks like I can't spell pigeon on the front screen.. oops) http://www.pythonweb.org/doc/web.doc.html (web module specific code) There is a lot of work to do documenting everything before it can really be used so please consider everything Alpha until the documentation is finished. If you would like to use the new code one important change is that import web does not automatically load the web.cgi variable because doing so reads POST information. POST information can only be read once and you might choose to import web for a reason other than reading POST data and then not be able to use access it later (it was a problem I had when writing Bricks). To load CGI information you must now do: import web web.loadCGI() then everything works as before. Finally I've made the first release of Bricks. There is some documentation and a brief tutorial here: http://www.pythonweb.org/bricks/ Bricks is actually being used in a production site with mod_fastcgi here: http://www.whatshouldireadnext.com The site fetches XML feeds from Amazon which significantly slows performance but it gives you an idea. All the best, James |
From: James G. <ja...@py...> - 2005-07-07 20:08:08
|
Hi All, > I was reading through the mailing list archives and saw the post about > Bricks, is that available to test out yet? Bricks isn't available yet but hopefully will be within the next month. I thought I might as well give you all an update on the other projects too: I've now split the current pythonweb project into the following sub-projects and re-factored all the code accordingly. The new modules will work with the easy install system from http://peak.telecommunity.com/DevCenter/EasyInstall so that they can be installed as follows with the dependencies automatically installed too: > easy_install.py web Pretty simple eh? The modules are: bricks - full WSGI framework taking a similar approach to ruby on rails for rapidly developing web applications database - formally web.database for portable/simplified database access engine - formally SnakeSQL - now a toolkit to write your own SQL engine too. model - formally database.object, an object-relational mapper serve - classes for writing servers with web - same as before without all the external packages included All the modules are currently in an SVN repository and the documentation and distribution files get correctly built using makefiles. All the new modules work correctly together and still support Python 2.2. Still to do: * Write sensible documentation for the packages now they are standalone * Restructure the pythonweb.org website for the new modules I hope to have a pre-release of all the modules except Bricks at the end of next week. The code of the pre-releases is unlikely to change much before the final 0.6 releases but the documentation, tests and examples will. I hope to have a release of Bricks in early August. Bricks will be Python 2.4 and above only because it will use decorators. I am currently improving Ajax support (which already works) and will be using it for a commercial project over the next few weeks which will mean it gets developed quickly. If anyone is really keen I can provide an SVN snapshot so you can take a peak? Once I've got all the 0.6 modules released I'd really like to open up the source a bit more and give more people access so improvements/bug reports etc don't all have to come through me. I'll pretty much have implemented everything I would like to see in the modules by then and am more than happy for the project to take a new/better course with more people involved. Hope to have something to show you all soon anyway. Cheers, James |
From: James G. <ja...@py...> - 2005-07-07 19:48:00
|
Hi Wayne, Sorry for the delay in my reply.. I'm afraid I don't know what is wrong with the old webserver.py script and I'd started writing a replacement anyway so I've packaged it so that you can use this instead. It is fairly sophisticated and can run WSGI appliactions as well as CGI scripts. See file attached. I will be releasing a final version as part of the 0.6 releases, hopefully in a few days. Cheers, James Here is some brief documentation: 1.1 Serve Warning: This is simply very breif documentation to get you started. More to come later XXX More here The serve module contains a number of classes which can be used to quickly build powerful servers. Included in the distribution is a simple implementation of such a server named server.py. server.py can be used as an effective server to test the examples distributed with the Python Web Modules. The program takes the following options: usage: server.py [options] database options: --version show program's version number and exit -h, --help show this help message and exit -p PORT, --port=PORT port on which to start the server -a APP, --app-name=APP name of WSGI application to execute -c CGI, --cgi=CGI the cgi-bin directory -i CGIURL, --cgi-url=CGIURL the cgi-bin directory url -d, --debug allow the server to fall into debug mode when environ['bricks.error.debug'] is raised -r, --reload attempt to reload the application on each request -l LOGFILE, --log=LOGFILE log file to use -u PUBLIC, --public=PUBLIC public directory to serve files from -v PRIVATE, --private=PRIVATE private directory where bricks app, data, lib, log and script directories can be found --no-files prevent public files being served --no-log disable file logging -b, --browser launch a web browser when started The options should be fairly self explanatory. 1.1.1 Using server.py to serve Web Module examples * Unzip and install is as follows: > tar zxfv serve-0.6.0pre0.tgz > cd serve-0.6.0pre0 > python setup.py install * Run the server with the following commands: > python C:\Python24\Scripts\server.py -u "C:\htdocs" -i "C:\web\doc\src\lib" -c cgi-bin -p 8080 (all on one line) Where C:\Python24\Scripts\server.py is the path to the installed script, C:\htdocs is the base directory of the webserver, C:\web\doc\src\lib is where the examples are, cgi-bin is the URL you want to access the examples at and 8080 is the port. * visit http://localhost:8080/cgi-bin/test.py replacing test.py with the name of the example you wish to run. |
From: James G. <ja...@py...> - 2005-07-06 16:36:26
|
Hi Cecil, I think I ran into something similar on a FreeBSD machine with version 0.3 of the web modules. Are you sure you are using the same version of MySQL and the same version of MySQLdb on both machines? I can't remember exactly what caused the problem but I remember I fixed it by manually copying the old MySQLdb drivers to my web modules installation so they used the old drivers not the new ones. In your case it sounds like the production machine has the newer version of MySQLdb so you could copy across the old MySQLdb version? Which version of web.database are you using, I'm sure the most recent version works with the recent versions of MySQLdb, but they might have introduced more incompatibilities. I think pickle is a red herring in this case. Hope that gives you something to start looking at. James Cecil Westerhof wrote: >Op wo, 06-07-2005 te 08:47 +0200, schreef Cecil Westerhof: > > >>Op wo, 06-07-2005 te 08:03 +0200, schreef Cecil Westerhof: >> >> >>>When I do a print of read before 'return pickle.load(read)' I get: >>> array('c', "S'help'\np0\n.") >>> >>> >>(It was a 'print read.getvalue()' offcourse.) >>I also put this statement on the development machine. (I got immediatly >>angry messages, because it destroyed the headers for the webserver.) And >>I found the problem. On the development machine I do not get an array, >>but just the sting, it gives: >> S'help' >> p0 >> . >>So on the develpment machine I get a string and on the production >>machine I get an array. How can I solve this? >> >> > >I have a 'solution'. It works for the moment. It is better to find out >where the difference in behaviour comes from. But I am in the dark at >the moment and needed a fix. > >The changed code: > def _get(self, key, app=None, pickleValue=True): > "Gets the variable 'key' from the session store." > if not app: > app = self.params['app'] > rows=self.params['cursor'].select(('ItemValue'),self.params['table']+'Store',where="SessionID='"+self.params['sessionID']+"' and ItemKey='"+key+"' and App='"+app+"'") > if not rows: > raise SessionError("The session store doesn't have a key named '%s' for the app '%s'."%(key,app)) > else: > if type(rows[0]) == type({}): > read = StringIO.StringIO(rows[0]['ItemValue']) > else: # Assume it can be accessed as a tuple > read = StringIO.StringIO(rows[0][0]) > if( read.getvalue().startswith('array') ): > read = StringIO.StringIO(read.getvalue()[12:-2].replace('\\n', '\n')) > if pickleValue: > return pickle.load(read) > else: > return read > >I have added the lines: > if( read.getvalue().startswith('array') ): > read = StringIO.StringIO(read.getvalue()[12:-2].replace('\\n', '\n')) > >It seems to work. ;-} > > > |
From: James G. <ja...@py...> - 2005-07-06 16:35:38
|
Hi Frithiof Sorry for the long delay in replying. I hope you've managed to get the web modules table across to your production database. >If I specify the foreign key constraint "DELETE CASCADE", the correct thing happens; when I delete an Account f.ex. I do not have to search through all related tables and delete manually. It is done automatically. > > That's a bit more involved than foreign keys then! >What I understand is this: > >I create a dummy database in web modules with the same structure as the "real" one, this creates a special table structure that describes the database to web modules. > >I create the "real" database with SQL, using DB-API. > >I then create a description table for the real database copying the table created together with the dummy database. > >The web modules now understand the real database and uses it normally and because the constraints are hidden inside the database, the net effect is the occasional exeption. > >If I change the structure of the database later, I have to do the entire song and dance again. > > That's all correct and would be the easiest way of doing it at the moment >>What I would ask though is, if you need all the database specific >>functionality why are you trying to use the web modules to access it, >>why not just write your code with the DB-API and not use the >>web.database module at all? >> >> > >I have already tried that. > >My experience is that the all the string pasting and parameter conversions back and forth - and checks on said conversions - *do* get very, very, repetitive in the not so very long run. ... Not to mention the many versions of DateTime to choose from and results formats, depending on who did the DB-API. > >web modules is a great improvement in code briefness and clarity - even when using the web SQL drivers (I don't quite like the dict format yet - maybe because I am used to SQL ;-). > >The ability to specify the format of an result as a dict or list is really useful for those functions that are not in SQL, like running balances, the automatic handling of special characters and the "stubbing" of functions that might not be in the DB-API but should be(commit/rollback), the code looks the same with different databases. > >... And I forgot the web forms part. Which I need too. > > Well that's great.. exactly what I created the database modules for so I'm pleased they are also useful when used in conjunction with more advanced SQL code. I think it would be useful to be able to have a code alternative to the structure table to make this sort of thing much easier so I'll try to get that coded into the release after the one I'm working on at the moment! All the best, James |
From: Cecil W. <Cec...@xs...> - 2005-07-06 08:03:54
|
Op wo, 06-07-2005 te 08:47 +0200, schreef Cecil Westerhof: > Op wo, 06-07-2005 te 08:03 +0200, schreef Cecil Westerhof: > > When I do a print of read before 'return pickle.load(read)' I get: > > array('c', "S'help'\np0\n.") > > (It was a 'print read.getvalue()' offcourse.) > I also put this statement on the development machine. (I got immediatly > angry messages, because it destroyed the headers for the webserver.) And > I found the problem. On the development machine I do not get an array, > but just the sting, it gives: > S'help' > p0 > . > So on the develpment machine I get a string and on the production > machine I get an array. How can I solve this? I have a 'solution'. It works for the moment. It is better to find out where the difference in behaviour comes from. But I am in the dark at the moment and needed a fix. The changed code: def _get(self, key, app=None, pickleValue=True): "Gets the variable 'key' from the session store." if not app: app = self.params['app'] rows=self.params['cursor'].select(('ItemValue'),self.params['table']+'Store',where="SessionID='"+self.params['sessionID']+"' and ItemKey='"+key+"' and App='"+app+"'") if not rows: raise SessionError("The session store doesn't have a key named '%s' for the app '%s'."%(key,app)) else: if type(rows[0]) == type({}): read = StringIO.StringIO(rows[0]['ItemValue']) else: # Assume it can be accessed as a tuple read = StringIO.StringIO(rows[0][0]) if( read.getvalue().startswith('array') ): read = StringIO.StringIO(read.getvalue()[12:-2].replace('\\n', '\n')) if pickleValue: return pickle.load(read) else: return read I have added the lines: if( read.getvalue().startswith('array') ): read = StringIO.StringIO(read.getvalue()[12:-2].replace('\\n', '\n')) It seems to work. ;-} -- Cecil Westerhof <Cec...@xs...> |
From: Cecil W. <Cec...@xs...> - 2005-07-06 06:47:15
|
Op wo, 06-07-2005 te 08:03 +0200, schreef Cecil Westerhof: > When I do a print of read before 'return pickle.load(read)' I get: > array('c', "S'help'\np0\n.") (It was a 'print read.getvalue()' offcourse.) I also put this statement on the development machine. (I got immediatly angry messages, because it destroyed the headers for the webserver.) And I found the problem. On the development machine I do not get an array, but just the sting, it gives: S'help' p0 . So on the develpment machine I get a string and on the production machine I get an array. How can I solve this? -- Cecil Westerhof <Cec...@xs...> |
From: Cecil W. <Cec...@xs...> - 2005-07-06 06:03:31
|
I have a strange problem. I am trying to bring my application from a development enviroment to a production enviroment. (Should have done it sooner. Then I would have had more time to solve this problem.) I get a very strange problem. I have pasted what comes in the logfile (only on the production enviroment, development enviroment does not have a problem): Traceback (most recent call last): File "SMS.cgi", line 10, in ? SMS.start(BASE_DIR) File "/home/users/decebalc/python//SMS/SMS.py", line 1549, in start Init() File "/home/users/decebalc/python//SMS/SMS.py", line 1372, in Init MenuEntry = CheckTotal('MenuEntry') File "/home/users/decebalc/python//SMS/SMS.py", line 200, in CheckTotal return CheckSession(ThisParam) File "/home/users/decebalc/python//SMS/SMS.py", line 169, in CheckSession if( Session.has_key(ThisParam) ): File "/home/users/decebalc/python//PythonWeb/web/session/sessionBase.py", line 104, in has_key self.get(key, block) File "/home/users/decebalc/python//PythonWeb/web/session/sessionBase.py", line 85, in get return self._get(key) File "/home/users/decebalc/python//PythonWeb/web/session/sessionDatabase.py", line 148, in _get return pickle.load(read) File "/usr/local/lib/python2.4/pickle.py", line 1390, in load return Unpickler(file).load() File "/usr/local/lib/python2.4/pickle.py", line 872, in load dispatch[key](self) File "/usr/local/lib/python2.4/pickle.py", line 1200, in load_append value = stack.pop() IndexError: pop from empty list I do not know if it is important, but on the development machine I am using python 2.2.2 and the production machine has python 2.4.1 (and it is a BSD machine). Attached a simple program that illustrates the problem. (username and password have to be changed offcourse) On my development system this gives: $ python testing.py Set-Cookie: SMS=ZpsMOrBZGDPvg893bs5lPw; Comment=Built in Python using web.session from pythonweb.org; Max-Age=21600; Path=/; Version=1; help On the production system it gives: $ python testing.py Set-Cookie: SMS=Gg2dhrRcrf5tEGTLUoSJVw; Comment=Built in Python using web.session from pythonweb.org; Max-Age=21600; Path=/; Version=1; Traceback (most recent call last): File "testing.py", line 20, in ? print Session['dummy'] File "/home/users/decebalc/python//PythonWeb/web/session/sessionBase.py", line 222, in __getitem__ return self.get(key) File "/home/users/decebalc/python//PythonWeb/web/session/sessionBase.py", line 85, in get return self._get(key) File "/home/users/decebalc/python//PythonWeb/web/session/sessionDatabase.py", line 148, in _get return pickle.load(read) File "/usr/local/lib/python2.4/pickle.py", line 1390, in load return Unpickler(file).load() File "/usr/local/lib/python2.4/pickle.py", line 872, in load dispatch[key](self) File "/usr/local/lib/python2.4/pickle.py", line 1200, in load_append value = stack.pop() IndexError: pop from empty list When I do a print of read before 'return pickle.load(read)' I get: array('c', "S'help'\np0\n.") When I use 'python -i testing.py' and then type Session, I get: on develpment <web.session.sessionDatabase.SessionDatabase instance at 0x825e044> and on production Traceback (most recent call last): File "<stdin>", line 1, in ? File "/home/users/decebalc/python//PythonWeb/web/session/sessionBase.py", line 240, in __getattr__ raise SessionError("The session does not have a parameter named '%s'."%name) web.errors.SessionError: The session does not have a parameter named '__repr__'. Does anyone have any idea what the problem (and the solution) could be? -- Sanatate si numai bine, Cecil Westerhof Decebal Computing & Services, the Netherlands Prins Hendrikweg 7 3941 GC Doorn the Netherlands Tel: +31 - 6 - 27 03 28 22 Fax. +31 - 84 - 740 58 53 Email: Ce...@De... URL: http://www.DecebalComputing.nl -- Cecil Westerhof <Cec...@xs...> |
From: Felix S. <Fel...@we...> - 2005-07-05 07:07:30
|
Hi all, one thing I was missing was a more comfortable possibility to query the authAdmin object if a user has a specific role. Patch below. Index: C:/Programme/eclipse3.1M7/workspace/Junkkiller/cgi-bin/pythonweb/web/auth/__init__.py =================================================================== --- C:/Programme/eclipse3.1M7/workspace/Junkkiller/cgi-bin/pythonweb/web/auth/__init__.py (revision 81) +++ C:/Programme/eclipse3.1M7/workspace/Junkkiller/cgi-bin/pythonweb/web/auth/__init__.py (working copy) @@ -216,6 +216,14 @@ username = username.lower() return self._driver.roles(username, app) + def hasRole(self, username, role, app=None): + if username == None or role == None: + return False + else: + username = username.lower() + roles = self._driver.roles(username, app) + return (role in roles) + def setRole(self, username, app, role): username = username.lower() return self._driver.setRole(username, app, role) -- Felix |
From: Wayne P. <sha...@gm...> - 2005-06-24 17:28:14
|
I was reading through the mailing list archives and saw the post about Bricks, is that available to test out yet? Thanks, Wayne |
From: Frithiof J. (AH/LMD) <fri...@er...> - 2005-06-24 11:25:06
|
Hi James, Thanks for the help.=20 > The web modules do support simple foreign key constraints but nothing=20 > particularly complicated,=20 It will *work* - What I am trying to do is to build a framework to test = different betting strategies. I create many agents. Each agent owning an = account and following a strategy. Then the agents run and I see who = blows up and who survives. The "survivers" might be lucky so they get to = run with different portfolios. =20 What I have is tables of "Accounts" containing a Cash Account and a = Portfolio, all containing positions/entries (tables of credits and = debits, ) - i.e. LOTS of linked tables that needs to be created and = destroyed often.=20 If I specify the foreign key constraint "DELETE CASCADE", the correct = thing happens; when I delete an Account f.ex. I do not have to search = through all related tables and delete manually. It is done = automatically. =20 Some related table entries I need to keep - f.ex. stock quotes related = to trades that should stick around for accounting.=20 This is also easily done by constraints. > but it would be easier to copy it from another database as=20 > described above. What I understand is this:=20 I create a dummy database in web modules with the same structure as the = "real" one, this creates a special table structure that describes the = database to web modules. I create the "real" database with SQL, using DB-API. I then create a description table for the real database copying the = table created together with the dummy database. The web modules now understand the real database and uses it normally = and because the constraints are hidden inside the database, the net = effect is the occasional exeption. If I change the structure of the database later, I have to do the entire = song and dance again. That is sort-of what I hoped to do. > What I would ask though is, if you need all the database specific=20 > functionality why are you trying to use the web modules to access it,=20 > why not just write your code with the DB-API and not use the=20 > web.database module at all?=20 I have already tried that. My experience is that the all the string pasting and parameter = conversions back and forth - and checks on said conversions - *do* get = very, very, repetitive in the not so very long run. ... Not to mention = the many versions of DateTime to choose from and results formats, = depending on who did the DB-API.=20 web modules is a great improvement in code briefness and clarity - even = when using the web SQL drivers (I don't quite like the dict format yet - = maybe because I am used to SQL ;-).=20 The ability to specify the format of an result as a dict or list is = really useful for those functions that are not in SQL, like running = balances, the automatic handling of special characters and the = "stubbing" of functions that might not be in the DB-API but should = be(commit/rollback), the code looks the same with different databases. ... And I forgot the web forms part. Which I need too.=20 Web interfaces solve a lot of annoying firewall issues one might = encounter in the corporate environment and on lame ISP accounts. Like = the system management station I have on our IPv6 test network. It's an = Apache2 box and it is reached via HTTP on the global Internet to get = information across about 15 meters physical distance blocked by several = meters of "IT-policy" documents ;-) =20 > Would you find this useful? Very Useful. =20 > Hope that is of some help, Certainly, Thanks.=20 |
From: Wayne P. <sha...@gm...> - 2005-06-24 00:31:57
|
I was looking at using the webserver.py to test locally, rather than work directly on my hosting provider's servers. However when I run 'python webserver.py -b public_html/' and then load a file named 'home.py' I get the source of home.py. I also created a cgi-bin directory under public_html as well but that didn't work either. home.py is executable, running 'python home.py' at a terminal works fine and gives the correct output. Any thoughts on what could be wrong? Thanks, Wayne |
From: Wayne P. <sha...@gm...> - 2005-06-24 00:22:06
|
James, Thanks for the response. I did figure out the problem...sorta. The code I used was from http://www.pythonweb.org/projects/webmodules/doc/0.5.3/html_multipage/lib/e= xample-file-web-template-xyaptu.html which dind't have the headers or a 'print web.header()'. Which is what was causing the Apache error. Oddly enough, when I put a blank line between the closing BODY and closing HTML tags everything works fine. I then removed the space and got the same error, but it went away when I put the blank line back in. I'm going to test the same code on a different system tomorrow to see if I can narrow it down. Wayne On 6/23/05, James Gardner <ja...@py...> wrote: > Hi Wayne, >=20 > I've tested your code on both Python 2.2 and Python 2.4 and it works as > it should for me, I couldn't reproduce your error I'm afraid. Cheetah is > the most powerful and best supported templating engine that the web > modules support so I'd recommend using that instead. The example is at > http://www.pythonweb.org/projects/webmodules/doc/0.5.3/html_multipage/lib= /example-file-web-template-cheetah.html >=20 > As for the Internal Server Error on Apache, that is usually caused > because you have forgotten to print the HTTP header before the main > content. Add the line: >=20 > print "Content-type: text/html\n\n" >=20 > after the import web.template line and you should avoid the error. >=20 > Hope that is of some use! >=20 > James >=20 > Wayne Pierce wrote: >=20 > >I just found PythonWeb and have started working through the examples. > >Unfortunately I can't get a simple template working properly, parts of > >the HTML disappear or are printed out of order in the final output. > > > >I have the following files: > > > >(webtest.py) > > > >#!/usr/bin/python > > > >import web.template > > > >dict =3D { > > 'welcomeMessage': 'Welcome to the test page.', > > 'testVar': True, > > 'title': 'Example' > >} > > > >print web.template.parse( > > type=3D'xyaptu', > > file=3D'web-template.tmpl', > > dict=3Ddict > >) > > > >(web-template.tmpl) > > > ><html> > > <head> > > <title>$title</title> > > </head> > > > > <body> > > <p>$welcomeMessage</p> > > <py-open code=3D"if testVar:" /> > > The variable is: True > > <py-clause code=3D"else:" /> > > The variable is: False > > <py-close/> > > </body> > ></html> > > > >When I run 'python webtest.py' from the command line (Fedora 3) I get > >the following: > > > ><html> <head> <title>Example</title> > > <body>> <p>Welcome to the test page.</p> > > > >The variable is: True > ></html> </body> > > > > > >Two things happen, </head> disappears and the last two items are > >flipped. Running webtest.py through Apache gives me an Internal > >Server Error due to malformed headers. > > > >Does anyone have suggestions on what could be causing this? I am > >using Python 2.3.4 with the latest version of PythonWeb. > > > >Thanks for any help, > > > >Wayne > > > > > >------------------------------------------------------- > >SF.Net email is sponsored by: Discover Easy Linux Migration Strategies > >from IBM. Find simple to follow Roadmaps, straightforward articles, > >informative Webcasts and more! Get everything you need to get up to > >speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id=16492&op=3Dclick > >_______________________________________________ > >Lemon-webmodules mailing list > >Lem...@li... > >https://lists.sourceforge.net/lists/listinfo/lemon-webmodules > > > > >=20 > |
From: James G. <ja...@py...> - 2005-06-23 21:22:54
|
Is anyone planning on going to EuroPython in Sweden this week? I'm going so if any of you are, do let me know as it would be great to meet up! James |
From: James G. <ja...@py...> - 2005-06-23 21:20:47
|
Hi Frithiof, The web modules do support simple foreign key constraints but nothing particularly complicated, I'm not sure if the support is sufficient for your purposes though. The documentation is at http://www.pythonweb.org/projects/webmodules/doc/0.5.3/html_multipage/lib/ForeignKeys.html You certainly can create the database with all the advanced functionality and then make a table to fool the web modules into thinking the database was created by them. The web modules store all the information about the structure of the database in table named, by default, "StructureTable". My suggestion would be to create two databases, one using the web.database module and one with all the extra database-specific code. You can then copy the information from the StructureTable created by the web.database module to the other database and reconnect to the real one with the web.database modules. The structure is fairly simple. It is created in the code like this: self.cursor.create( table='StructureTable', columns = [ self.cursor.column(name='TableName', type='String', required=True), self.cursor.column(name='ColumnName', type='String', required=True), self.cursor.column(name='ColumnType', type='String', required=True), self.cursor.column(name='IsRequired', type='Bool'), self.cursor.column(name='IsUnique', type='Bool'), self.cursor.column(name='IsPrimaryKey', type='Bool'), self.cursor.column(name='ForeignKeyTable', type='Text'), self.cursor.column(name='DefaultValue', type='Text'), self.cursor.column(name='Position', type='Integer', required=True), ], execute=True, mode='direct' ) but it would be easier to copy it from another database as described above. What I would ask though is, if you need all the database specific functionality why are you trying to use the web modules to access it, why not just write your code with the DB-API and not use the web.database module at all? You can still use the web.auth and web.session modules in alongside other tables, the web modules will be unaware of the more complicated tables in your database but the DB-API will be able to access all the information. Could you give a bit more information about what you are trying to achieve? For the next release of the modules, the web.database module will be separated out into a completely separate package. I'm planning on including functionality to allow you to tell the web modules your database structure by passing parameters to the connect() method as well as obtaining it from the database. Would you find this useful? Hope that is of some help, James Frithiof Jensen (AH/LMD) wrote: >Hi List, > >I would like to manually create a database with CHECK and DELETE constraints e.t.c. so that I do not need to perpetually manage this all over my application and also to ensure that other tools respect the rules of the database. > >The limited SQL subset in webmodules does not allow this for compatibility between different databases, so I cannot use webmodules for that. > >"the path of least resistance", I Think, is to create the database with raw SQL using the Python DBI and all the advanced constructs and then somehow import/open it in webmodules. > >That way webmodules do not need to "know/learn" any advanced database functionality but it will need to deal with exceptions generated by constraints - or rather pass them up to the application (which I think it does anyway). > >My understanding is that webmodules maintains it's own tables about the structure of the databases it works with. Those are created automatically when creating the database in webmodules. > >My problem is: How do I make webmodules aware of a database structure created outside webmodules? > >mvh, >Frithiof Jensen. > > >------------------------------------------------------- >SF.Net email is sponsored by: Discover Easy Linux Migration Strategies >from IBM. Find simple to follow Roadmaps, straightforward articles, >informative Webcasts and more! Get everything you need to get up to >speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id492&op=click >_______________________________________________ >Lemon-webmodules mailing list >Lem...@li... >https://lists.sourceforge.net/lists/listinfo/lemon-webmodules > > |
From: James G. <ja...@py...> - 2005-06-23 20:57:30
|
Hi Wayne, I've tested your code on both Python 2.2 and Python 2.4 and it works as it should for me, I couldn't reproduce your error I'm afraid. Cheetah is the most powerful and best supported templating engine that the web modules support so I'd recommend using that instead. The example is at http://www.pythonweb.org/projects/webmodules/doc/0.5.3/html_multipage/lib/example-file-web-template-cheetah.html As for the Internal Server Error on Apache, that is usually caused because you have forgotten to print the HTTP header before the main content. Add the line: print "Content-type: text/html\n\n" after the import web.template line and you should avoid the error. Hope that is of some use! James Wayne Pierce wrote: >I just found PythonWeb and have started working through the examples. >Unfortunately I can't get a simple template working properly, parts of >the HTML disappear or are printed out of order in the final output. > >I have the following files: > >(webtest.py) > >#!/usr/bin/python > >import web.template > >dict = { > 'welcomeMessage': 'Welcome to the test page.', > 'testVar': True, > 'title': 'Example' >} > >print web.template.parse( > type='xyaptu', > file='web-template.tmpl', > dict=dict >) > >(web-template.tmpl) > ><html> > <head> > <title>$title</title> > </head> > > <body> > <p>$welcomeMessage</p> > <py-open code="if testVar:" /> > The variable is: True > <py-clause code="else:" /> > The variable is: False > <py-close/> > </body> ></html> > >When I run 'python webtest.py' from the command line (Fedora 3) I get >the following: > ><html> <head> <title>Example</title> > <body>> <p>Welcome to the test page.</p> > >The variable is: True ></html> </body> > > >Two things happen, </head> disappears and the last two items are >flipped. Running webtest.py through Apache gives me an Internal >Server Error due to malformed headers. > >Does anyone have suggestions on what could be causing this? I am >using Python 2.3.4 with the latest version of PythonWeb. > >Thanks for any help, > >Wayne > > >------------------------------------------------------- >SF.Net email is sponsored by: Discover Easy Linux Migration Strategies >from IBM. Find simple to follow Roadmaps, straightforward articles, >informative Webcasts and more! Get everything you need to get up to >speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id492&op=click >_______________________________________________ >Lemon-webmodules mailing list >Lem...@li... >https://lists.sourceforge.net/lists/listinfo/lemon-webmodules > > |