Tao of the Machine

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

Another Kaacolyte

Wai wai! I just (re?)discovered this weblog, that is powered by Kaa. The latest version in fact. (So it actually works! ;-)

Posted by Hans Nowak on 2003-08-07 22:44:25   {link}
Categories: Kaa

Kaa 0.9 available for download

See the download section.

What’s new since 0.8?

  • New buttons: code, blockquote
  • An RSS file can now (optionally) be generated
  • Error message dialog with traceback (old version just printed the error in a console window)
  • Improved category handling (renaming, deleting)
  • Better HTML/embedded code renderer (taken from Firedrop)
  • Textile format is now supported
  • Some small bugfixes, e.g. main window now expands correctly (patch by David LeBlanc); archive method now defaults to “e:7”; when a new blog is created, it is opened immediately; front page filename can be set; etc.

Enjoy. Please send bug reports, comments, etc, to kaa at zephyrfalcon.org.

Posted by Hans Nowak on 2003-04-22 17:10:19   {link}
Categories: Kaa

Test, test

This is supposed to be a Textile entry. Let’s see if it works.

Textile has three important benefits over regular HTML formatting:
# it’s easy to read.
# it’s easy to read.
# there is no number three.

In other words, you can now use Textile in Kaa. It’s really easy too: if an entry’s first line consists of a single #, then that entry is considered to be in Textile format, and will be treated accordingly. Kudos to Mark and Dean (visit this last link to see how it works).

Expect the official 0.9 release Real Soon Now.

Posted by Hans Nowak on 2003-04-20 17:27:55   {link}
Categories: Kaa

Firedrop fixes Kaa problems, part 1

In this case, embedded code has become more sane. I still won't resort to pseudo-Python like some other systems do, but you can now write
<#
    print this
    print that
#>
and it will work. Note that you still can't write things like
<# print this
   print that
#>
because it's inconsistent indentation that cannot be fixed. When in doubt, start on a new line. <0.1 wink>

All this will be in Firedrop, but there's nothing really that stops me from sticking the improved module (and test suite) back into Kaa, I guess. Maybe for 0.9...

Posted by Hans Nowak on 2003-02-22 20:57:12   {link}
Categories: Firedrop, Kaa

A quirk in Kaa's embedded Python

Kaa currently has a quirk, in that it wants, and assumes, the first line to have an indentation of 0. You can write this:
<#
    print 'whee'
#>
but you cannot write this:
<#
    print 'foo'
    print 'bar'
#>
Why does the first example work and the second doesn't? Because the first line is assumed to have indentation 0. Kaa sees the second example as:
<#
print 'foo'
    print 'bar'
#>
In other words, inconsistent indentation. There are no problems if you just use an indentation of 0 to begin with, like
<#
print 'foo'
print 'bar'
#>
This needs to be fixed before 0.9.

Posted by Hans Nowak on 2003-02-03 09:48:52   {link}
Categories: Python, Kaa

Spijs op je lijf

For work, I'm currently looking at something like ASP for Python. Python Server Pages, so to speak. One good candidate seems to be Spyce.

Including Kaa, I've seen three programs that use embedded code in HTML (the other two are Vellum and Spyce), and they all use a different syntax. Kaa uses <% %> and <# #>. Vellum uses <% %> as well, but allows the "=" syntax (IIRC) and weaving HTML and Python, using the word "end" as a dedent replacement. Spyce uses [[ ]] and allows "=" and weaving as well, and uses { and }. To illustrate, here's an example from the Spyce site:

<html><body>
  Hello [[print 'world!',]]
  [[ for i in range(10): { ]]
    [[=i]]
  [[ } ]]
  <br>
  Color chart:<br>
  <table border=0 cellpadding=0 cellspacing=0>
  [[ cols = ['22', '66', 'AA', 'EE' ]
     lencols3 = 5*len(cols)
     for r in cols: { ]]
       <tr>
       [[ for g in cols: { ]]
         [[ for b in cols: { ]]
           <td width=5 height=[[=lencols3]] 
           bgcolor="#[[=r+g+b]]"></td>
         [[ } ]]
       [[ } ]]
       </tr>
  [[ } ]]
  </table>
