betabug... Sascha Welter

home english | home deutsch | Site Map | Sascha | Kontakt | Pro | Weblog | Wiki

Entries : Category [ zope ]
All around the Zope application server
[digital]  [language]  [life]  [security]  [media]  [zope]  [tourism]  [limnos]  [mac]  [athens]  [travel]  [montage]  [food]  [fire]  [zwiki]  [schnipsel]  [music]  [culture]  [shellfun]  [photography]  [hiking]  [pyramid]  [politics]  [bicycle]  [naxos]  [swim] 

26 March 2007

Zwiki 0.59 RC2 is out... test, test!

A lot of bugfixes

Over the weekend Simon has released Zwiki 0.59 RC2 over at zwiki.org. It's been a while since there was a Zwiki release, so this one contains a lot of bugfixes. Some of the bugfixes are relevant to making your fight against the spammers and vandals who haunt any "open" wiki a better fight. We also have a few select new features, like "If-modified-since" handling (aka "conditional HTTP GET", or "304") to reduce traffic and server load, and sortable views of the issue tracker.

This is a Release Candidate, so please download and test it. Don't be afraid of testing though: The code is already running on zwiki.org, my own wikis and a few other places, so it's stable enough. We also need all translators to look through RC2. The final 0.59 release is due April 2.


Posted by betabug at 09:56 | Comments (0) | Trackbacks (0)
27 March 2007

Zope in Greece Meetup

Who's out there?
 

On Thursday I will meet with a couple of people who are also doing Zope stuff in Greece. It will be just an informal meetup, going out for coffee basically, maybe looking at examples of what people are doing. The interesting part is that many of us felt like they are the only one's doing Zope stuff here. So a little getting in touch could be fun.


This came about when I got contacted independently but almost at the same time by two people who work with Zope here in Athens. With a little bit back and forth we finally converged on this Thursday, the exact time and place not yet settled. We will likely go for a cafe with free wifi, so we can look at work examples. So far we are a very small group. If you feel you should come too, just drop me a line, either through the comments, or by mail (address on the contact page).

Posted by betabug at 21:06 | Comments (4) | Trackbacks (0)
03 April 2007

Zwiki 0.59 is released!

Lot's of bugfixes, some new features

Simon released Zwiki 0.59. This release includes a lot of bugfixes (some relevant to the neverending fight against spammers and vandals), and a few features. It's been well tested, so I'd suggest people upgrade to this. Of course if there are any problems or even feedback, let us know on freenode/#zwiki, on zwiki.org/IssueTracker or zwiki.org/GeneralDiscussion.


Posted by betabug at 09:44 | Comments (0) | Trackbacks (0)
03 April 2007

Zope/Plone Job in Athens

Work in Athens, go to see all the Islands on the Weekends :-)
 

Line One, the company where fellow "Zopista in Athens" Ioannis (aka indyone) works, is looking for a Zope / Plone programmer to work here in Athens (Greece). Read the job ad at papakiteliatziar.gr for details. Note: It's not the company *I* work for, no such luck for you :-)


Posted by betabug at 14:16 | Comments (0) | Trackbacks (0)
06 April 2007

A Beta Boring Product

Making a disk-based Zope product can be simple
 

A few days back someone asked on #zope/freenode for a more modern example of a simple Zope filesystem "python product", something known as a "boring product". There are already a few of them out there, but most of them are a bit dated. They use dtml, are based on some authors product (which needs to be installed) or tell programmers to use a lot of Zope base classes.

Yesterday evening I sat down and wrote my own. It's only about 80 lines of code, but it gives you a base for doing simple things fast, and build up from there. I wasn't quite sure where to put it, that's why it went on the papakiteliatziar wiki as "BetaBoring" The wiki doesn't have comments enabled -- if you feel like, you may drop a comment into this weblog.


Posted by betabug at 16:20 | Comments (1) | Trackbacks (0)
01 May 2007

This Friday Zwiki BugDay

Mark it in the calendar...

