splice-general Mailing List for Splice
Status: Alpha
Brought to you by:
rtomayko
You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
(2) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(11) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Ryan T. <rto...@gm...> - 2005-01-17 01:05:02
|
On Jan 16, 2005, at 5:42 PM, Dagur P=E1ll Ammendrup wrote: > Thanks for your reply. I'm going to use kid for a large-ish project=20 > (by my standard anyway) so I might bug you more the next weeks :-) Glad to hear it. I haven't had a chance to put kid to heavy use in a=20 real system as I've been spending so much time on the framework itself=20= so I'm relying heavily on user feedback, patches, and bug reports. > I have another question right now actually. I was going to do=20 > something like this: > > <element attr=3D"{dictionary['id']}">some text</element> > > but I got an error: > > File "c:\pl\python23\Lib\site-packages\kid\util.py", line 44, in=20 > _k_attrib > attrib[k] =3D ''.join(ls) > > TypeError: sequence item 1: expected string, long found > > Is it not supposed to be possible to use dictionaries in attributes or=20= > is this a bug? That's a bug. Is attrib[k] contain a long value? I think I just need to=20= add some logic to convert anything that isn't a string to string before=20= calling: ''.join() I'll get this fixed for a 0.4.2 release. For now you should be able to=20= convert to a string or unicode object explicitly: <element attr=3D"{str(dictionary['id'])}">some text</element> or <element attr=3D"{unicode(dictionary['id'])}">some text</element> > regards, > Dagur Thanks for the report, Ryan |
From: Ryan T. <rto...@gm...> - 2005-01-14 15:54:14
|
That's a known bug that should be fixed pretty soon. I need to add=20 support for DOCTYPE declarations and I also want to add some mechanism=20= for controlling whether the <?xml?> declaration is output. I realize this is a pretty huge bug as it basically means it's=20 impossible to output valid XHTML. Browsers use the DOCTYPE to trigger=20 qwirks/standard mode as well. So yea, this is a biggie. Thanks for=20 putting it back on my immediate radar. I'll try to get a 0.4.2 out with this and a few other refinements that=20= have been requested. Thanks, Ryan On Jan 14, 2005, at 10:37 AM, Dagur P=E1ll Ammendrup wrote: > Hi there, > > I've been trying out Kid and so far I like it a lot. But I have one=20 > question. Why does it always remove my <!DOCTYPE> tag? What can I do=20= > so it won't happen? > > Thanks! > Dagur > > --=20 > No virus found in this outgoing message. > Checked by AVG Anti-Virus. > Version: 7.0.300 / Virus Database: 265.6.11 - Release Date: 12.1.2005 > |
From: Ryan T. <rto...@gm...> - 2005-01-14 13:46:46
|
Yes. It may even work on Windows today. If you happen to give it a try, let me know what you find out. I just added a note about this to my TODO list. I'll try to get a round of windows tests in before releasing 0.5. Ryan On Jan 13, 2005, at 9:29 PM, Robert Hicks wrote: > Is there going to be a Windows version implemented? > > Robert > |
From: Ryan T. <rto...@gm...> - 2005-01-13 16:16:13
|
I've pondered it but am not actively ensuring compatibility right now. I need to look into how ElementTree works with Jython. The thing I'm worried about here is that ET uses xml.parsers.expat and I'm not sure if there's a Jython equivalent. If you happen to play around with Jython, let me know what you see. I'm quite positive it won't "just work" (although I've been surprised with Jython compatibility before) but I'd like to know how far away we are. Thanks, Ryan On Jan 13, 2005, at 11:11 AM, SPe...@oa... wrote: > Hi > Is it possible to use Kid4.0 with jython. It would be killer > templating system. |
From: Ryan T. <rto...@gm...> - 2005-01-12 12:56:51
|
Alright, kid-0.4.1 is available. It addresses the issues you ran into and has some updated documentation. Thanks, Ryan On Jan 11, 2005, at 3:35 PM, Ryan Tomayko wrote: > Okay, those are horrible, horrible, stupid problems that shouldn't be > happening. I'm wondering if I might have screwed up the release > tarball somehow. > > Thanks for the patch. I'll have a 0.4.1 out in a bit and will get all > this worked out. > > Sorry for the inconvenience, > > Ryan > > On Jan 11, 2005, at 3:19 PM, Ross Burton wrote: >> On Mon, 2005-01-10 at 22:25 -0500, Ryan Tomayko wrote: >>> You know what else? I think I like the name "generate". Right now I'm >>> not particularly happy with the names of the template methods. They >>> are: >> [snip] >>> I think I'm going to switch it up a bit before 0.4. encode() will be >>> called serialize() and serialize() will be called generate(). >>> >>> Any other good method names up your sleeve, Ross? >> >> Those names sound good to me, which is good as 0.4 is out and I'm now >> calling them. :) >> >> I had to apply the attached patch to make kidc write the .pyc file. >> >> One problem I am seeing is "kid foo.kid" returning the output twice. >> i.e >> the following file: >> >> <?xml version='1.0' encoding='UTF-8'?> >> <xml xmlns:kid="http://naeblis.cx/ns/kid#" kid:content="1"/> >> >> when saved as minimal.kid and executed with "kid minimal.kid" gives: >> >> $ kid minimal.kid >> <?xml version='1.0' encoding='utf-8'?> >> <xml xmlns:kid="http://naeblis.cx/ns/kid#">1</xml> >> ['BaseTemplate', 'END', 'Element', 'ElementTree', 'START', 'TAIL', >> 'TEXT', 'Template', 'XML', '__builtins__', '__doc__', '__file__', >> '__name__', '_k_attrib', '_k_generate_content', 'document', >> 'encoding', 'generate', 'generators', 'kid', 'pull', 'pulltree', >> 'serialize', 'sys', 'write'] >> <?xml version='1.0' encoding='utf-8'?> >> <xml xmlns:kid="http://naeblis.cx/ns/kid#">1</xml> >> >> Removing "print dir(module)" from bin/kid removes the list in the >> middle, It appears that compiler.actualize() is responsible for the >> first output, and the Template.write() method responsible for the >> second. However, I don't understand the code enough to know if the >> call >> to actualize() should be removed, or if irrelevant entries are being >> put >> into the dict passed to it. >> >> Thanks, >> Ross >> -- >> Ross Burton mail: ro...@bu... >> jabber: ro...@bu... >> www: http://www.burtonini.com./ >> PGP Fingerprint: 1A21 F5B0 D8D0 CFE3 81D4 E25A 2D09 E447 D0B4 33DF >> >> <kid-compile.diff> > |
From: Ryan T. <rto...@gm...> - 2005-01-11 20:35:53
|
Okay, those are horrible, horrible, stupid problems that shouldn't be happening. I'm wondering if I might have screwed up the release tarball somehow. Thanks for the patch. I'll have a 0.4.1 out in a bit and will get all this worked out. Sorry for the inconvenience, Ryan On Jan 11, 2005, at 3:19 PM, Ross Burton wrote: > On Mon, 2005-01-10 at 22:25 -0500, Ryan Tomayko wrote: >> You know what else? I think I like the name "generate". Right now I'm >> not particularly happy with the names of the template methods. They >> are: > [snip] >> I think I'm going to switch it up a bit before 0.4. encode() will be >> called serialize() and serialize() will be called generate(). >> >> Any other good method names up your sleeve, Ross? > > Those names sound good to me, which is good as 0.4 is out and I'm now > calling them. :) > > I had to apply the attached patch to make kidc write the .pyc file. > > One problem I am seeing is "kid foo.kid" returning the output twice. > i.e > the following file: > > <?xml version='1.0' encoding='UTF-8'?> > <xml xmlns:kid="http://naeblis.cx/ns/kid#" kid:content="1"/> > > when saved as minimal.kid and executed with "kid minimal.kid" gives: > > $ kid minimal.kid > <?xml version='1.0' encoding='utf-8'?> > <xml xmlns:kid="http://naeblis.cx/ns/kid#">1</xml> > ['BaseTemplate', 'END', 'Element', 'ElementTree', 'START', 'TAIL', > 'TEXT', 'Template', 'XML', '__builtins__', '__doc__', '__file__', > '__name__', '_k_attrib', '_k_generate_content', 'document', > 'encoding', 'generate', 'generators', 'kid', 'pull', 'pulltree', > 'serialize', 'sys', 'write'] > <?xml version='1.0' encoding='utf-8'?> > <xml xmlns:kid="http://naeblis.cx/ns/kid#">1</xml> > > Removing "print dir(module)" from bin/kid removes the list in the > middle, It appears that compiler.actualize() is responsible for the > first output, and the Template.write() method responsible for the > second. However, I don't understand the code enough to know if the > call > to actualize() should be removed, or if irrelevant entries are being > put > into the dict passed to it. > > Thanks, > Ross > -- > Ross Burton mail: ro...@bu... > jabber: ro...@bu... > www: http://www.burtonini.com./ > PGP Fingerprint: 1A21 F5B0 D8D0 CFE3 81D4 E25A 2D09 E447 D0B4 33DF > > <kid-compile.diff> |
From: Ross B. <ro...@bu...> - 2005-01-11 20:22:06
|
On Mon, 2005-01-10 at 22:25 -0500, Ryan Tomayko wrote: > You know what else? I think I like the name "generate". Right now I'm > not particularly happy with the names of the template methods. They > are: [snip] > I think I'm going to switch it up a bit before 0.4. encode() will be > called serialize() and serialize() will be called generate(). > > Any other good method names up your sleeve, Ross? Those names sound good to me, which is good as 0.4 is out and I'm now calling them. :) I had to apply the attached patch to make kidc write the .pyc file. One problem I am seeing is "kid foo.kid" returning the output twice. i.e the following file: <?xml version='1.0' encoding='UTF-8'?> <xml xmlns:kid="http://naeblis.cx/ns/kid#" kid:content="1"/> when saved as minimal.kid and executed with "kid minimal.kid" gives: $ kid minimal.kid <?xml version='1.0' encoding='utf-8'?> <xml xmlns:kid="http://naeblis.cx/ns/kid#">1</xml> ['BaseTemplate', 'END', 'Element', 'ElementTree', 'START', 'TAIL', 'TEXT', 'Template', 'XML', '__builtins__', '__doc__', '__file__', '__name__', '_k_attrib', '_k_generate_content', 'document', 'encoding', 'generate', 'generators', 'kid', 'pull', 'pulltree', 'serialize', 'sys', 'write'] <?xml version='1.0' encoding='utf-8'?> <xml xmlns:kid="http://naeblis.cx/ns/kid#">1</xml> Removing "print dir(module)" from bin/kid removes the list in the middle, It appears that compiler.actualize() is responsible for the first output, and the Template.write() method responsible for the second. However, I don't understand the code enough to know if the call to actualize() should be removed, or if irrelevant entries are being put into the dict passed to it. Thanks, Ross -- Ross Burton mail: ro...@bu... jabber: ro...@bu... www: http://www.burtonini.com./ PGP Fingerprint: 1A21 F5B0 D8D0 CFE3 81D4 E25A 2D09 E447 D0B4 33DF |
From: Ryan T. <rto...@gm...> - 2005-01-11 03:25:24
|
You know what else? I think I like the name "generate". Right now I'm not particularly happy with the names of the template methods. They are: write(file, encoding='utf-8', **kw) Execute the template and write the result (incrementally) to the filename or file like object. * This name is okay. encode(encoding='utf-8', **kw) Execute the template and return a string. * I don't like this name at all. serialize(encoding='utf-8', **kw) Like encode but is a generator that returns strings continuously until the template is complete. * I don't really like this name either. expand(**kw) Low level pulltree interface. Returns a generator that yields an (event, item) tuple for each infoset item in the generated content. * This name is okay. I think I'm going to switch it up a bit before 0.4. encode() will be called serialize() and serialize() will be called generate(). Any other good method names up your sleeve, Ross? Ryan On Jan 10, 2005, at 2:27 PM, Ross Burton wrote: > Hi, > > I'm considering calling Kid generated templates from other Python code > using something like this: > > foo.kid: > > <?xml version='1.0' encoding='UTF-8'?> > <html xmlns="http://www.w3.org/1999/xhtml" > xmlns:kid="http://naeblis.cx/ns/kid#"> > <p kid:content="foo bar"/> > </html> > > And then in foo-caller.py: > > import foo > print foo.generate() > > Where the generate method would return a String, or take a > ContentHandler, or something. Bonus points would be awarded if > arguments can be passed into generate() so that the Python-in-Kid code > can be controlled from outside. > > Is this possible at the moment? I don't think it is, but would it be > possible in the future? > > Thanks, > Ross > > PS: the HTML in my gallery at burtonini.com/photos is generated from > RDF/RSS via Kid. Works great! > -- > Ross Burton mail: ro...@bu... > jabber: ro...@bu... > www: http://www.burtonini.com./ > PGP Fingerprint: 1A21 F5B0 D8D0 CFE3 81D4 E25A 2D09 E447 D0B4 33DF > > > > > ------------------------------------------------------- > 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 > _______________________________________________ > splice-general mailing list > spl...@li... > https://lists.sourceforge.net/lists/listinfo/splice-general > |
From: Ryan T. <rto...@gm...> - 2005-01-10 23:34:37
|
On Jan 10, 2005, at 2:27 PM, Ross Burton wrote: > Hi, > > I'm considering calling Kid generated templates from other Python code > using something like this: <snip example. recreating below> > Where the generate method would return a String, or take a > ContentHandler, or something. Bonus points would be awarded if > arguments can be passed into generate() so that the Python-in-Kid code > can be controlled from outside. I think you're reading my mind, Ross. I will have an 0.4 release out today that will (break your existing code but) address all of the issues you've raised (I think). Let me restructure your example a bit and see if this meets your needs: foo.kid: <?xml version='1.0' encoding='UTF-8'?> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:kid="http://naeblis.cx/ns/kid#"> <!-- access keyword arguments as local variables --> <p kid:content="foo + bar"/> <!-- access keyword arguments passed to Template.__init__() using self --> <p kid:content="self.baz + self.bling"/> </html> And then in foo-caller.py: import foo # access keyword args passed to Template() using self in template. template = foo.Template(baz=10, bling=20) # access keyword args passed to encode(), expand(), serialize(), or # write() as locals print template.encode(foo=1, bar=2) That's a really quick explanation of some of the new stuff in 0.4. I should have the tutorial updated and hope to get a nice article on my weblog tonight that illuminates this further. Does that sound right? > PS: the HTML in my gallery at burtonini.com/photos is generated from > RDF/RSS via Kid. Works great! Well shucks Ross, I think you beat me to writing the first real app using kid. I can't wait to check it out tonight when I get home from work. Thanks, - Ryan |
From: Ross B. <ro...@bu...> - 2005-01-10 19:29:43
|
Hi, I'm considering calling Kid generated templates from other Python code using something like this: foo.kid: <?xml version='1.0' encoding='UTF-8'?> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:kid="http://naeblis.cx/ns/kid#"> <p kid:content="foo bar"/> </html> And then in foo-caller.py: import foo print foo.generate() Where the generate method would return a String, or take a ContentHandler, or something. Bonus points would be awarded if arguments can be passed into generate() so that the Python-in-Kid code can be controlled from outside. Is this possible at the moment? I don't think it is, but would it be possible in the future? Thanks, Ross PS: the HTML in my gallery at burtonini.com/photos is generated from RDF/RSS via Kid. Works great! -- Ross Burton mail: ro...@bu... jabber: ro...@bu... www: http://www.burtonini.com./ PGP Fingerprint: 1A21 F5B0 D8D0 CFE3 81D4 E25A 2D09 E447 D0B4 33DF |
From: Ryan T. <rto...@gm...> - 2005-01-09 23:58:58
|
Hi Winston, Really sorry it took me so long to get back to you and I'm sorry to say =20= I haven't had a chance to research the issue just yet. I've been away =20= from computer since Friday. That looks like it is either a bug in the example template or possibly =20= a more serious bug in the compiler. I'm going to take a deeper look =20 into this tonight. I'd also like to push out a 0.4 release tonight as =20= there's been quite a bit of work done since the 0.3 release. I should have something on this soon. Thanks, Ryan On Jan 6, 2005, at 10:10 AM, Winston Wolff wrote: > Hello Ryan- > > Hoping you'll say yes to looking at my problem when running Kid, =20 > here's what I did... > > Well, I tried to download and run Kid, and it fails. My system is =20= > Mac OS X, 1.3.7. Python is v2.3. > =95 Downloaded Kid-0.3 > =95 Downloaded elementtree-1.2.4-20041228 > =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 attached. > =95 Run python basic-test.html.py and I get the error below. > > I tried looking through the code in basic-test.html.py and I think it =20= > has something to do with the way Kid is compiling the "for fruit in =20= > fruits" statement into code. > > <basic-test.html.py> > -------------------- > Sample output when running python basic-test.html.py > > winstonw@lucia ~/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 |
From: Ryan T. <rto...@gm...> - 2004-12-29 15:05:26
|
I've quoted liberally for the archives. On Dec 29, 2004, at 7:02 AM, Ross Burton wrote: > On Tue, 2004-12-28 at 18:30 -0500, Ryan Tomayko wrote: >> Sorry about the dependency hell. I'm planning on distributing >> elementtree with kid at some point. That's going to require some >> trickery in setup.py to give an option to use an existing elementtree >> and I haven't tackled it yet. > > Doesn't bother me -- at the moment I've got a local pythonpath and I'm > planning on creating Debian packages of Kid + deps if my project takes > off. Can't tell you how much I like hearing that. :) > Now to pick your brains. I'm guessing that returning an > elementtree.Element from a kid:content should do the right thing and > serialize the element into the output: > > <?xml version='1.0' encoding='UTF-8'?> > <?kid > # RAWK - RSS to gallery HTML generator > def foo(): > from elementtree import ElementTree > root = ElementTree.Element("{http://www.w3.org/1999/xhtml}br") > return root > ?> > ... > <div kid:content="foo()"/> > > Should result in a <div><br/></div> > > However, I get this: > > $ kid rss2galleryhtml.kid index.rss > index.html > Traceback (most recent call last): > File "/home/users/ross/bin/BUILD/bin/kid", line 67, in ? > main() > File "/home/users/ross/bin/BUILD/bin/kid", line 64, in main > kid.expand_template(f, name='__kid_main__', output=out) > File > "/home/users/ross/bin/BUILD/lib/python2.3/site-packages/kid/ > __init__.py", line 93, in expand_template > pulltree.write(stream, out) > File > "/home/users/ross/bin/BUILD/lib/python2.3/site-packages/pulltree.py", > line 149, in write > for text in serialize(stream, xml_decl, encoding): > File > "/home/users/ross/bin/BUILD/lib/python2.3/site-packages/pulltree.py", > line 178, in serialize > qname = item.qname(tag, default=1) > AttributeError: _ElementInterface instance has no attribute 'qname' > > It appears to be trying but not succeeding. I hoped that adding the > URI > to the Element constructor would have done the right thing, but > obviously not. Is this another bug in my code, or in Kid? This is definitely a kid bug. I've had that working in the past. Looks like I need to add a test case :/ I've logged this as an issue and will try to get either 0.4 or a small update to 0.3 out in the next day or so. http://tinyurl.com/4tjrz A couple of other notes: Kid 0.4 will have reusable templates that do something very similar to you're example. You can do fun stuff like this: file1.kid: <html> ... <ul kid:def="show_list(seq)"> <li kid:for="item in seq" kid:content="item">item text</li> </ul> </html> file2.kid <?kid # from file1 import show_list fruits = ['apples', 'oranges', 'M&Ms'] ?> <html> ... <p>Here's a list of stuff:</p> <div kid:content="show_list(fruits)"/> </html> The other thing I wanted to mention is that namespace support is not quite right at the moment (I noticed the XHTML namespace in your example). You can use them but you'll need to use some care. The rule is that a prefix (or default namespace) must be defined somewhere in the main document before referencing the namespace using kid:content. So, in your example, just make sure you have the xhtml namespace bound to a prefix when you reference it in kid:content. Otherwise, you're likely to get something very weird on the output side. Handling this correctly is on my list but I don't think it will be done for 0.4. > Also, I notice that Kid 0.3 is outputting elements which are written as > <img/> in the source as <img></img> in the output, whereas 0.2 kept the > closing tag style. Is this an intentional change or a side-affect of > code changes? That's another bug. I've logged it: http://tinyurl.com/3mfst The fix should be trivial. I'll try to slip this into either 0.3.1 or 0.4. Thanks a ton for the news and report! Kid is a bit rough around the edges atm - I appreciate your time and patients. Thanks, Ryan Tomayko |
From: Ryan T. <rto...@gm...> - 2004-12-28 23:31:11
|
kid 0.3 requires the ElementTree package: info: http://effbot.org/zone/element-index.htm download: http://effbot.org/downloads/#elementtree Grab version 1.2.4 Sorry about the dependency hell. I'm planning on distributing elementtree with kid at some point. That's going to require some trickery in setup.py to give an option to use an existing elementtree and I haven't tackled it yet. Ryan On Dec 28, 2004, at 5:49 PM, Ross Burton wrote: > Hi, > > I'm trying to install Kid 0.3, but it's failing: > > ross@hactar ~/tmp/Wasteland/kid-0.3 > $ python setup.py build > Traceback (most recent call last): > File "setup.py", line 2, in ? > import kid as _kid > File "/home/users/ross/tmp/Wasteland/kid-0.3/kid/__init__.py", line > 40, in ? > import kid.util as util > File "/home/users/ross/tmp/Wasteland/kid-0.3/kid/util.py", line 27, > in ? > from elementtree import ElementTree > ImportError: No module named elementtree > > Is this a known problem, or am I doing something wrong? > > Thanks, > Ross > -- > Ross Burton mail: ro...@bu... > jabber: ro...@bu... > www: http://www.burtonini.com./ > PGP Fingerprint: 1A21 F5B0 D8D0 CFE3 81D4 E25A 2D09 E447 D0B4 33DF > > |
From: Ryan T. <rto...@gm...> - 2004-11-30 06:38:00
|
test |