</body></html>
Notice constructions like
[[ for i in range(10): { ]]
    [[=i]]
[[ } ]]
which are not allowed in Kaa. In Kaa you would write:
<#
for i in range(10):
    print i,
>#
which is more Pythonic, IMHO... no artificial extensions to the language.

For fun and profit, here's how you would write the example above in Kaa:

<#
print "Hello world!"
for i in range(10):
    print i,
print "<br>"
print "Color chart:<br>"
print "<table border=0 cellpadding=0 cellspacing=0>"
cols = ['22', '66', 'AA', 'EE']
lencols3 = 5 * len(cols)
for r in cols:
    for g in cols:
        for b in cols:
            print "<td width=5 height=", lencols3,
            print "bgcolor=" + "#"+r+g+b, "></td>"
    print "</tr>"
print "</table>"
#>
and here's the result:

Hello world! 0 1 2 3 4 5 6 7 8 9
Color chart:

(Note: Of course, I'm only comparing the ways of embedding Python here, not the capabilities of both systems... Spyce is a "Python Server Pages" system, Kaa is a client-based weblogging tool, two entirely different beasts.)

Posted by Hans Nowak on 2003-02-03 09:27:32   {link}
Categories: Python, Kaa

Kaa 0.8.7

A new development version of Kaa can be downloaded here. (As always with a development version: be careful, backup your weblog before using, etc.)

What's new?

  • Better category management: when you rename or delete a category, the changes are propagated to the entries in the database. (Note: if it affects the current entry, it is reloaded! So save before meddling with categories.)
  • Main window now expands correctly.
  • You can now set the name of the "front page" filename as an option.
  • Fixed some bugs with categorymanager and newly created weblogs.
  • Archive method now defaults to "e:10", filename to "index.html".
(Most of the fixes are courtesy of David LeBlanc who filed some bug reports and a patch.)

Kaa is Zoidware. (If you like it, and want to show your appreciation, you can get me that nice Spiderzoid on Ebay. ;-) Or a Tarantulon...

Posted by Hans Nowak on 2003-01-17 21:33:06   {link}
Categories: Kaa

Kaa stuff

Kaa has reached 0.8.6. This version isn't available for download, because I need to do some more testing... but it is *supposed* to fix the problems with categories. (Currently, if you rename or delete a category, the changes are not propagated to the posts that use that category. In other words, if I delete or rename category 'foo', then posts with that category will happily keep on showing it like nothing changed. This is fixed now, in the new version.)

Just for the record, here's a trick to make something appear on your front page only (and not on archive pages):

<# 
if blog.current_page == blog.filename:
    # do something
#>
Explanation: blog.filename is the name of the front page. blog.current_page is the name of the page currently being generated.

Update (4:41 PM): Kaa now generates another RSS file, containing the whole text of a post, including HTML. I wonder what to do with it; according to the RSS Validator, it's not valid. But some news aggregators do read it. Maybe I should upgrade (?) to RSS 2.0?

Posted by Hans Nowak on 2003-01-12 16:04:08   {link}
Categories: Kaa

Exceptions

Until now, Kaa always wrote error messages and exception traceback to the console window. Not everybody can read those, though, so it was time for a change. Kaa 0.8.4 will have two new dialogs, one that displays error messages (could be used for anything really, warnings, even an "About..." message), and one that displays an exception.

sys.excepthook doesn't work with Tkinter. It doesn't catch the exceptions that occur in widget methods (not sure about exceptions that occur anywhere else). After some poking around, I found a way to set Tkinter's "except hook". Not sure how reliable it is, but here goes:

# define the exception hook as a method of your main frame
def excepthook(self, exctype, value, traceback):
    print 'excepthook called'
    # do something nice

def __init__(self, ...):
    # set it
    Tk.report_callback_exception = self.excepthook
  1. Normally __init__ will be defined first, of course...
  2. I made this a method of my main frame, so the except hook can create an exception dialog with that frame as its parent. Defining it as a function would probably work too.
If this works, then I don't need to worry about uncaught exceptions anymore. They will be displayed in a nice window, and helpful users can copy & paste this in a bug report.

Get the development version 0.8.4 here. No guarantees, make a backup of your database before you install it, etc.

Posted by Hans Nowak on 2003-01-07 22:21:48   {link}
Categories: Kaa

Got root?

Kaa 0.8.2 (the current version, not available to the public yet) also includes a new setting: "root", which is basically the URL where your weblog can be found once uploaded. For example, in my case it's http://home.earthlink.net/~wurmy/weblog/. This link wasn't necessary before, but is now used for RSS. After all, people will need to know where to find your weblog, and permalinks with an absolute URL rather than a relative one are more useful too. ;-)