Just a small reminder: This Friday is a Zwiki bugday. As usual, you can read a bit more over at zwiki.org/BugDay, we'll be online at #zwiki on freenode too. Our main target is to try to reproduce and maybe close as many as possible of the old issues that are clogging the issue tracker.


Posted by betabug at 17:48 | Comments (0) | Trackbacks (0)
04 May 2007

DateTime changed, duh!

Zwiki bugday started early

Yesterday evening, even before Zwiki bugday officially started, we had the first results. I had pestered Wu to get involved, even though he's pretty much busy with work. In the evening he tried out a little test script I needed for our problem with "last edit date". We noticed that on his server DateTime('2007-05-02 10:11:04') doesn't give the same result as on my machines. At first I had thought this to be OS dependant (all of my boxen live happily without "locale" support). But then I noticed that he was using Zope 2.10 and a little testing on my side and a bit of search revealed that Zope's DateTime() has indeed changed for 2.10.

Zwiki is falling exactly in the case that got fixed: We have date strings without time zone information. We use DateTime() to get the strings into DateTime() objects (so we can do time calculations) - but we so far expected the date and time to be interpreted as GMT or "Universal" time zone (aka UTC).

To fix this for all Zope versions we have two approaches: We can change the format for last_edit_time to include timezone information, providing upgrade methods. Or we can glue ' GMT+0' at the end of last_edit_time whereever we convert to a DateTime(). The first choice appears cleaner to me, but we've already changed that format a couple of times in the past, so I wonder what others have to say.


Posted by betabug at 09:23 | Comments (0) | Trackbacks (1)
05 May 2007

Zwiki Bugday Wrapup

Fun and successfull

Yesterday's Zwiki bugday was fun and successful. It started slow. In the morning I was busy at work, but in the afternoon got permission to work on the bugday on company time (yay Graphics Garage!). Had a slow start, mainly getting details on some of the issues, like the stuff Wu helped with, but did not get a break in on any particular bug. Later Simon showed up on #zwiki and things got really started...


After working hours I went home and continued till past midnight. This bugday showed me that exchange of information and opinions are an important point of a bugday. "What do others think about this fix?", "What's the best way to solve issue X?", "What was this line of code there for?", "Does Y work for anyone?" - that kind of stuff. You can't always discuss things right away when project devs are so far apart and in totally different timezones.

I got my DateTime change question answered, and went on and fixed it right away. We decided to change the format for last_edit_time after all - the change turned out to be clean and fast. There is now only one point -- in the upgrade() method -- where we detect an old style ISO() DateTime format without time zone information. We mimick the old behaviour by slapping on a ' GMT+0' and convert to a proper ISO8601 timestamp. I don't think I closed any other issues myself (except for a dupe or so), but I'm content with the result of the day.

Posted by betabug at 11:46 | Comments (0) | Trackbacks (0)
24 May 2007

Another Zope Meetup in Athens?

Have fun, meet some Zope people
 

Last time a few of the Zope users in Athens met, we had lots of fun. How about another meeting? Please tell me:

