[Dev] new utility module, plus headless Chandler

Morgen Sagen morgen at osafoundation.org
Sun Jul 10 02:10:00 PDT 2005


In an effort to increase code reuse between Chandler and other  
scripts, I have migrated certain pieces of code out of Chandler.py  
and application/Application.py into application/Utility.py (if you  
have a better name for this, please let me know).  This means other  
scripts now can run the exact same implementations for:

- examining command line arguments and environment variables
- opening the repository
- checking the schema version
- loading parcels
- creating the profile directory
- starting and stopping twisted and the wakeup callers

The immediate benefit of this was that it became pretty simple to  
write a "headless" (no GUI) version of Chandler which does all those  
things in the above list, and then presents the user with an  
interactive python shell.  Exiting the shell then shuts down twisted,  
commits the repository, and exits the script.  The script is in tools/ 
headless.py (just run it with via RunPython tools/headless.py); once  
it drops you into a python shell, type "readme()" for more info.   
There are some fun commands for examining the repository like a  
filesystem, with cd( ) and ls( ) for moving around and browsing, show 
( ) to get details on an item, or grab( ) to get a reference to an item.

~morgen

P.S.  Known bugs in headless mode:  Wakeupcallers don't seem to fire  
until the *second* time you run the script; and the 'inbound' parcel  
(RSS reader) doesn't quite work yet.  I should have those fixed soon  
though.


More information about the Dev mailing list