Should Kaa write an alternate RSS file for *all* posts? I wonder. Feel free to leave comments. ^_^ (Not that I expect anybody to, not unless I link to one of Mark Pilgrim's posts... <0.5 wink>)

Posted by Hans Nowak on 2003-01-05 14:03:42   {link}
Categories: Kaa

Yesterday's roundup

Besides hacking Kaa, I did some more stuff yesterday.
  • Python 2.3a1 builds right out of the box on the Mac. Well, a configure / make install does, at least. I haven't tested a framework build; heck, at this moment, I don't even know what a framework build *is*! <0.1 wink> So that is for later. Probably when I've digested large parts of Mac OS X Unleashed...
  • Charm works, well, like a charm. I used it to work on Kaa. While not perfect, it is quite useable. Maybe I should release it someday, although I don't think I should do that until all Requirements (20 at the moment) are met. (We're at 14/20, currently.)
  • As for Kaa, I also fixed a coupla bugs, and added two new buttons: "code" (inserts <code><pre> tags) and "blockquote".
  • Idea: What if Kaa also could validate HTML? That could be an interesting feature.
Gotta get back to work. More hacking later... maybe.

Posted by Hans Nowak on 2003-01-03 10:29:41   {link}
Categories: switch, Python, Kaa

0.9 coming up soon

Some good late-night hacking today. I figured it would be nice if Kaa (finally, some would say) generated an RSS file, so I added that. It may still contain bugs, or not validate, etc; I will take care of that later. Important is that most of the functionality is there, and will be included in Kaa 0.9, which should not be far away now.

In the navigation bar on the right, there should be a new entry "RSS" now. Whether the RSS file shows up correctly is a different issue, but it is there. :-)

More later. I need some sleep...

1:56 AM. The RSS Kaa generates validates! Yay! :-)

Posted by Hans Nowak on 2003-01-03 01:27:37   {link}
Categories: Kaa

Another Kaa user

This is my first open source program that people actually use... <0.3 wink> I really need to fix some bugs and make Kaa more user-friendly. Not to mention, write some more docs...

Posted by Hans Nowak on 2002-12-10 21:25:50   {link}
Categories: Kaa

Almost finished

My article on Kaa is almost done. I need to check it for speling errors, and verify that it's actually informative. I find it not easy to write about my own program; it feels like I'm merely stating a list of facts that are well-known.

In the meantime, David LeBlanc has sent me some emails with ideas and bugfixes, which are quite interesting. Some of this will find its way into Kaa 0.9. More on this later.

Posted by Hans Nowak on 2002-12-08 13:05:21   {link}
Categories: Kaa

By the way...

Does anybody know how I can make the editor window in Kaa stretch *vertically*? I tweaked the Tkinter code a bit here and there, and now it stretches horizontally when you resize the window, but not vertically yet.

Posted by Hans Nowak on 2002-11-23 00:47:00   {link}
Categories: Kaa

Picking up steam

Seems more people are taking an interest in Kaa. Today an ex-colleague of mine mailed me and said he downloaded it. I also got a request to write an article about it, for PyZine.

Knowing this, I should probably leave Kaa as it is, a weblogging tool, and save more ambitious goals for future projects. And yes, there will be a 0.9. Any ideas what I should put in there? Drop me a mail or leave a comment...

Posted by Hans Nowak on 2002-11-06 00:01:17   {link}
Categories: Kaa

I forgot the Kaa logo...

Kaa

(courtesy of Christian Tismer)