Judging from the last time we met we would look at some examples of what people are doing (that's why wifi would be a plus) and have a wild question-and-answer session, all mixed in with a lot of chatting and having coffee. Drop me a mail or post a comment if you're interested!


Posted by betabug at 16:15 | Comments (2) | Trackbacks (0)
31 May 2007

Athens Zope Meetup Tonight

Flocafe on Syggrou Avenue, starting about 18:00 and up
 

So tonight Thursday without much organization and overhead we'll have another Zope meetup here in Athens, Greece. Whoever feels like it can join us at the Flocafe in Syggrou for some chat, questions (and answers), maybe a little show up of past and current projects. No agenda, no talks, just getting in touch and seeing what others are doing. I'll be there, starting about 18:00 - 19:00.

Directions: There is only one Flocafe on Syggrou avenue. If I recall correctly it's at the stasi "Efesou" or thereabouts, near the Agios Sostis church. With public transport it's best to take the Metro to "Fix", then take any bus that goes in direction away from Athens (down to the sea) and get out at the next station after you pass Agios Sostis church.


Posted by betabug at 10:58 | Comments (2) | Trackbacks (0)
04 July 2007

RAM Cache a Method from a Python Product

So you want to keep it for a while?
 

Say this method of yours takes some time to run. You've learned to use a RAM Cache Manager to cache DTML methods in the ZMI, but now you have made your own filesystem based Python product, and a method of that should get the speed boost. It's nearly as easy as clicking it together with a "DTML Method" in the ZMI, so lets have a look at how to cache-enable a python method in a Zope product...


Our setup: Just this one method

We made our own Python product, which we based on CatalogPathAware to make it interact with Zope's various caches. There we have this one method, lets call it "bigman", where all the heavy lifting is happening, maybe it looks something like this:

security.declareProtected('View','bigman')
def bigman(self, someparameter):
    """
    Do some heavy lifting.
    """
    for item in self.objectValues():
        self.do_more_heavy_stuff(item)
        # ... and so on ...
Appart from this method we also have set up a "RAM Cache Manager" in the ZMI, so it can be "seen" from the instance of our final product.

The principle: Move the method behind a strawman

To make our "bigman" method cached and control when to return cached data, when to run the method and cache the data, we need a new method that controls the behaviour. To get there, we first rename our "bigman" method and declare it private:

security.declarePrivate('_bigman')
def _bigman(self, someparameter):

Now we write a new method to control access to our renamed "_bigman":

security.declareProtected('View','bigman')
def bigman(self, someparameter):
    """
    Get bigman data either from cache or from the real method.
    """
    view_name = 'bigman' # choose your own here!
    keywords = {'someparameter':someparameter} # see note
    cached_data = self.ZCacheable_get(view_name=view_name,
                            keywords=keywords, default=None)
    if cached_data is not None:
        return cached_data
    else:
        # no data in the cache, so cache it
        data_to_cache = self._bigman(someparameter)
        self.ZCacheable_set(data_to_cache,
                    keywords=keywords, view_name=view_name)
        return data_to_cache

Control Flow and "keywords"

Some things are happening here: First of all we set up a "view". This is some kind of identifier that tells the RAM Cache Manager which method is being fingerprinted. The term "view" has had a bit of an inflation lately, a "view" here has nothing to do with "Five" views, Z3 views, or any other views you may or may not know in Zope. Just think of it as "identifier". The Cache Manager uses it to keep cached data appart.

The next line declares "keywords", which is another way to keep the cached data appart. Where "view" was used to keep the methods appart, the keywords can be used to keep parameters to methods appart. Methods obviously should return different data when parameters change - even when cached. Without changing keywords, the Cache Manager will keep just 1 copy of our methods results. If "bigman" normally returns different results depending on "someparameter" being "blue", "red", "green", or "yellow", then with "keywords" set up like this, the Cache Manager will keep 4 results. It's very similar to the "Names from the DTML namespace to use as cache keys" field in the ZMI "Cache" tab of DTML methods. If you don't need varying parameters, my guess is you can leave the dictionary empty or use something like keywords = {'a':'b'}

From there on we call the ZCacheable_get method (we inherited that through CatalogPathAware) with our parameters. If no data is in the cache for our combination of "view" and "keywords", then we get back None. In that case we want to run our "expensive" method and feed the output to the cache (and to the user). The timing setup, when to throw away "old" cache entries, how long to keep things, how many entries to keep, all that is set up in the RAM Cache Manager.

All set up... but nothing in the cache!?

At this point we're almost done: Our setup works, but it never gets anything into or from the cache. The reason is that we still have to associate our products instance with our RAM Cache Manager in the ZMI. Just "associate" your instance in the ZMI, like you have learned to do with DTML Methods. this will enable all cacheable methods of a product, and it's the "views" that lets the cache keep them apart.

Invalidating the cache with a "view"

One last thing remains: It might happen that we know that our data in the cache has become stale, for example if we process some input that changes the underlying data. In that case we will invalidate the cache with something like this:

self.ZCacheable_invalidate(view_name='bigman')

Posted by betabug at 13:47 | Comments (0) | Trackbacks (0)
31 July 2007

COREBlog Month Views messed up

The UTF-8 gave up
 

Just a short service notice to my readers: I just noticed that something (likely the Zope 2.8 to 2.9 upgrade) messed up the UTF-8 in the weblog's month archive view (only there apparently). Greek text and German umlauts are broken right now. I'm investigating, please excuse the inconvenience.

Update 2007-11-08 This should be fixed now, apparently there were some entries with broken encoding in the DB.


Posted by betabug at 10:59 | Comments (2) | Trackbacks (0)
05 August 2007

zwiki.org Domain Trouble

Awaiting Domain Renewal

Currently zwiki.org is awaiting domain renewal. The domain name can't be resolved, so you can not reach zwiki.org by browser right now. Quote Simon on GeneralDiscussion: "zwiki.org is expiring and I'm having trouble getting my registrar to accept the payment." If you are in a hurry and need to access something from zwiki.org, you can add the following line to your /etc/hosts file:

66.179.181.88   zwiki.org
... don't forget to remove that line once regular DNS service picks up zwiki.org again.

Update: Problem solved! The domain is renewed, DNS is flowing again, we're open, visitors welcome!


Posted by betabug at 15:06 | Comments (0) | Trackbacks (0)
16 September 2007

Zwiki 0.60 Released!

There you go
Unobserved by the world, Simon released Zwiki 0.60 into the wild yesterday. We had a 0.60RC1 for a while, some bugs came up and got fixed and here you are, with the next proper release. I have to think hard about what's new in this release, mind you: not because there isn't anything, "au contraire", there is a lot. But I've been running on development versions for quite some time now and have enjoyed most of the changes for a while already. So, what's there?

Posted by betabug at 13:30 | Comments (0) | Trackbacks (0)
05 October 2007

Copy a Folder's Contents

One of those small things

Zwiki's new revision system uses a BTreeFolder2 to permanently store revisions. That's a wise decision, because those revisions can really pile up. Some wikis ran with an interim version of the code, where it created a normal folder to hold revisions. What I did there is to rename the folder to "revisions_orig", create a new "revisions" folder and copy the contents over. Here is a little python script that does the copying over, when the cookie used by ZMI copy & paste can't seem to hold them all. Nothing special, just one of those posts to remind myself...


Create a new "Script (Python)" object in the ZMI, fill it in with this code:

### Parameter List: from_folder, to_folder

from_folder = getattr(context.aq_explicit, from_folder)
to_folder = getattr(context.aq_explicit, to_folder)

from_folder_ids = from_folder.objectIds()

from_copied = from_folder.manage_copyObjects(from_folder_ids)
to_folder.manage_pasteObjects(from_copied)

print 'done'
return printed

Running it should be self-explaining.

Posted by betabug at 11:22 | Comments (0) | Trackbacks (0)
08 October 2007

reStructuredText in COREBlog

...and thinking that it was there all along
 

In my last few posts I have experimented and switched the entry format here to reStructuredText. I had tried reStructuredText in COREBlog before (it was there all along), but had run into problems with making links, now I gave it more tries and got it working so well, I switched over my default entry format. As a weblog reader you won't really notice any of this - unless I break something in the process :-). Here are a few things I noticed along the way...


So, let's start with the observations:

Overall I'm sold. What I want to do next is to patch COREBlog to let me use reStructuredText for moblog entries. It would just be so much easier to use RST in entries I write by mail.

[1]I probably only think that footnotes are fun because I never had to go through all the "acedementia" thing where you are forced to write lots of papers with lots of standardized footnotes. I also think that footnotes are cumbersome to read in real books.

Posted by betabug at 09:20 | Comments (2) | Trackbacks (0)
Prev  1   2   3   4   [5]   6   7   8   Next