Screenshot instructions:
Windows
Mac
Red Hat Linux
Ubuntu
Click URL instructions:
Right-click on ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)
From: Tom Schwaller <tom.schwaller@we...> - 2004-12-31 13:02:21
|
Has anybody used Webware together with the Kid Template language (which is based on ElementTree using concepts from XSLT, TAL and PHP in a very nice and simple mix, which I liked immediately). http://splice.sourceforge.net/kid/ I know there are so many different template langauages and concepts around http://www.python.org/cgi-bin/moinmoin/WebProgramming http://wact.sourceforge.net/index.php/TemplateView but what I like about Kid is it's somewhat more Pythonic flavor than others. agree, disagree? Tom |
From: Winston Wolff <winstonwolff@ca...> - 2004-12-31 16:20:44
Attachments:
text/enriched
|
It looks very nice syntax wise. I'm wondering how to best use it in Servlets though. Can you have a Kid template inherit from WebKit.Page? If not, how would you use a kid template? The only way I see right off the bat is to write a python servlet that includes the Kid template. But that means writing a python class for every template. -winston On Dec 31, 2004, at 8:02 AM, Tom Schwaller wrote: > Has anybody used Webware together with the Kid Template language > (which is based on ElementTree using concepts from XSLT, TAL and > PHP in a very nice and simple mix, which I liked immediately). > > http://splice.sourceforge.net/kid/ > > I know there are so many different template langauages > and concepts around > > http://www.python.org/cgi-bin/moinmoin/WebProgramming > http://wact.sourceforge.net/index.php/TemplateView > > but what I like about Kid is it's somewhat more Pythonic flavor > than others. > > agree, disagree? > > Tom > > > > ------------------------------------------------------- > The SF.Net email is sponsored by: Beat the post-holiday blues > Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. > It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt > _______________________________________________ > Webware-discuss mailing list > Webware-discuss@... > https://lists.sourceforge.net/lists/listinfo/webware-discuss > _________________________________________ winston wolff - (646) 827-2242 - http://www.stratolab.com - learning by creating |
From: Winston Wolff <winstonwolff@ca...> - 2005-01-02 21:59:47
Attachments:
text/enriched
|
So I'm wondering, is there a way to compile a Kid template into a class, and then have another kid template inherit from that class, extending just certain parts? -ww On Dec 31, 2004, at 11:20 AM, Winston Wolff wrote: > It looks very nice syntax wise. I'm wondering how to best use it in > Servlets though. Can you have a Kid template inherit from > WebKit.Page? If not, how would you use a kid template? The only way > I see right off the bat is to write a python servlet that includes the > Kid template. But that means writing a python class for every > template. > > -winston > > On Dec 31, 2004, at 8:02 AM, Tom Schwaller wrote: > >> Has anybody used Webware together with the Kid Template language >> (which is based on ElementTree using concepts from XSLT, TAL and >> PHP in a very nice and simple mix, which I liked immediately). >> >> http://splice.sourceforge.net/kid/ >> >> I know there are so many different template langauages >> and concepts around >> >> http://www.python.org/cgi-bin/moinmoin/WebProgramming >> http://wact.sourceforge.net/index.php/TemplateView >> >> but what I like about Kid is it's somewhat more Pythonic flavor >> than others. >> >> agree, disagree? >> >> Tom >> >> >> >> ------------------------------------------------------- >> The SF.Net email is sponsored by: Beat the post-holiday blues >> Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. >> It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt >> _______________________________________________ >> Webware-discuss mailing list >> Webware-discuss@... >> https://lists.sourceforge.net/lists/listinfo/webware-discuss >> > _________________________________________ > winston wolff - (646) 827-2242 - http://www.stratolab.com - learning > by creating > _________________________________________ winston wolff - (646) 827-2242 - http://www.stratolab.com - learning by creating |
From: Michel Thadeu <michel_ts@ya...> - 2005-01-03 00:38:10
|
--- Winston Wolff <winstonwolff@...> escreveu: > So I'm wondering, is there a way to compile a Kid template into a > class, and then have another kid template inherit from that class, > extending just certain parts? This will be wonderfull! It's just what I looking for, a way to create a generic design for a site and extend the design either by another templates or throught servlets... Today I use cheetah for this stuff, but I think the tal syntax is a better one. I saw a the examples and I think the kid doesn't create a class, it creates a module with a function to be called: expand. But I don't think it's hard to create a ServletFactory to kid. so long ===== -- Michel Thadeu Sabchuk Curitiba/PR _______________________________________________________ Yahoo! Acesso Grátis - Instale o discador do Yahoo! agora. http://br.acesso.yahoo.com/ - Internet rápida e grátis |
From: Winston Wolff <winstonwolff@ca...> - 2005-01-03 16:57:02
Attachments:
text/enriched
|
I've already written a CheetahServletFactory which does a similar=20 thing, so I can change it for Kid and post it in a few days. Then=20 we'll see about the inheritance aspect. -winston On Jan 2, 2005, at 7:37 PM, Michel Thadeu wrote: > --- Winston Wolff <winstonwolff@...> escreveu: >> So I'm wondering, is there a way to compile a Kid template into a >> class, and then have another kid template inherit from that class, >> extending just certain parts? > > This will be wonderfull! It's just what I looking for, a way to create > a generic design for a site and extend the design either by another > templates or throught servlets... Today I use cheetah for this stuff, > but I think the tal syntax is a better one. > > I saw a the examples and I think the kid doesn't create a class, it > creates a module with a function to be called: expand. But I don't > think it's hard to create a ServletFactory to kid. > > so long > > =3D=3D=3D=3D=3D > -- > Michel Thadeu Sabchuk > Curitiba/PR > > > =09 > =09 > =09 > _______________________________________________________ > Yahoo! Acesso Gr=E1tis - Instale o discador do Yahoo! agora.=20 > http://br.acesso.yahoo.com/ - Internet r=E1pida e gr=E1tis > > _________________________________________ winston wolff - (646) 827-2242 - http://www.stratolab.com - learning by=20= creating |
From: Winston Wolff <winstonwolff@ca...> - 2005-01-03 23:22:06
Attachments:
text/enriched
|
Well, I tried to download and run Kid, and it fails. My system is Mac =20= OS X, 1.3.7. Python is v2.3. =95 Downloaded Kid-0.3 =95 Downloaded ElementTree =95 Added both things to python path. =95 Run KIDC -s Kid-0.3/test/basic-test.html.kid to produce the Python = =20 file below. =95 Run python basic-test.html.py and I get the error below. I tried looking through the code in basic-test.html.py but had =20 difficulty understanding a word of it. Something to do with the way =20 Kid is compiling the "for fruit in fruits" statement into code. =20 Anybody have any pointers? ------------------------ basic-test.html.py: from __future__ import generators from elementtree import ElementTree from kid.util import * import pulltree from pulltree import START, END, TEXT, TAIL, PullElement as Element __all__ =3D ["expand"] encoding =3D "utf-8" media_type =3D 'text/html' title =3D "Hello World" def say_hello(): return "Hello world!" fruits =3D ["apple", "orange", "kiwi", "M&M"] some_links =3D [('http://python.org';, 'Python'), ('http://www.planetpython.org/';, 'Planet Python')] import time def expand(context=3DNone): context =3D context or {} _elem =3D None _e =3D Element('html', attrib=3D_k_attrib({})) _e.namespaces =3D {u'http://naeblis.cx/ns/kid#';: u'kid'} (_e.parent, _elem) =3D (_elem, _e) yield (START, _elem) yield ('text', '\n ') _e =3D Element('head', attrib=3D_k_attrib({})) (_e.parent, _elem) =3D (_elem, _e) yield (START, _elem) yield ('text', '\n ') _cont =3D _k_generate_content(title, TEXT) _e =3D Element('title', attrib=3D_k_attrib({})) (_e.parent, _elem) =3D (_elem, _e) yield (START, _elem) if _cont is not None: for _ev in _cont: yield _ev yield (END, _elem); _elem =3D _elem.parent yield ('tail', '\n ') yield (END, _elem); _elem =3D _elem.parent yield ('tail', '\n ') _e =3D Element('body', attrib=3D_k_attrib({})) (_e.parent, _elem) =3D (_elem, _e) yield (START, _elem) yield ('text', '\n ') _e =3D Element('h3', attrib=3D_k_attrib({})) (_e.parent, _elem) =3D (_elem, _e) yield (START, _elem) yield ('text', 'kid:content') yield (END, _elem); _elem =3D _elem.parent yield ('tail', '\n ') _cont =3D _k_generate_content(say_hello(), TEXT) _e =3D Element('p', attrib=3D_k_attrib({})) (_e.parent, _elem) =3D (_elem, _e) yield (START, _elem) if _cont is not None: for _ev in _cont: yield _ev yield (END, _elem); _elem =3D _elem.parent yield ('tail', '\n\n ') _e =3D Element('h3', attrib=3D_k_attrib({})) (_e.parent, _elem) =3D (_elem, _e) yield (START, _elem) yield ('text', 'kid:repeat') yield (END, _elem); _elem =3D _elem.parent yield ('tail', '\n ') _e =3D Element('p', attrib=3D_k_attrib({})) (_e.parent, _elem) =3D (_elem, _e) yield (START, _elem) yield ('text', 'These are some things I like to eat:') yield (END, _elem); _elem =3D _elem.parent yield ('tail', '\n ') _e =3D Element('ul', attrib=3D_k_attrib({})) (_e.parent, _elem) =3D (_elem, _e) yield (START, _elem) yield ('text', '\n ') _cont =3D _k_generate_content(fruit, TEXT) _e =3D Element('li', =20 attrib=3D_k_attrib({'{http://naeblis.cx/ns/kid#}repeat';: 'fruit in =20 fruits'})) (_e.parent, _elem) =3D (_elem, _e) yield (START, _elem) if _cont is not None: for _ev in _cont: yield _ev yield (END, _elem); _elem =3D _elem.parent yield ('tail', '\n ') yield (END, _elem); _elem =3D _elem.parent yield ('tail', '\n \n ') _e =3D Element('h3', attrib=3D_k_attrib({})) (_e.parent, _elem) =3D (_elem, _e) yield (START, _elem) yield ('text', 'kid:if (False value)') yield (END, _elem); _elem =3D _elem.parent yield ('tail', '\n ') _e =3D Element('p', attrib=3D_k_attrib({})) (_e.parent, _elem) =3D (_elem, _e) yield (START, _elem) yield ('text', "You shouldn't see anything after this = paragraph..") yield (END, _elem); _elem =3D _elem.parent yield ('tail', '\n ') if False: _e =3D Element('p', attrib=3D_k_attrib({})) (_e.parent, _elem) =3D (_elem, _e) yield (START, _elem) yield ('text', 'This should not be output or put out.') yield (END, _elem); _elem =3D _elem.parent yield ('tail', '\n \n ') _e =3D Element('h3', attrib=3D_k_attrib({})) (_e.parent, _elem) =3D (_elem, _e) yield (START, _elem) yield ('text', 'kid:if (True value)') yield (END, _elem); _elem =3D _elem.parent yield ('tail', '\n ') _e =3D Element('p', attrib=3D_k_attrib({})) (_e.parent, _elem) =3D (_elem, _e) yield (START, _elem) yield ('text', 'You ') _e =3D Element('em', attrib=3D_k_attrib({})) (_e.parent, _elem) =3D (_elem, _e) yield (START, _elem) yield ('text', 'should') yield (END, _elem); _elem =3D _elem.parent yield ('tail', ' see something after this paragraph..') yield (END, _elem); _elem =3D _elem.parent yield ('tail', '\n ') if True: _e =3D Element('p', attrib=3D_k_attrib({})) (_e.parent, _elem) =3D (_elem, _e) yield (START, _elem) yield ('text', 'This should be output.') yield (END, _elem); _elem =3D _elem.parent yield ('tail', '\n\n ') _e =3D Element('h3', attrib=3D_k_attrib({})) (_e.parent, _elem) =3D (_elem, _e) yield (START, _elem) yield ('text', 'attribute interpolation') yield (END, _elem); _elem =3D _elem.parent yield ('tail', '\n ') _e =3D Element('ul', attrib=3D_k_attrib({})) (_e.parent, _elem) =3D (_elem, _e) yield (START, _elem) yield ('text', '\n ') _e =3D Element('li', =20 attrib=3D_k_attrib({'{http://naeblis.cx/ns/kid#}repeat';: 'link in =20 some_links'})) (_e.parent, _elem) =3D (_elem, _e) yield (START, _elem) yield ('text', '\n ') _cont =3D _k_generate_content(link[1], TEXT) _e =3D Element('a', attrib=3D_k_attrib({'href': [link[0]]})) (_e.parent, _elem) =3D (_elem, _e) yield (START, _elem) if _cont is not None: for _ev in _cont: yield _ev yield (END, _elem); _elem =3D _elem.parent yield ('tail', '\n ') yield (END, _elem); _elem =3D _elem.parent yield ('tail', '\n ') yield (END, _elem); _elem =3D _elem.parent yield ('tail', '\n ') _e =3D Element('p', attrib=3D_k_attrib({})) (_e.parent, _elem) =3D (_elem, _e) yield (START, _elem) yield ('text', '\n ') _e =3D Element('a', attrib=3D_k_attrib({'title': ['This = ','should',' read =20 ','like',' a ','normal',' sentence.']})) (_e.parent, _elem) =3D (_elem, _e) yield (START, _elem) yield ('text', 'The title attribute should read: "This should = read =20 like a normal sentence."') yield (END, _elem); _elem =3D _elem.parent yield ('tail', '\n ') yield (END, _elem); _elem =3D _elem.parent yield ('tail', '\n ') _e =3D Element('p', attrib=3D_k_attrib({})) (_e.parent, _elem) =3D (_elem, _e) yield (START, _elem) yield ('text', '\n ') _e =3D Element('a', attrib=3D_k_attrib({'title': [None,None]})) (_e.parent, _elem) =3D (_elem, _e) yield (START, _elem) yield ('text', "The title attribute of this element shouldn't be = =20 output at all") yield (END, _elem); _elem =3D _elem.parent yield ('tail', '\n ') yield (END, _elem); _elem =3D _elem.parent yield ('tail', '\n\n ') _e =3D Element('h3', attrib=3D_k_attrib({})) (_e.parent, _elem) =3D (_elem, _e) yield (START, _elem) yield ('text', 'kid:omit') yield (END, _elem); _elem =3D _elem.parent yield ('tail', '\n ') _e =3D Element('p', attrib=3D_k_attrib({})) (_e.parent, _elem) =3D (_elem, _e) yield (START, _elem) yield ('text', '\n ') yield ('text', '\n The containing <div> should be = omitted.\n =20 ') yield ('tail', '\n ') if not False: _e =3D Element('div', attrib=3D_k_attrib({})) (_e.parent, _elem) =3D (_elem, _e) yield (START, _elem) yield ('text', '\n The containing <div> should not be =20 omitted.\n ') if not False: yield (END, _elem); _elem =3D _elem.parent yield ('tail', '\n ') if not True: _e =3D Element('div', attrib=3D_k_attrib({})) (_e.parent, _elem) =3D (_elem, _e) yield (START, _elem) yield ('text', '\n The containing <div> should be = omitted.\n =20 ') if not True: yield (END, _elem); _elem =3D _elem.parent yield ('tail', '\n ') yield (END, _elem); _elem =3D _elem.parent yield ('tail', '\n \n ') _e =3D Element('h3', attrib=3D_k_attrib({})) (_e.parent, _elem) =3D (_elem, _e) yield (START, _elem) yield ('text', 'kid:repeat (with nesting)') yield (END, _elem); _elem =3D _elem.parent yield ('tail', '\n ') _e =3D Element('ul', attrib=3D_k_attrib({})) (_e.parent, _elem) =3D (_elem, _e) yield (START, _elem) yield ('text', '\n ') _e =3D Element('li', =20 attrib=3D_k_attrib({'{http://naeblis.cx/ns/kid#}repeat';: 'num1 in =20 range(1,6)'})) (_e.parent, _elem) =3D (_elem, _e) yield (START, _elem) yield ('text', '\n ') _cont =3D _k_generate_content(num1, TEXT) _e =3D Element('p', attrib=3D_k_attrib({})) (_e.parent, _elem) =3D (_elem, _e) yield (START, _elem) if _cont is not None: for _ev in _cont: yield _ev yield (END, _elem); _elem =3D _elem.parent yield ('tail', '\n ') _e =3D Element('ul', attrib=3D_k_attrib({})) (_e.parent, _elem) =3D (_elem, _e) yield (START, _elem) yield ('text', '\n ') _cont =3D _k_generate_content(str(num1) + str(num2), TEXT) _e =3D Element('li', =20 attrib=3D_k_attrib({'{http://naeblis.cx/ns/kid#}repeat';: 'num2 in =20 range(1,6)'})) (_e.parent, _elem) =3D (_elem, _e) yield (START, _elem) if _cont is not None: for _ev in _cont: yield _ev yield (END, _elem); _elem =3D _elem.parent yield ('tail', '\n ') yield (END, _elem); _elem =3D _elem.parent yield ('tail', '\n ') yield ('tail', ' ') yield (END, _elem); _elem =3D _elem.parent yield ('tail', '\n ') yield (END, _elem); _elem =3D _elem.parent yield ('tail', '\n ') yield (END, _elem); _elem =3D _elem.parent yield ('tail', '\n') yield (END, _elem); _elem =3D _elem.parent yield (TAIL, '\n') if __name__ =3D=3D '__main__': import sys pulltree.write(expand(), sys.stdout) -------------------- Sample output when running python basic-test.html.py winstonw@... ~/svn/python/extern/kid-0.3/test% python =20 basic-test.html.py <?xml version=3D'1.0' encoding=3D'utf-8'?> <html xmlns:kid=3D"http://naeblis.cx/ns/kid#"> <head> <title>Hello World</title> </head> <body> <h3>kid:content</h3> <p>Hello world!</p> <h3>kid:repeat</h3> <p>These are some things I like to eat:</p> <ul> Traceback (most recent call last): File "basic-test.html.py", line 257, in ? pulltree.write(expand(), sys.stdout) File =20 "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/=20 python2.3/site-packages/pulltree.py", line 149, in write for text in serialize(stream, xml_decl, encoding): File =20 "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/=20 python2.3/site-packages/pulltree.py", line 171, in serialize for ev, item in stream: File "basic-test.html.py", line 76, in expand _cont =3D _k_generate_content(fruit, TEXT) NameError: global name 'fruit' is not defined _________________________________________ winston wolff - (646) 827-2242 - http://www.stratolab.com - learning by =20= creating |
From: Tom Schwaller <tom.schwaller@we...> - 2005-01-03 04:23:07
|
Hi, I did some research and found the following e-mail http://www.mail-archive.com/webware-discuss@.../msg00114.html It seems that I wrote a TALKit 3 years ago, but the code is not available on http://www.python.de anymore (I found it and other material on one of my hard drives, but it looks quite strange and I have forgotten how it works ;-(. Restarting from scratch seems the better approach to me. Look at PSPKit how to do that. Use a KidServletFactory first On Fri, 31.12.2004, 11:20 -0500 Winston Wolf wrotef: > It looks very nice syntax wise. I'm wondering how to best use it in > Servlets though. Can you have a Kid template inherit from > WebKit.Page? If not, how would you use a kid template? The only way > I see right off the bat is to write a python servlet that includes the > Kid template. But that means writing a python class for every > template. and generate the class you mention in the second approach automatically. The first approach is used by PSP too, so it seems to me that both approaches are possible. Folks, please correct me if I am wrong here! I also found this mail from you (Winston) on the cheetah-template list, unfortunately the code you speak about is not available in the SF.net mail archive. Can you maybe repost it here (or send me the code directly) if it is still relevant? http://sourceforge.net/mailarchive/forum.php?thread_id=5379955&forum_id=1542 On Fri, 3 Sep 2004 10:09:28 -0700, Winston WOLFF wrote: > Thanks to everybody for all the pointers. Attached is my short python > program to automatically compile Cheetah templates. I was originally > going to write a Webware plugin, but then I realized that it would only > compile templates that were queried. This would be a problem here to, but many people on this list have used all this stuff in their projects and have certainly a much better insight than me. I have to relearn most of it at the moment ;-) On Sun, 02.01.2005, 16:59 -0500 Winston Wolff wrote: > So I'm wondering, is there a way to compile a Kid template into a > class, and then have another kid template inherit from that class, > extending just certain parts? I do not see any reason why this should not work.. Personally I think is is worth the effort to write a first class KidKit (funny name!), solving all this problems and enabling Webware beginners to put .kid files into their directories and Webware doing all the magic, something I never understood why Cheetah did not do (it was planned, but I have never seen it and people seem still to ask for it). I like out of the box solutions! ;-) Maybe one should prototype all this new stuff directly with Ian Bickings new code http://svn.colorstudy.com/trunk/WSGIKit/ P.S: Ideas for Code (dont't flame me ;-)) Cheetah-Aquarium-Integation http://cvs.sourceforge.net/viewcvs.py/aquarium/aquarium/aquarium/util/InternalLibrary.py?view=markup Cheetah-mod_python-Integration http://wiki.cheetahtemplate.org/cheetahrecipes.html Maybe a simple mod_python Servlet with Kid for hardcore mod_python fans? http://home.comcast.net/~d.popowich/mpservlets/ So many Python template engines, so many Python web development frameworks and after reading http://www.ds9a.nl/webcoding.html even template engines seem questionable ;-) Tom |
From: Nick Murtagh <nickm@go...> - 2005-01-03 16:19:28
|
Tom Schwaller wrote: > and after reading > > http://www.ds9a.nl/webcoding.html > > even template engines seem questionable ;-) Interesting, I recently came across this: http://www-106.ibm.com/developerworks/library/j-contin.html which talks about using continuations in web programming (Apache Cocoon). It would be cool to have something like this in Python. Should be doable with stackless, I've heard mention of people using stackless with zope. The code referenced by the above article http://csoki.ki.iif.hu/~vitezg/impostor/ doesn't appear to use continuations and hence has problems handling back / forward button presses. Nick |
From: <e_arizon_benito@ya...> - 2005-01-06 00:48:14
|
--- Nick Murtagh <nickm@...> escribió: > Tom Schwaller wrote: > > and after reading > > > > http://www.ds9a.nl/webcoding.html > > > > even template engines seem questionable ;-) > > Interesting, I recently came across this: > > > http://www-106.ibm.com/developerworks/library/j-contin.html > > which talks about using continuations in web > programming (Apache > Cocoon). It would be cool to have something like > this in Python. > Should be doable with stackless, I've heard mention > of people > using stackless with zope. > > The code referenced by the above article > > http://csoki.ki.iif.hu/~vitezg/impostor/ > > doesn't appear to use continuations and hence has > problems > handling back / forward button presses. > > > Nick > > > ------------------------------------------------------- > The SF.Net email is sponsored by: Beat the > post-holiday blues > Get a FREE limited edition SourceForge.net t-shirt > from ThinkGeek. > It's fun and FREE -- well, > almost....http://www.thinkgeek.com/sfshirt > _______________________________________________ > Webware-discuss mailing list > Webware-discuss@... > https://lists.sourceforge.net/lists/listinfo/webware-discuss > |
From: <e_arizon_benito@ya...> - 2005-01-06 11:32:21
|
I was thinking about an alternative design that works similar to the continuations usage but that (I think) is more intuitive from a software developer's point while keeping the same ideas. Basically it consist of developing what I call a "Web Virtual Machine". The WVM will consists of a set of instructions ( could be something similar to servlets or piece of servlets), memory addresses (expressed as URLs instead of integer numbers and pointing to the instructions), and I/O functionality. The main trick is considering that the WVM CPU runs permanently and the human being or user submiting a form is just an external slave hardware entering data into the WVM when it's requested to do so (yes, I know it's somethinglike sad expresed this way!). The normal "Real Hardware" CPU instruccion "read bytes from input port" will translate in a "send form to the browser and read back the submitted user-data". As a normal hardware the human-being/user could be available (fill the browser form and press the submit button), enter non-correct data or just fail to answer. The main servlet will act as a combination of the WVM CPU with + Interrupt Controller. Any request from the user browser will be interpreted as a WVM CPU Interrupt request similar to a normal PC. The WVM will process the interrupt when possible and if needed will submit a new form to the user (A new WVM read byte from port). "Complex" processes just require the use of an WVM stack pointer so that it will be possible to interrupt the process in place, call a new process (push current Instruction Pointer onto the stack) and return/come back to the original point (poping the "Instruccion Pointer" from the WVM stack). (The WVM Instruccion Pointer and stack, again, will store an URL to a servlet instead of an 16/32/... integer number). Concrete examples: if the WVM executes a "READ name FROM USER" the final form send to the navigator could include an input form similar to "<input name='WVM_name_input' size=60>" The main servlet (The WVM CPU) will read the field 'WVM_name_input' and either continue with the next instruccion or send back a form to the browser in the WVM_name_input is empty. A list of WVM instructions will look like: 0 "READ formLogin FROM USER" 1 "SERVLET_CheckFormLogin" ... 10 "READ formUserSelection FROM USER" 11 "READ formContact FROM USER" 12 "READ formPaymentInfo FROM USER" 13 "SERVLET_RegisterBuyInDataBase" 14 "READ formUserExit FROM USER" 15 "IF formUserExit NOT TRUE" 16 "GOTO 10" 17 "GOTO 0" The programmer will just need to work on the formData's and the custom-made "SERVLET_..." I'm open for refreshing ideas. --- Nick Murtagh <nickm@...> escribió: > Tom Schwaller wrote: > > and after reading > > > > http://www.ds9a.nl/webcoding.html > > > > even template engines seem questionable ;-) > > Interesting, I recently came across this: > > > http://www-106.ibm.com/developerworks/library/j-contin.html > > which talks about using continuations in web > programming (Apache > Cocoon). It would be cool to have something like > this in Python. > Should be doable with stackless, I've heard mention > of people > using stackless with zope. > > The code referenced by the above article > > http://csoki.ki.iif.hu/~vitezg/impostor/ > > doesn't appear to use continuations and hence has > problems > handling back / forward button presses. > > > Nick > > > ------------------------------------------------------- > The SF.Net email is sponsored by: Beat the > post-holiday blues > Get a FREE limited edition SourceForge.net t-shirt > from ThinkGeek. > It's fun and FREE -- well, > almost....http://www.thinkgeek.com/sfshirt > _______________________________________________ > Webware-discuss mailing list > Webware-discuss@... > https://lists.sourceforge.net/lists/listinfo/webware-discuss > |
From: deelan <deelan@in...> - 2005-01-06 11:50:12
|
Enrique Ariz=F3n wrote: > I was thinking about an alternative design that works > similar to the continuations usage but that (I think) > is more intuitive from a software developer's point > while keeping the same ideas. >=20 (...) >=20 > A list of WVM instructions will look like: >=20 > 0 "READ formLogin FROM USER" > 1 "SERVLET_CheckFormLogin" > ... > 10 "READ formUserSelection FROM USER" > 11 "READ formContact FROM USER" > 12 "READ formPaymentInfo FROM USER" > 13 "SERVLET_RegisterBuyInDataBase" > 14 "READ formUserExit FROM USER" > 15 "IF formUserExit NOT TRUE" > 16 "GOTO 10" > 17 "GOTO 0" >=20 > The programmer will just need to work on the > formData's and the custom-made "SERVLET_..."=20 basically we back to procedural programming. :) the guys behind nevow[1] are writing a module called wolf that allows this type of approach to web programming. here there's a code snippet from an early wolf example[2], the classic "guess what number is": def index(self, req): yield self._get_username(req) name =3D req.args.get("username", [""])[0] guesses =3D 0 number =3D random.randint(0, 10) hint =3D "No hint for you!" while True: guesses =3D guesses + 1 yield self._get_guess(req, name, hint) guess =3D int(req.args.get("guess", [""])[0]) if guess > number: hint =3D "Lower" elif guess < number: hint =3D "Higher" elif guess =3D=3D number: break else: hint =3D "Some weirdo error happened." yield "<html><body><b>%s won in %d guesses.</b></body></html>" %=20 (name, guesses) as you can see you yield _pages_ and write the whole process in linear fashion, pretty cool, if you ask me. actually nevow's wolf component is under heavy refactoring and still pretty crude, but it's a step on the right direction, i think. bye. [1] <http://www.nevow.org> [2] <http://www.divmod.org/svn/Nevow/sandbox/phunt/wolf/wolf/example.py> |
From: Nick Murtagh <nickm@go...> - 2005-01-06 12:26:56
|
deelan wrote: > as you can see you yield _pages_ and write the whole > process in linear fashion, pretty cool, if you ask me. Yeah, that's the sort of thing I was talking about. It keeps copies of generators to enable backtracking, very cool! |
From: Nick Murtagh <nickm@go...> - 2005-01-06 12:44:08
|
Nick Murtagh wrote: > It keeps copies of generators to enable backtracking, > very cool! Which doesn't seem to work in standard python, at least in 2.3.4... hmmm. |
From: <e_arizon_benito@ya...> - 2005-01-08 17:28:37
|
Thanks for the link. Staying in touch with all the available python software and solutions around it is ussually the most difficult of the language ;) > > basically we back to procedural programming. :) > > the guys behind nevow[1] are writing a module > called wolf that allows this type of approach > to web programming. > > here there's a code snippet from an early wolf > example[2], > the classic "guess what number is": > > def index(self, req): > yield self._get_username(req) > > name = req.args.get("username", [""])[0] > guesses = 0 > number = random.randint(0, 10) > hint = "No hint for you!" > > while True: > guesses = guesses + 1 > yield self._get_guess(req, name, hint) > guess = int(req.args.get("guess", [""])[0]) > if guess > number: > hint = "Lower" > elif guess < number: > hint = "Higher" > elif guess == number: > break > else: > hint = "Some weirdo error happened." > yield "<html><body><b>%s won in %d > guesses.</b></body></html>" % > (name, guesses) > > as you can see you yield _pages_ and write the whole > process in linear fashion, pretty cool, if you ask > me. > > actually nevow's wolf component is under heavy > refactoring and still pretty crude, but it's a step > on the right direction, i think. > > bye. > > [1] <http://www.nevow.org> > [2] > <http://www.divmod.org/svn/Nevow/sandbox/phunt/wolf/wolf/example.py> > > > ------------------------------------------------------- > The SF.Net email is sponsored by: Beat the > post-holiday blues > Get a FREE limited edition SourceForge.net t-shirt > from ThinkGeek. > It's fun and FREE -- well, > almost....http://www.thinkgeek.com/sfshirt > _______________________________________________ > Webware-discuss mailing list > Webware-discuss@... > https://lists.sourceforge.net/lists/listinfo/webware-discuss > |
From: Ryan Tomayko <rtomayko@gm...> - 2005-01-06 12:15:15
|
Hi Tom / Webware-discuss, I'm jazzed to see interest around Webware w/ Kid. I have very little experience with Webware myself but I'm committed to making any modifications necessary on the Kid side to ensure that it is easy to use in all popular python web environments. > On Fri, 31.12.2004, 11:20 -0500 Winston Wolf wrotef: >> It looks very nice syntax wise. I'm wondering how to best use it in >> Servlets though. Can you have a Kid template inherit from >> WebKit.Page? If not, how would you use a kid template? The only way >> I see right off the bat is to write a python servlet that includes the >> Kid template. But that means writing a python class for every >> template. Here's some information on how kid templates work under the hood. Each kid template module exposes a class named "Template": import kid class Template(kid.BaseTemplate): ... The kid.BaseTemplate class has methods for "executing" the template. This includes a `write` method that executes a template and writes output to a file like object, an 'encode' method that executes a template and returns the encoded XML output as a string, and a few other methods that allow a Kid template to work along a SAX pipeline. So one possible option might be to have kid.BaseTemplate subclass WebKit.Page or a subclass of WebKit.Page. This would require some craftiness: WebKit.Page would have to be added to BaseTemplate.__bases__ dynamically based on whether WebKit was available. What I like about this approach is that all Kid templates would automatically be subclasses of WebKit.Page. Does this approach seem viable? > On Sun, 02.01.2005, 16:59 -0500 Winston Wolff wrote: >> So I'm wondering, is there a way to compile a Kid template into a >> class, and then have another kid template inherit from that class, >> extending just certain parts? As I mentioned, all kid template modules automatically expose a class named Template. To illustrate this a bit further, consider having a file named "test_template.kid" somewhere on sys.path. The following python code would create an instance of the template class, execute it, and write output to stdout: from test_template import Template t = Template() t.write(file=sys.stdout) It should also be possible to subclass the Template class: class TemplatePage(WebKit.Page, Template): ... Again, I'm not familiar with WebKit.Page so I'm not positive this would be viable. > Personally I think is is worth the effort to write a first class > KidKit (funny name!), > solving all this problems and enabling Webware beginners to put .kid > files > into their directories and Webware doing all the magic, something I > never understood > why Cheetah did not do (it was planned, but I have never seen it and > people seem still > to ask for it). I like out of the box solutions! ;-) Me too. Right now I'm trying to get the basic template language sorted out; it's fairly close. I should be shifting my attention over to getting kid to run out-of-the-box on different web frameworks in the near future. If anyone is thinking about taking a stab at this, know that your time would not be wasted. I'm committed to changing anything necessary with the base kid package to have things work smoothly with webware (and other web frameworks) and I'm also not against distributing add-on type functionality with the kid distribution. I would *love* to have a few maintainers with access to kid cvs that would be able to add support for and/or track changes to different web frameworks to make sure kid is really easy to use under any web framework. If you happen to take a stab at getting Kid to work nicely with Webware, please consider sending over any patches, support files, or examples. Thanks, Ryan Tomayko |
From: Michel Thadeu <michel_ts@ya...> - 2005-01-06 12:55:19
|
Hi All... I have a question/suggest about the webware/kid integration... I use cheetah and I am almost pleased with it, the best functionality, in my opinion is the "block" statement... The "block" statement let me define some area where the code can be changed/extended. I can extend in a servlet or even in another template (with the inheritance approach). I don't know if there is away, but it will be wonderfull to have a way to extend a template from a servlet and a way to define blocks... thanks for attention and thanks for kid! ===== -- Michel Thadeu Sabchuk Curitiba/PR _______________________________________________________ Yahoo! Acesso Grátis - Instale o discador do Yahoo! agora. http://br.acesso.yahoo.com/ - Internet rápida e grátis |
From: Shayne ONeill <shayne@pe...> - 2005-01-01 06:47:48
|
Template engine in 6 lines :) f =3Dopen('/templatedir/' + name, 'r') template =3D f.read() f.close() for k,v replacelist(): template =3D template.replace(str(k),str(v)) print template You start with a template file which is plain ol' html with lines like <div class=3D"raraa">{name}</div> you fill a list of replacements like follows;- replacelist['{name}'] =3D 'John brown' then run the above code and blammo. Instant templates. This is of course why I somewhat adore python. :) -- Shayne O'Neill.. tr=E5dkr=E4mare http://perth.indymedia.org "I trust God speaks through me. Without that, I couldnt do my job." --George W Bush. http://atheism.about.com/b/a/099745.htm On Fri, 31 Dec 2004, Tom Schwaller wrote: > Has anybody used Webware together with the Kid Template language > (which is based on ElementTree using concepts from XSLT, TAL and > PHP in a very nice and simple mix, which I liked immediately). > > http://splice.sourceforge.net/kid/ > > I know there are so many different template langauages > and concepts around > > http://www.python.org/cgi-bin/moinmoin/WebProgramming > http://wact.sourceforge.net/index.php/TemplateView > > but what I like about Kid is it's somewhat more Pythonic flavor > than others. > > agree, disagree? > > Tom > > > > ------------------------------------------------------- > The SF.Net email is sponsored by: Beat the post-holiday blues > Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. > It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt > _______________________________________________ > Webware-discuss mailing list > Webware-discuss@... > https://lists.sourceforge.net/lists/listinfo/webware-discuss > |
From: Frank Barknecht <fbar@fo...> - 2005-01-02 00:27:45
|
Hallo, Shayne ONeill hat gesagt: // Shayne ONeill wrote: > > Template engine in 6 lines :) > > f =open('/templatedir/' + name, 'r') > template = f.read() > f.close() > for k,v replacelist(): > template = template.replace(str(k),str(v)) > print template > > You start with a template file which is plain ol' html with lines like > <div class="raraa">{name}</div> If you use "templates" like: <div class="raraa">%(name)s</div> you can even omit the "for k,v ..." loop altogether and just write: tpl = f.read() replacelist["name"] = "doobeedoo" tpl = tpl % replacelist And Python 2.4 has an even nicer syntax for this. However "plain ol' html" is not what I would consider a real template language, as that would include control structures like for-loops etc. One might argue, that Python code can be a template language then itself, though. PSP and Kid work this way behind the curtain anyway. Ciao -- Frank Barknecht _ ______footils.org__ |
From: Shayne ONeill <shayne@pe...> - 2005-01-02 06:32:01
|
True. Its a rather naive system. What it does offer however is that you can give it to the creative types and say "Just throw it together in dreamweaver and put little {rarara} tags in the coders can take care of the rest. What I've done in th past is to build a little render object that has an abstract function thats overridden that (A) knows to load the correct template (B) Knows how to fill in the details and (C) calls the apply_template() function in the class. Then these can be nested or whatever. You can then add goodness like cacheing etc to the rendering core of the class. -- Shayne O'Neill.. tr=E5dkr=E4mare http://perth.indymedia.org "I trust God speaks through me. Without that, I couldnt do my job." --George W Bush. http://atheism.about.com/b/a/099745.htm On Sun, 2 Jan 2005, Frank Barknecht wrote: > Hallo, > Shayne ONeill hat gesagt: // Shayne ONeill wrote: > > > > > Template engine in 6 lines :) > > > > f =3Dopen('/templatedir/' + name, 'r') > > template =3D f.read() > > f.close() > > for k,v replacelist(): > > template =3D template.replace(str(k),str(v)) > > print template > > > > You start with a template file which is plain ol' html with lines like > > <div class=3D"raraa">{name}</div> > > If you use "templates" like: > > <div class=3D"raraa">%(name)s</div> > > you can even omit the "for k,v ..." loop altogether and just write: > > tpl =3D f.read() > replacelist["name"] =3D "doobeedoo" > tpl =3D tpl % replacelist > > And Python 2.4 has an even nicer syntax for this. > > However "plain ol' html" is not what I would consider a real template > language, as that would include control structures like for-loops etc. > > One might argue, that Python code can be a template language then > itself, though. PSP and Kid work this way behind the curtain anyway. > > Ciao > -- > Frank Barknecht _ ______footils.org__ > > > > ------------------------------------------------------- > The SF.Net email is sponsored by: Beat the post-holiday blues > Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. > It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt > _______________________________________________ > Webware-discuss mailing list > Webware-discuss@... > https://lists.sourceforge.net/lists/listinfo/webware-discuss > |
From: Winston Wolff <winstonwolff@ca...> - 2004-12-31 16:13:30
Attachments:
text/enriched
|
It looks very nice syntax wise. I'm wondering how to best use it in Servlets though. Can you have a Kid template inherit from WebKit.Page? If not, how would you use a kid template? The only way I see right off the bat is to write a python servlet that includes the Kid template. But that means writing a python class for every template. -winston On Dec 31, 2004, at 8:02 AM, Tom Schwaller wrote: > Has anybody used Webware together with the Kid Template language > (which is based on ElementTree using concepts from XSLT, TAL and > PHP in a very nice and simple mix, which I liked immediately). > > http://splice.sourceforge.net/kid/ > > I know there are so many different template langauages > and concepts around > > http://www.python.org/cgi-bin/moinmoin/WebProgramming > http://wact.sourceforge.net/index.php/TemplateView > > but what I like about Kid is it's somewhat more Pythonic flavor > than others. > > agree, disagree? > > Tom > > > > ------------------------------------------------------- > The SF.Net email is sponsored by: Beat the post-holiday blues > Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. > It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt > _______________________________________________ > Webware-discuss mailing list > Webware-discuss@... > https://lists.sourceforge.net/lists/listinfo/webware-discuss > _________________________________________ winston wolff - (646) 827-2242 - http://www.stratolab.com - learning by creating |
From: maluke <m@ma...> - 2005-01-03 15:40:53
|
Syntax-wise you should also look at http://www.divmod.org/Home/Projects/Nevow/index.html I haven't tried it yet (stumbled just yesterday), but it sure looks good! -- малюк [ m@... // ICQ: 39027534 ] |
From: Winston Wolff <winstonwolff@ca...> - 2005-01-04 15:34:30
Attachments:
text/enriched
|
=46rom a quick glance, I don't really like Nevow. They are making a = lot=20 of abstractions that I don't see a need for, and it makes learning the=20= thing too complicated for no reason. PSP and KID seem simpler and=20 easier. -winston On Jan 3, 2005, at 10:40 AM, maluke wrote: > Syntax-wise you should also look at=20 > http://www.divmod.org/Home/Projects/Nevow/index.html > > I haven't tried it yet (stumbled just yesterday), but it sure looks=20 > good! > > --=20 > =D0=BC=D0=B0=D0=BB=D1=8E=D0=BA [ m@... // ICQ: 39027534 ] > > > > ------------------------------------------------------- > The SF.Net email is sponsored by: Beat the post-holiday blues > Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. > It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt > _______________________________________________ > Webware-discuss mailing list > Webware-discuss@... > https://lists.sourceforge.net/lists/listinfo/webware-discuss > > _________________________________________ winston wolff - (646) 827-2242 - http://www.stratolab.com - learning by=20= creating |
From: Tom Schwaller <tom.schwaller@we...> - 2005-01-04 20:21:03
|
Am Dienstag, den 04.01.2005, 10:34 -0500 schrieb Winston Wolff: > > > ______________________________________________________________________ > > From a quick glance, I don't really like Nevow. They are making a lot > of abstractions that I don't see a need for, and it makes learning the > thing too complicated for no reason. PSP and KID seem simpler and > easier. I had exactly the same feeling when I looked at Nevow, Spice and all the other Python Template languages (I went through most of them last week once more). Cheetah is very sophisticated, but Kid had that Pythonic look I liked immediately (although it is not finished yet and some more work needs to be done by the author). Winston: Can you send me the CheetahKit you wrote, so I can take a look at it or is is downloadable somewhere? I did not have the Problems with Kid you described in the last mail, so it is "difficul"t to comment that... (I installed the newest ElementTree version) Tom -- Tom Schwaller <tom.schwaller@...> |
From: Winston Wolff <winstonwolff@ca...> - 2005-01-05 00:16:27
Attachments:
text/enriched
|
You can find a zip file that contains two cheetah servlet factories on my site here (I'll keep it up for a few months): http://www.stratolab.com/static/CheetahFactories.zip * CheetahServlet is by jmquigs. Someone sent it to me from the Cheetah mailing list. It is a bare bones factory, very few lines and does the minimum to get a working servlet factory. It would be good for your first attempt. * CheetahKit is my redoing of the PSP servlet factory, and includes caching of pages. When the next build is done, I will check in all my stuff for people to test. I've done a bunch of things only recently, so I don't want to jeopardize the stability of version 0.9 with them. -winston On Jan 4, 2005, at 3:20 PM, Tom Schwaller wrote: > Am Dienstag, den 04.01.2005, 10:34 -0500 schrieb Winston Wolff: >> >> >> ______________________________________________________________________ >> >> From a quick glance, I don't really like Nevow. They are making a lot >> of abstractions that I don't see a need for, and it makes learning the >> thing too complicated for no reason. PSP and KID seem simpler and >> easier. > > I had exactly the same feeling when I looked at Nevow, Spice and all > the other Python Template languages (I went through most of them last > week once more). Cheetah is very sophisticated, but Kid had > that Pythonic look I liked immediately (although it is not finished yet > and some more work needs to be done by the author). > > Winston: Can you send me the CheetahKit you wrote, so I can take a look > at it or is is downloadable somewhere? > > I did not have the Problems with Kid you described in the last mail, > so it is "difficul"t to comment that... (I installed the newest > ElementTree version) > > Tom > > -- > Tom Schwaller <tom.schwaller@...> > > > > ------------------------------------------------------- > The SF.Net email is sponsored by: Beat the post-holiday blues > Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. > It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt > _______________________________________________ > Webware-discuss mailing list > Webware-discuss@... > https://lists.sourceforge.net/lists/listinfo/webware-discuss > > _________________________________________ winston wolff - (646) 827-2242 - http://www.stratolab.com - learning by creating |
From: Tom Schwaller <tom.schwaller@we...> - 2005-01-05 02:15:27
|
On Tue, 04.01.2005, 19:16 -0500 Winston Wolff wrote: > > > ______________________________________________________________________ > > You can find a zip file that contains two cheetah servlet factories on > my site here (I'll keep it up for a few months): > > http://www.stratolab.com/static/CheetahFactories.zip > > * CheetahServlet is by jmquigs. Someone sent it to me from the > Cheetah mailing list. It is a bare bones factory, very few lines and > does the minimum to get a working servlet factory. It would be good > for your first attempt. > > * CheetahKit is my redoing of the PSP servlet factory, and includes > caching of pages. > > When the next build is done, I will check in all my stuff for people > to test. I've done a bunch of things only recently, so I don't want > to jeopardize the stability of version 0.9 with them. Nice, thanks a lot. I'll take a look at that tomorrow in the train (I'm out for 2 days). Tom |