Posted by Hans Nowak on 2002-10-28 18:34:54   {link}
Categories: Kaa

0.8 is here

An announcement in the newsgroup will follow soon. Download 0.8 here.

For those who have been following the weblog: there isn't really anything new since 0.7.7, but I souped up the documentation a little, etc. See the updated intro. Maybe soon I will be able to manage my whole site with Kaa. :-)

Posted by Hans Nowak on 2002-10-27 10:15:06   {link}
Categories: Kaa

Content management made easy?

Here's an idea. What if we had:
  1. an easy way to "tag" an entry, i.e. associate it with a certain word, e.g. "faq", "main", "index", "ideas-page", etc
  2. an easy way to display these tags in a list of entries, and/sort on them ("only show me the entries with tag X")
  3. an easy way to generate pages with the given entries
We already have #3, basically. It may not be easy enough yet, but it is already possible to select entries that match certain criteria. Entries with tag X would only be another criterion.

#1 would not be difficult, either. We already use categories and the visible key in the entry.misc dictionary. Adding a tag, or several, would be trivial.

#2 isn't there yet. We would need a multi-column widget, or a table widget, or something. Sorting isn't there yet either, but that isn't so difficult.

So what can we do with the above? Easy content management. Create a new "blog" (IOW, a collection of entries), add entries, and "tag" them to associate them with a certain page. Some entries will make up my FAQ. Some may make up my main page. Some are documentation. Putting an order in is trivial by adding "sub-tags", like a number. (For example, if there are 20 entries with the "faq" tag, then we could figure out the order of the FAQ questions by using the "order" key which contains a number.)

The tricky part is to get the "tag management" right. If that is easy to do, then building a site will be easy to do. Same for generating the custom pages. There should be some default, like, associate a page name with a tag name, and generate that page in a custom way. For those who want more, there's always pagegen.py.

Posted by Hans Nowak on 2002-10-26 18:33:04   {link}
Categories: Kaa, ideas

Where to now?

Kaa 0.8 is almost ready (I expect to publish it this weekend). It has reached the point where it more or less does what I want. Sure, I can think of oodles of new features, small and large, but that doesn't take away the fact that I am reasonably content with it the way it is. It generates my blog, I have the few editing functions that I need, I can generate a custom page and archives... that's about it.

Or is it? What direction should I take? Here are some thoughts.

Q: Should Kaa be aimed at as many people as possible, or should it be more of a "niche" weblog, aimed at (Python) programmers?
This issue came up a while ago, when I got a nice patch, and after some thought decided it was redundant. The author argued that his macro was something else than embedded Python code, and made some good points. The dilemma here is: if Kaa wants to be everybody's weblogging system, then the macro is a good thing to have... but if it's mainly for Pythonistas, then such a thing is indeed redundant, because people will use embedded code instead.

Q: Should Kaa evolve into a more general content management tool?
When I say general, I mean general... I'm thinking of a system where you can associate a number of entries with a web page, to put it simply. Some will make up a blog, some will make up docs, a FAQ, etc. In other words, such a system could manage your whole site, including your weblog. Do I want it? Yes. But I'm not sure if it should grow out of Kaa, or that I should start a new project from scratch. What do Kaa users want? I don't know.

Q: Should Kaa grow lots of features, or remain simple?
It is very easy to add more and more features... and in a way, Kaa's design (with embedded Python code everywhere) encourages users to think like this. Feature X doesn't exist? Add it (whether that be some custom code, or a macro, or a patch...). On the other hand, one could also argue that because of its "scriptability", Kaa should not attempt to add too much... those who want special features, can and will write them themselves.
Personally, I don't know if it should grow so big. It's only a blogging tool, not an operating system or an editor.

If you have thoughts on this, feel free to leave a comment or send me a mail.

Anyway, I added some small thingies, like walking through the input boxes with the Tab key, and the use of a custom port when FTP'ing. (All this inspired by a mail by Alan Runyan.) Expect 0.8 soon, unless life interferes.

Posted by Hans Nowak on 2002-10-23 23:59:09   {link}
Categories: Kaa

--
Generated by Firedrop2.