myghty-users Mailing List for Myghty - Python Templating Framework (Page 3)
Brought to you by:
zzzeek
You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(5) |
Oct
(4) |
Nov
(20) |
Dec
(34) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(34) |
Feb
(28) |
Mar
(21) |
Apr
(69) |
May
(32) |
Jun
(62) |
Jul
(22) |
Aug
(17) |
Sep
(80) |
Oct
(71) |
Nov
(72) |
Dec
(58) |
2006 |
Jan
(81) |
Feb
(45) |
Mar
(9) |
Apr
(19) |
May
(29) |
Jun
(11) |
Jul
(13) |
Aug
(22) |
Sep
(8) |
Oct
(3) |
Nov
(6) |
Dec
(2) |
2007 |
Jan
(3) |
Feb
|
Mar
(3) |
Apr
(6) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2008 |
Jan
|
Feb
|
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(4) |
From: Martin S. <ema...@we...> - 2006-08-28 02:19:37
|
Hi Mike, Jeff and everybody else, Wow... unicode! This is great! Just a minor side-question: If I remember correctly, Jeff mentioned somewhere, that his unicode-refactoring slightly changes the myghty-output behaviour: Until now, when you had an integer variable myInt containing the value 0 (which, obviously evaluates to boolean false), the following substitution would not give any output: <% myInt %> Will this behaviour be changed as well? (I would prefer a change, since you generally don't want the boolean interpretation of integers in the template but the actual content meaning). Anyway, thanks for the unicode-work! Cheers, Martin |
From: Michael B. <mi...@zz...> - 2006-08-28 02:12:56
|
the lower stack trace is the full result the python interpreter sends; you can see theres no mention of any compiled component files in it, so theres nothing to show with the top stack trace. since its a unicode issue that shows up within HTTPHandler's write() method, thats the stack trace we get. even though its driven from data that came out of your template's code, thats not where the error was raised. so it is a complete stack trace. i dont think theres any way around this phenomenon, i.e. data-driven exceptions that cause symptoms within code other than where the actual problematic data originated. On Aug 27, 2006, at 7:27 PM, sk...@po... wrote: > > Michael> current releases of Myghty dont really handle unicode > so well, > Michael> which would include a unicode object containing any > codepoint > Michael> outside of ascii range. try out the new unicode > branch !! > > Michael> http://www.myghty.org/unicode.myt > > Sure, I'll give it a try when I have a chance. I saw the note > about that, > however that doesn't necessarily solve the problem of the > incomplete stack > trace. Unicode or not, I will eventually generate a stack trace > again at > some point in the future. Maybe this is just an isolated case, but > it seems > to me that if it failed to display information about my code this > time, the > same problem will turn up again sometime in the future. > > Skip |
From: <sk...@po...> - 2006-08-27 23:27:47
|
Michael> current releases of Myghty dont really handle unicode so well, Michael> which would include a unicode object containing any codepoint Michael> outside of ascii range. try out the new unicode branch !! Michael> http://www.myghty.org/unicode.myt Sure, I'll give it a try when I have a chance. I saw the note about that, however that doesn't necessarily solve the problem of the incomplete stack trace. Unicode or not, I will eventually generate a stack trace again at some point in the future. Maybe this is just an isolated case, but it seems to me that if it failed to display information about my code this time, the same problem will turn up again sometime in the future. Skip |
From: Michael B. <mi...@zz...> - 2006-08-27 23:07:08
|
current releases of Myghty dont really handle unicode so well, which would include a unicode object containing any codepoint outside of ascii range. try out the new unicode branch !! http://www.myghty.org/unicode.myt On Aug 27, 2006, at 6:57 PM, sk...@po... wrote: > I got a UnicodeEncodeError in some output just now. I'd be happy > to hack > around the problem for the short term but my code isn't mentioned > at all in > the stack trace: > > > Myghty Template Error > > Error: Error(UnicodeEncodeError): 'ascii' codec can't > encode character u'\u2018' in position 23533: ordinal not in range > (128) > File: /usr/lib/python2.3/site-packages/mod_python/ > apache.py line 193 > Context: 190: if config.has_key > ("PythonEnablePdb"): > 191: result = pdb.runcall > (object, req) > 192: else: > 193: result = object(req) > 194: > 195: # stop cycling through > handlers > 196: if result != OK: > Traceback: /usr/lib/python2.3/site-packages/mod_python/ > apache.py:193 > > Original Stack Trace: > > Error: Error(UnicodeEncodeError): 'ascii' codec can't > encode character u'\u2018' in position 23533: ordinal not in range > (128) > File: /usr/local/mojam/lib/python2.3/site-packages/ > Myghty-0.99a-py2.3.egg/myghty/http/HTTPHandler.py line 397 > Context: 394: def write(self, text): > 395: if not self.headers_sent: > 396: self.send_headers() > 397: self.buffer.write(text) > 398: > 399: def writelines(self, lines): > 400: if not self.headers_sent: > Traceback: /usr/local/mojam/lib/python2.3/site-packages/ > Myghty-0.99a-py2.3.egg/myghty/http/HTTPHandler.py:397 > /usr/local/mojam/lib/python2.3/site-packages/ > Myghty-0.99a-py2.3.egg/myghty/buffer.py:75 > /usr/local/mojam/lib/python2.3/site-packages/ > Myghty-0.99a-py2.3.egg/myghty/buffer.py:87 > /usr/local/mojam/lib/python2.3/site-packages/ > Myghty-0.99a-py2.3.egg/myghty/request.py:161 > /usr/local/mojam/lib/python2.3/site-packages/ > Myghty-0.99a-py2.3.egg/myghty/request.py:253 > /usr/local/mojam/lib/python2.3/site-packages/ > Myghty-0.99a-py2.3.egg/myghty/exception.py:73 > /usr/local/mojam/lib/python2.3/site-packages/ > Myghty-0.99a-py2.3.egg/myghty/request.py:269 > /usr/local/mojam/lib/python2.3/site-packages/ > Myghty-0.99a-py2.3.egg/myghty/http/HTTPHandler.py:147 > /usr/local/mojam/lib/python2.3/site-packages/ > Myghty-0.99a-py2.3.egg/myghty/http/ApacheHandler.py:29 > /usr/lib/python2.3/site-packages/mod_python/ > apache.py:193 > > I don't think I've seen this particular problem before (the lack of > mention > of my code, not the UnicodeEncodeError). I tried restarting > Apache, but > that didn't help. Any other suggestions? > > Thx, > > -- > Skip Montanaro - sk...@po... - http://www.mojam.com/ > "On the academic side, effort is too often expended on finding precise > answers to the wrong questions." Baxter & Rennie, in "Financial > Calculus" > > ---------------------------------------------------------------------- > --- > Using Tomcat but need to do more? Need to support web services, > security? > Get stuff done quickly with pre-integrated technology to make your > job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache > Geronimo > http://sel.as-us.falkag.net/sel? > cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > Myghty-users mailing list > Myg...@li... > https://lists.sourceforge.net/lists/listinfo/myghty-users |
From: <sk...@po...> - 2006-08-27 22:57:57
|
I got a UnicodeEncodeError in some output just now. I'd be happy to hack around the problem for the short term but my code isn't mentioned at all in the stack trace: Myghty Template Error Error: Error(UnicodeEncodeError): 'ascii' codec can't encode character u'\u2018' in position 23533: ordinal not in range(128) File: /usr/lib/python2.3/site-packages/mod_python/apache.py line 193 Context: 190: if config.has_key("PythonEnablePdb"): 191: result = pdb.runcall(object, req) 192: else: 193: result = object(req) 194: 195: # stop cycling through handlers 196: if result != OK: Traceback: /usr/lib/python2.3/site-packages/mod_python/apache.py:193 Original Stack Trace: Error: Error(UnicodeEncodeError): 'ascii' codec can't encode character u'\u2018' in position 23533: ordinal not in range(128) File: /usr/local/mojam/lib/python2.3/site-packages/Myghty-0.99a-py2.3.egg/myghty/http/HTTPHandler.py line 397 Context: 394: def write(self, text): 395: if not self.headers_sent: 396: self.send_headers() 397: self.buffer.write(text) 398: 399: def writelines(self, lines): 400: if not self.headers_sent: Traceback: /usr/local/mojam/lib/python2.3/site-packages/Myghty-0.99a-py2.3.egg/myghty/http/HTTPHandler.py:397 /usr/local/mojam/lib/python2.3/site-packages/Myghty-0.99a-py2.3.egg/myghty/buffer.py:75 /usr/local/mojam/lib/python2.3/site-packages/Myghty-0.99a-py2.3.egg/myghty/buffer.py:87 /usr/local/mojam/lib/python2.3/site-packages/Myghty-0.99a-py2.3.egg/myghty/request.py:161 /usr/local/mojam/lib/python2.3/site-packages/Myghty-0.99a-py2.3.egg/myghty/request.py:253 /usr/local/mojam/lib/python2.3/site-packages/Myghty-0.99a-py2.3.egg/myghty/exception.py:73 /usr/local/mojam/lib/python2.3/site-packages/Myghty-0.99a-py2.3.egg/myghty/request.py:269 /usr/local/mojam/lib/python2.3/site-packages/Myghty-0.99a-py2.3.egg/myghty/http/HTTPHandler.py:147 /usr/local/mojam/lib/python2.3/site-packages/Myghty-0.99a-py2.3.egg/myghty/http/ApacheHandler.py:29 /usr/lib/python2.3/site-packages/mod_python/apache.py:193 I don't think I've seen this particular problem before (the lack of mention of my code, not the UnicodeEncodeError). I tried restarting Apache, but that didn't help. Any other suggestions? Thx, -- Skip Montanaro - sk...@po... - http://www.mojam.com/ "On the academic side, effort is too often expended on finding precise answers to the wrong questions." Baxter & Rennie, in "Financial Calculus" |
From: Michael B. <mi...@my...> - 2006-08-27 06:23:02
|
Hey list - long time no see ! thanks for hanging on. There is something new coming down the pike for Myghty; a major refactoring of its buffering system and request to support unicode and character encodings cleanly. You can specify the encoding of templates as well as the desired output encoding, as well as error handling schemes. You can also send unicodes and strings straight to m.write() with no problem. Jeff Dairiki has impressively managed to totally grok the myghty internals better than I do, and has put a ton of effort into this rework, which includes a new encoding module, new configuration options, and a whole lot of unit tests too. Anyway, id like to merge into the trunk and release soon; if some folks on the list have the cycles to give it a test spin (and post trac tickets for problems), that would be quite helpful. Its available via SVN at svn checkout http://svn.myghty.org/myghty/ branches/unicode-opt2/ . |
From: Michael B. <mi...@my...> - 2006-08-04 02:38:04
|
its "not new" because the browser still has a MYGHTY_SESSION_ID cookie marking that session...the user has a session (even though you deleted the file). you could also try saying "is_new = (session.created == session.accessed)" for the test youre looking for. On Aug 3, 2006, at 1:07 PM, Exe wrote: > Hello, myghty developers :) > Sorry if this message appears in list twice. > > I`ve got one problem with session.is_new :( > > The initial state: all caches and sessions removed from server and my > browser has no cookies. > I run this code: > > % session = m.get_session() > % if session.is_new: > % print "new session!" > % session['testkey']="test" > % session.save() > % else: > % print "not new session" > % print session['testkey'] > % > > > > It will print "new session!". After refresh in browser it will > print "not > new session\ntest". > Then i stop my webserver, remove all object cache and session > files. After > this i run my webserver and run code above. > It will print "not new session", and produce this error: > > Error: Error(KeyError): 'testkey' > File: /home/interda/mastersland.com/scripts/site/test.myt line 18 > Context: 15: % session.save() > 16: % else: > 17: % print "not new session" > 18: % print session['testkey'] > > In fact the session is new, but is_new returns false. Why? :( > > > //Exe > > ---------------------------------------------------------------------- > --- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to > share your > opinions on IT & business topics through brief surveys -- and earn > cash > http://www.techsay.com/default.php? > page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Myghty-users mailing list > Myg...@li... > https://lists.sourceforge.net/lists/listinfo/myghty-users |
From: Exe <xm...@me...> - 2006-08-03 17:07:27
|
Hello, myghty developers :) Sorry if this message appears in list twice. I`ve got one problem with session.is_new :( The initial state: all caches and sessions removed from server and my browser has no cookies. I run this code: % session =3D m.get_session() % if session.is_new: % print "new session!" % session['testkey']=3D"test" % session.save() % else: % print "not new session" % print session['testkey'] % It will print "new session!". After refresh in browser it will print "no= t new session\ntest". Then i stop my webserver, remove all object cache and session files. Aft= er this i run my webserver and run code above. It will print "not new session", and produce this error: Error: Error(KeyError): 'testkey' File: /home/interda/mastersland.com/scripts/site/test.myt line 18 Context: 15: % session.save() 16: % else: 17: % print "not new session" 18: % print session['testkey'] In fact the session is new, but is_new returns false. Why? :( //Exe |
From: Mike D. <mi...@de...> - 2006-08-01 01:33:09
|
Michael Bayer wrote: > with this component root: > >> 'C:\\pysrc\\pczendb\\cgi-bin\\hw\\myproject\\myproject\\components' > > and this file: > >>> C:\pysrc\pczendb\cgi-bin\hw\myproject\myproject\htdocs\index.myt > > well, first of all, youre making it look for files under "components" > but the file is physically under "htdocs". > > so the component root should be: > >>> C:\pysrc\pczendb\cgi-bin\hw\myproject\myproject\htdocs\ > > > and the url is relative to the component root: > > http://localhost/cgi-bin/hw/myghty.cgi/index.myt Thank you Michael - I got a welcome to the myghty app! message via Apache on Windows. Regards Mike > > > On Jul 31, 2006, at 12:01 AM, Mike Dewhirst wrote: > >> Mike Dewhirst wrote: >>> I'm at a brick wall having tried (I think) all combinations of >>> /path/to/index.myt having just installed myghty for testing. >>> >>> I installed the Demo Server and it worked OK. I have Apache serving >>> python scripts on this machine and unsuccessfully tried to use that >>> instead of server.py. >>> >>> I think the problem is my understanding of the docs in relation to >>> specifying paths. >>> >>> Thanks for any hints, pointers to docs etc >>> >>> Mike >>> >>> - - - - - - details - - - - - - >>> >>> This is where index.myt was put by the demo ... >>> >>> C:\pysrc\pczendb\cgi-bin\hw\myproject\myproject\htdocs\index.myt >>> >>> - - - - - - - - - - - - - - - - - - - - - >>> >>> This is where I pointed my browser ... >>> >>> http://127.0.0.1/cgi-bin/hw/myghty.cgi/myproject/myproject/htdocs/index.myt >>> >>> >>> - - - - - - - - - - - - - - - - - - - - - >>> >>> which responded with ... >>> >>> Response code 404 (no message) >>> Page: "/myproject/myproject/htdocs/index.myt" >>> >>> and Apache error log entry ... >>> >>> [Mon Jul 31 12:55:41 2006] [error] [client 127.0.0.1] TopLevelNotFound: >>> ComponentNotFound: Cant locate component >>> /myproject/myproject/htdocs/index.myt at >>> c:\\usr\\bin\\lib\\site-packages\\Myghty-1.0.2-py2.4.egg\\myghty\\request.py >>> >>> line 448 >>> >>> ... which seems totally reasonable because request.py line 448 raises >>> the ComponentNotFound exception ... >>> >>> 445 try: >>> 446 resolution = self.interpreter.resolve_component(path, >>> resolver_context = self.resolver_context, enable_dhandler = >>> self.use_dhandlers, declined_components = self.declined_components) >>> 447 except exception.ComponentNotFound, cfound: >>> 448 raise cfound.create_toplevel() >>> >>> - - - - - - - - - - - - - - - - - - - - - >>> >>> Here is my much edited myghty.cgi which I am sure is the source of my >>> trouble ... >>> >>> #!/usr/bin/python2.4 >>> # myghty cgi runner. place in cgi-bin directory and address Myghty >>> templates >>> # with URLs in the form: >>> # http://mysite.com/cgi-bin/myghty.cgi/path/to/template.myt >>> # component root. this is where the Myghty templates are. >>> component_root = >>> '/pysrc/pczendb/cgi-bin/hw/myproject/myproject/components' >>> # data directory. this is where Myghty puts its object files. >>> data_dir = '/pysrc/pczendb/cgi-bin/hw/myproject/myproject/cache' >> >> Also tried this but no luck ... >> component_root = >> 'C:\\pysrc\\pczendb\\cgi-bin\\hw\\myproject\\myproject\\components' >> # data directory. this is where Myghty puts its object files. >> data_dir = 'C:\\pysrc\\pczendb\\cgi-bin\\hw\\myproject\\myproject\\cache' >> >>> >>> # module components. >>> module_components = [] >>> >>> # libraries. Put paths to additional custom Python libraries here. >>> # lib = ['/path/to/custom/libraries'] >>> # import sys >>> # [sys.path.append(path) for path in lib] >>> >>> import myghty.CGIHandler as handler >>> >>> handler.handle( component_root=component_root, module_components = >>> module_components, data_dir=data_dir) >>> >>> >>> - - - - - - - - - - - - - - - - - - - - - >>> >>> Here is an excerpt from httpd.conf for my Apache 2.0.54 ... >>> >>> # >>> ScriptAlias /cgi-bin/ "C:/pysrc/pczendb/cgi-bin/" >>> # >>> <Directory "C:/pysrc/pczendb/cgi-bin"> >>> Options Indexes ExecCGI >>> AllowOverride None >>> Order allow,deny >>> Allow from all >>> </Directory> >>> >>> >>> ------------------------------------------------------------------------- >>> >>> Take Surveys. Earn Cash. Influence the Future of IT >>> Join SourceForge.net's Techsay panel and you'll get the chance to >>> share your >>> opinions on IT & business topics through brief surveys -- and earn cash >>> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV >>> >>> _______________________________________________ >>> Myghty-users mailing list >>> Myg...@li... >>> https://lists.sourceforge.net/lists/listinfo/myghty-users >>> >>> >> >> >> ------------------------------------------------------------------------- >> Take Surveys. Earn Cash. Influence the Future of IT >> Join SourceForge.net's Techsay panel and you'll get the chance to >> share your >> opinions on IT & business topics through brief surveys -- and earn cash >> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV >> _______________________________________________ >> Myghty-users mailing list >> Myg...@li... >> https://lists.sourceforge.net/lists/listinfo/myghty-users > > > |
From: Michael B. <mi...@zz...> - 2006-07-31 21:07:27
|
with this component root: > 'C:\\pysrc\\pczendb\\cgi-bin\\hw\\myproject\\myproject\\components' and this file: >> C:\pysrc\pczendb\cgi-bin\hw\myproject\myproject\htdocs\index.myt well, first of all, youre making it look for files under "components" but the file is physically under "htdocs". so the component root should be: >> C:\pysrc\pczendb\cgi-bin\hw\myproject\myproject\htdocs\ and the url is relative to the component root: http://localhost/cgi-bin/myghty.cgi/index.myt On Jul 31, 2006, at 12:01 AM, Mike Dewhirst wrote: > Mike Dewhirst wrote: >> I'm at a brick wall having tried (I think) all combinations of >> /path/to/index.myt having just installed myghty for testing. >> >> I installed the Demo Server and it worked OK. I have Apache serving >> python scripts on this machine and unsuccessfully tried to use that >> instead of server.py. >> >> I think the problem is my understanding of the docs in relation to >> specifying paths. >> >> Thanks for any hints, pointers to docs etc >> >> Mike >> >> - - - - - - details - - - - - - >> >> This is where index.myt was put by the demo ... >> >> C:\pysrc\pczendb\cgi-bin\hw\myproject\myproject\htdocs\index.myt >> >> - - - - - - - - - - - - - - - - - - - - - >> >> This is where I pointed my browser ... >> >> http://127.0.0.1/cgi-bin/hw/myghty.cgi/myproject/myproject/htdocs/ >> index.myt >> >> - - - - - - - - - - - - - - - - - - - - - >> >> which responded with ... >> >> Response code 404 (no message) >> Page: "/myproject/myproject/htdocs/index.myt" >> >> and Apache error log entry ... >> >> [Mon Jul 31 12:55:41 2006] [error] [client 127.0.0.1] >> TopLevelNotFound: >> ComponentNotFound: Cant locate component >> /myproject/myproject/htdocs/index.myt at >> c:\\usr\\bin\\lib\\site-packages\\Myghty-1.0.2-py2.4.egg\\myghty\ >> \request.py >> line 448 >> >> ... which seems totally reasonable because request.py line 448 raises >> the ComponentNotFound exception ... >> >> 445 try: >> 446 resolution = self.interpreter.resolve_component(path, >> resolver_context = self.resolver_context, enable_dhandler = >> self.use_dhandlers, declined_components = self.declined_components) >> 447 except exception.ComponentNotFound, cfound: >> 448 raise cfound.create_toplevel() >> >> - - - - - - - - - - - - - - - - - - - - - >> >> Here is my much edited myghty.cgi which I am sure is the source of my >> trouble ... >> >> #!/usr/bin/python2.4 >> # myghty cgi runner. place in cgi-bin directory and address Myghty >> templates >> # with URLs in the form: >> # http://mysite.com/cgi-bin/myghty.cgi/path/to/template.myt >> # component root. this is where the Myghty templates are. >> component_root = '/pysrc/pczendb/cgi-bin/hw/myproject/myproject/ >> components' >> # data directory. this is where Myghty puts its object files. >> data_dir = '/pysrc/pczendb/cgi-bin/hw/myproject/myproject/cache' > > Also tried this but no luck ... > component_root = > 'C:\\pysrc\\pczendb\\cgi-bin\\hw\\myproject\\myproject\\components' > # data directory. this is where Myghty puts its object files. > data_dir = 'C:\\pysrc\\pczendb\\cgi-bin\\hw\\myproject\\myproject\ > \cache' > >> >> # module components. >> module_components = [] >> >> # libraries. Put paths to additional custom Python libraries here. >> # lib = ['/path/to/custom/libraries'] >> # import sys >> # [sys.path.append(path) for path in lib] >> >> import myghty.CGIHandler as handler >> >> handler.handle( component_root=component_root, module_components = >> module_components, data_dir=data_dir) >> >> >> - - - - - - - - - - - - - - - - - - - - - >> >> Here is an excerpt from httpd.conf for my Apache 2.0.54 ... >> >> # >> ScriptAlias /cgi-bin/ "C:/pysrc/pczendb/cgi-bin/" >> # >> <Directory "C:/pysrc/pczendb/cgi-bin"> >> Options Indexes ExecCGI >> AllowOverride None >> Order allow,deny >> Allow from all >> </Directory> >> >> >> --------------------------------------------------------------------- >> ---- >> Take Surveys. Earn Cash. Influence the Future of IT >> Join SourceForge.net's Techsay panel and you'll get the chance to >> share your >> opinions on IT & business topics through brief surveys -- and earn >> cash >> http://www.techsay.com/default.php? >> page=join.php&p=sourceforge&CID=DEVDEV >> _______________________________________________ >> Myghty-users mailing list >> Myg...@li... >> https://lists.sourceforge.net/lists/listinfo/myghty-users >> >> > > > ---------------------------------------------------------------------- > --- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to > share your > opinions on IT & business topics through brief surveys -- and earn > cash > http://www.techsay.com/default.php? > page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Myghty-users mailing list > Myg...@li... > https://lists.sourceforge.net/lists/listinfo/myghty-users |
From: Mike D. <mi...@de...> - 2006-07-31 04:01:08
|
Mike Dewhirst wrote: > I'm at a brick wall having tried (I think) all combinations of > /path/to/index.myt having just installed myghty for testing. > > I installed the Demo Server and it worked OK. I have Apache serving > python scripts on this machine and unsuccessfully tried to use that > instead of server.py. > > I think the problem is my understanding of the docs in relation to > specifying paths. > > Thanks for any hints, pointers to docs etc > > Mike > > - - - - - - details - - - - - - > > This is where index.myt was put by the demo ... > > C:\pysrc\pczendb\cgi-bin\hw\myproject\myproject\htdocs\index.myt > > - - - - - - - - - - - - - - - - - - - - - > > This is where I pointed my browser ... > > http://127.0.0.1/cgi-bin/hw/myghty.cgi/myproject/myproject/htdocs/index.myt > > - - - - - - - - - - - - - - - - - - - - - > > which responded with ... > > Response code 404 (no message) > Page: "/myproject/myproject/htdocs/index.myt" > > and Apache error log entry ... > > [Mon Jul 31 12:55:41 2006] [error] [client 127.0.0.1] TopLevelNotFound: > ComponentNotFound: Cant locate component > /myproject/myproject/htdocs/index.myt at > c:\\usr\\bin\\lib\\site-packages\\Myghty-1.0.2-py2.4.egg\\myghty\\request.py > line 448 > > ... which seems totally reasonable because request.py line 448 raises > the ComponentNotFound exception ... > > 445 try: > 446 resolution = self.interpreter.resolve_component(path, > resolver_context = self.resolver_context, enable_dhandler = > self.use_dhandlers, declined_components = self.declined_components) > 447 except exception.ComponentNotFound, cfound: > 448 raise cfound.create_toplevel() > > - - - - - - - - - - - - - - - - - - - - - > > Here is my much edited myghty.cgi which I am sure is the source of my > trouble ... > > #!/usr/bin/python2.4 > # myghty cgi runner. place in cgi-bin directory and address Myghty > templates > # with URLs in the form: > # http://mysite.com/cgi-bin/myghty.cgi/path/to/template.myt > # component root. this is where the Myghty templates are. > component_root = '/pysrc/pczendb/cgi-bin/hw/myproject/myproject/components' > # data directory. this is where Myghty puts its object files. > data_dir = '/pysrc/pczendb/cgi-bin/hw/myproject/myproject/cache' Also tried this but no luck ... component_root = 'C:\\pysrc\\pczendb\\cgi-bin\\hw\\myproject\\myproject\\components' # data directory. this is where Myghty puts its object files. data_dir = 'C:\\pysrc\\pczendb\\cgi-bin\\hw\\myproject\\myproject\\cache' > > # module components. > module_components = [] > > # libraries. Put paths to additional custom Python libraries here. > # lib = ['/path/to/custom/libraries'] > # import sys > # [sys.path.append(path) for path in lib] > > import myghty.CGIHandler as handler > > handler.handle( component_root=component_root, module_components = > module_components, data_dir=data_dir) > > > - - - - - - - - - - - - - - - - - - - - - > > Here is an excerpt from httpd.conf for my Apache 2.0.54 ... > > # > ScriptAlias /cgi-bin/ "C:/pysrc/pczendb/cgi-bin/" > # > <Directory "C:/pysrc/pczendb/cgi-bin"> > Options Indexes ExecCGI > AllowOverride None > Order allow,deny > Allow from all > </Directory> > > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys -- and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Myghty-users mailing list > Myg...@li... > https://lists.sourceforge.net/lists/listinfo/myghty-users > > |
From: Mike D. <mi...@de...> - 2006-07-31 03:53:48
|
I'm at a brick wall having tried (I think) all combinations of /path/to/index.myt having just installed myghty for testing. I installed the Demo Server and it worked OK. I have Apache serving python scripts on this machine and unsuccessfully tried to use that instead of server.py. I think the problem is my understanding of the docs in relation to specifying paths. Thanks for any hints, pointers to docs etc Mike - - - - - - details - - - - - - This is where index.myt was put by the demo ... C:\pysrc\pczendb\cgi-bin\hw\myproject\myproject\htdocs\index.myt - - - - - - - - - - - - - - - - - - - - - This is where I pointed my browser ... http://127.0.0.1/cgi-bin/hw/myghty.cgi/myproject/myproject/htdocs/index.myt - - - - - - - - - - - - - - - - - - - - - which responded with ... Response code 404 (no message) Page: "/myproject/myproject/htdocs/index.myt" and Apache error log entry ... [Mon Jul 31 12:55:41 2006] [error] [client 127.0.0.1] TopLevelNotFound: ComponentNotFound: Cant locate component /myproject/myproject/htdocs/index.myt at c:\\usr\\bin\\lib\\site-packages\\Myghty-1.0.2-py2.4.egg\\myghty\\request.py line 448 ... which seems totally reasonable because request.py line 448 raises the ComponentNotFound exception ... 445 try: 446 resolution = self.interpreter.resolve_component(path, resolver_context = self.resolver_context, enable_dhandler = self.use_dhandlers, declined_components = self.declined_components) 447 except exception.ComponentNotFound, cfound: 448 raise cfound.create_toplevel() - - - - - - - - - - - - - - - - - - - - - Here is my much edited myghty.cgi which I am sure is the source of my trouble ... #!/usr/bin/python2.4 # myghty cgi runner. place in cgi-bin directory and address Myghty templates # with URLs in the form: # http://mysite.com/cgi-bin/myghty.cgi/path/to/template.myt # component root. this is where the Myghty templates are. component_root = '/pysrc/pczendb/cgi-bin/hw/myproject/myproject/components' # data directory. this is where Myghty puts its object files. data_dir = '/pysrc/pczendb/cgi-bin/hw/myproject/myproject/cache' # module components. module_components = [] # libraries. Put paths to additional custom Python libraries here. # lib = ['/path/to/custom/libraries'] # import sys # [sys.path.append(path) for path in lib] import myghty.CGIHandler as handler handler.handle( component_root=component_root, module_components = module_components, data_dir=data_dir) - - - - - - - - - - - - - - - - - - - - - Here is an excerpt from httpd.conf for my Apache 2.0.54 ... # ScriptAlias /cgi-bin/ "C:/pysrc/pczendb/cgi-bin/" # <Directory "C:/pysrc/pczendb/cgi-bin"> Options Indexes ExecCGI AllowOverride None Order allow,deny Allow from all </Directory> |
From: Exe <xm...@me...> - 2006-07-29 10:40:55
|
Hello, myghty developers :) I`ve got one problem with session.is_new :( The initial state: all caches and sessions removed from server and my = browser has no cookies. I run this code: % session =3D m.get_session() % if session.is_new: % print "new session!" % session['testkey']=3D"test" % session.save() % else: % print "not new session" % print session['testkey'] % It will print "new session!". After refresh in browser it will print "no= t = new session\ntest". Then i stop my webserver, remove all object cache and session files. Aft= er = this i run my webserver and run code above. It will print "not new session", and produce this error: Error: Error(KeyError): 'testkey' File: /home/interda/mastersland.com/scripts/site/test.myt line 18 Context: 15: % session.save() 16: % else: 17: % print "not new session" 18: % print session['testkey'] In fact the session is new, but is_new returns false. Why? :( //Exe |
From: Georges V. <gv...@fr...> - 2006-07-20 23:59:02
|
thank you Deron Meranda wrote: > On 7/20/06, Georges Villot <gv...@fr...> wrote: > >> Hi, >> >> what is the easiest way to set the content type in Myghty ? >> I'm trying to set it to 'text/xml' to provide an XML feed using HTTP... >> > > <%python scope="init"> > r.content_type = 'text/xml' > </%python> > -- Georges Villot Real World Data M: 04 0261 3719 |
From: Deron M. <der...@gm...> - 2006-07-20 19:58:22
|
On 7/20/06, Georges Villot <gv...@fr...> wrote: > Hi, > > what is the easiest way to set the content type in Myghty ? > I'm trying to set it to 'text/xml' to provide an XML feed using HTTP... <%python scope="init"> r.content_type = 'text/xml' </%python> -- Deron Meranda |
From: Georges V. <gv...@fr...> - 2006-07-20 16:33:12
|
Hi, what is the easiest way to set the content type in Myghty ? I'm trying to set it to 'text/xml' to provide an XML feed using HTTP... Thank you in advance for all, georges. -- Georges Villot Real World Data M: 04 0261 3719 |
From: Michael B. <mi...@my...> - 2006-07-18 20:19:55
|
the Session object itself is what knows about how its linked to the request. for the purposes of encapsulation id rather have this as a static method on Session. On Jul 18, 2006, at 8:32 AM, Exe wrote: > Hello, Michael. > Thanks you for your reply. May be include this code to myghty? > Not a real code, just draft: > > def m.have_session: > cookie = Cookie.SimpleCookie(input=request.headers_in.get > ('cookie', '')) > if cookie.has_key('myghty_session_id') and session_not_exired and > session_valid: > return 1 > else: > return 0 > > > > On Sun, 16 Jul 2006 20:08:16 +0400, Michael Bayer <mi...@my...> > wrote: > >> look in the request for the cookie header, and check for the key >> "myghty_session_id". >> >> cookie = Cookie.SimpleCookie(input=request.headers_in.get >> ('cookie', '')) >> if cookie.has_key('myghty_session_id'): >> ... >> >> >>> I`ve got one question about sessions. How can i check either have >>> client >>> session or not without of session creation? > > ---------------------------------------------------------------------- > --- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to > share your > opinions on IT & business topics through brief surveys -- and earn > cash > http://www.techsay.com/default.php? > page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Myghty-users mailing list > Myg...@li... > https://lists.sourceforge.net/lists/listinfo/myghty-users |
From: Exe <xm...@me...> - 2006-07-18 12:33:06
|
Hello, Michael. Thanks you for your reply. May be include this code to myghty? Not a real code, just draft: def m.have_session: cookie =3D Cookie.SimpleCookie(input=3Drequest.headers_in.get('cookie',= '')) if cookie.has_key('myghty_session_id') and session_not_exired and = session_valid: return 1 else: return 0 On Sun, 16 Jul 2006 20:08:16 +0400, Michael Bayer <mi...@my...> wrot= e: > look in the request for the cookie header, and check for the key = > "myghty_session_id". > > cookie =3D Cookie.SimpleCookie(input=3Drequest.headers_in.get('cookie'= , '')) > if cookie.has_key('myghty_session_id'): > ... > > >> I`ve got one question about sessions. How can i check either have cli= ent >> session or not without of session creation? |
From: Michael B. <mi...@my...> - 2006-07-16 16:08:29
|
look in the request for the cookie header, and check for the key "myghty_session_id". cookie = Cookie.SimpleCookie(input=request.headers_in.get('cookie', '')) if cookie.has_key('myghty_session_id'): ... On Jul 15, 2006, at 6:58 PM, Exe wrote: > Hello! > > I`ve got one question about sessions. How can i check either have > client > session or not without of session creation? > This code will create new session what is not very good: > =========== > session=m.get_session() > if ( session.is_new ): ... > =========== > > Thanx for reply :) > > //Exe > > > ---------------------------------------------------------------------- > --- > Using Tomcat but need to do more? Need to support web services, > security? > Get stuff done quickly with pre-integrated technology to make your > job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache > Geronimo > http://sel.as-us.falkag.net/sel? > cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > Myghty-users mailing list > Myg...@li... > https://lists.sourceforge.net/lists/listinfo/myghty-users |
From: Exe <xm...@me...> - 2006-07-15 22:59:01
|
Hello! I`ve got one question about sessions. How can i check either have client= session or not without of session creation? This code will create new session what is not very good: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D session=3Dm.get_session() if ( session.is_new ): ... =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Thanx for reply :) //Exe |
From: Michael B. <mi...@zz...> - 2006-07-07 14:22:10
|
just call it as a plain function, since thats all it is.... On Jul 7, 2006, at 9:14 AM, HD Mail wrote: > Is there a way to call closures programmatically ? m.comp doesn't work > with it. > > Thanks > > Huy > > Using Tomcat but need to do more? Need to support web services, > security? > Get stuff done quickly with pre-integrated technology to make your > job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache > Geronimo > http://sel.as-us.falkag.net/sel? > cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > Myghty-users mailing list > Myg...@li... > https://lists.sourceforge.net/lists/listinfo/myghty-users |
From: HD M. <hd...@si...> - 2006-07-07 13:14:48
|
Is there a way to call closures programmatically ? m.comp doesn't work with it. Thanks Huy |
From: Michael B. <mi...@my...> - 2006-06-26 13:26:09
|
you probably want to create a custom exception handling function that consumes only the one exception you want (i.e. returns True), and returns False for all other exceptions. On Jun 24, 2006, at 7:00 PM, David Geller wrote: > Hi all, > > This probably reflects my ignorance of Python exception handling in > general, but here goes: > > As a rule, I would like Myghty to not display stack traces on the > screen, but rather write the trace into the Apache errorlog, should > Myghty encounter an un-caught exception within its execution. This > works > fine, via setting variables like: > > PythonOption MyghtyLogErrors True > PythonOption MyghtyOutputErrors False > > So, if there *is* an uncaught exception while processing a > template, the > trace will be written into the log. > > However, there is a case, where, inside a Myghty template, I want to > raise an exception which is caught by higher-up application logic > in the > program. However, in this case, I *do not* want a stack trace > written to > the log. While Myghty seems to re-raise the exception, and I can catch > it at the higher level, I would like to eliminate the stack trace for > this exception class only. > > Is there a way to selectively turn off the stack trace? > > One way I think this could be done is with a custom error handler > which > passes most errors to the standard handler straight through, but > processes the exceptions in question specially. But I am not quite > sure > how this would work... > > Thanks, > > David > > > > > Using Tomcat but need to do more? Need to support web services, > security? > Get stuff done quickly with pre-integrated technology to make your > job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache > Geronimo > http://sel.as-us.falkag.net/sel? > cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > Myghty-users mailing list > Myg...@li... > https://lists.sourceforge.net/lists/listinfo/myghty-users |
From: Cole T. <col...@gm...> - 2006-06-26 13:19:54
|
On 6/24/06, David Geller <dg...@gm...> wrote: > Hi all, > > However, there is a case, where, inside a Myghty template, I want to > raise an exception which is caught by higher-up application logic in the > program. However, in this case, I *do not* want a stack trace written to > the log. While Myghty seems to re-raise the exception, and I can catch > it at the higher level, I would like to eliminate the stack trace for > this exception class only. > > Is there a way to selectively turn off the stack trace? My understanding is that if the exception is actually caught, no stack trace will be generated... -- Cole Tuininga http://www.tuininga.org/ |
From: David G. <dg...@gm...> - 2006-06-24 23:01:04
|
Hi all, This probably reflects my ignorance of Python exception handling in general, but here goes: As a rule, I would like Myghty to not display stack traces on the screen, but rather write the trace into the Apache errorlog, should Myghty encounter an un-caught exception within its execution. This works fine, via setting variables like: PythonOption MyghtyLogErrors True PythonOption MyghtyOutputErrors False So, if there *is* an uncaught exception while processing a template, the trace will be written into the log. However, there is a case, where, inside a Myghty template, I want to raise an exception which is caught by higher-up application logic in the program. However, in this case, I *do not* want a stack trace written to the log. While Myghty seems to re-raise the exception, and I can catch it at the higher level, I would like to eliminate the stack trace for this exception class only. Is there a way to selectively turn off the stack trace? One way I think this could be done is with a custom error handler which passes most errors to the standard handler straight through, but processes the exceptions in question specially. But I am not quite sure how this would work... Thanks, David |