Tao of the Machine

Programming, Python, my projects, card games, books, music, Zoids, bettas, manga, cool stuff, and whatever comes to mind.

Some progress...

Some more refactoring. There is now a HTMLWriter, which should have been there all along. It deals with writing HTML, obviously, while HTMLMaker can now focus on generating it, and nothing else. Much better. Surprisingly, after the refactoring, the new code worked right out of the box. :-)

Now all I need to do is come up with a sensible and clean way to set blog's and entry's attributes. And then 0.8 may finally see the light...

Posted by Hans Nowak on 2002-10-10 23:40:43   {link}
Categories: Kaa

Stunning stuff

Read these articles... for example, this one about cyberlife. With a few simple (?) examples, the guy delves not only into artificial life, but also philosophical musings. An example:
All I ask you to do is remember some episode from your childhood. Muse on it for a moment and relive it; then ask yourself, how come you believe you experienced those events at all? After all, you weren't there at the time! Probably not a single atom that's in your body now was there then. You still consider yourself to be the same person, yet you've been replaced many times over - you're not even the same shape as you were then.
The first time I watched a "glider" move across the screen in a computer simulation of Conway's Game of Life and realized that something was moving and yet no thing was moving.
Hmm... food for thought... hey, I am only an amateur philosopher... :-)

Posted by Hans Nowak on 2002-10-10 22:38:46   {link}
Categories: general

Custom pages

...just got a little bit better. Or rather, the blog object grew a new attribute archives, a list of tuples (pagename, ids). Obviously, this is for easy association of generated page names with entry ids, and a new method blog.get_permalink uses this. This allows for using permalinks in custom pages. For example, here's a list of all entries.

Important: The blog.arch_page_names attribute has become obsolete and has been removed. If you're using this, change your templates or embedded code.

The new attribute is easy to use:

for pagename, ids in blog.archives:
    # do stuff
or generate a permalink:
More API improvements will be added if necessary. And then I can write some solid documentation...

Posted by Hans Nowak on 2002-10-06 22:03:00   {link}
Categories: Kaa

Shortcuts, macros, embedded code, oh my!

Yesterday I received a patch from Howard Hansen, with the implementation of a good idea: simple shortcuts, which are apparently like those used by Radio. They look like this: "shortcut", where the text 'shortcut' can be replaced with a certain text, or even evaluated.

I enthusiastically proceeded to apply the patch. However, then I realized something. Anything these shortcuts do, can be done by embedded code as well; only the enclosing characters look different (<% %> rather than " ").
Therefore, I added a file globals.py in the database/blog directory. This (optional) file is imported, and any variables/names will be globally visible to embedded code.

For example, my globals.py contains this line:

awaretek = '<a href="http://www.awaretek.com/">awaretek</a>'
Now, if I include the embedded code <% awaretek %> anywhere in my post, then this is evaluated and replaced by the HTML. See? Awaretek

I don't see the need for another special case if embedded code can work just fine. Aside from that, the patch was good, and much appreciated. This form of shortcuts will be available in 0.7.3 and therefore in the next release (probably 0.8).

Posted by Hans Nowak on 2002-10-05 21:03:09   {link}
Categories: Kaa

Generated by Firedrop2.