watch this The wheels are turning, slowly turning. home
Mantissa 0.4.1 Released! 2005-12-20


I bet you thought I was done! Well, this is the last one for tonight, I promise, and believe me, I saved the best for last. Mantissa 0.4.1 brings some really fantastic features.



First up is the Tabular Data Browser. This is some pretty awesome stuff. Basically it is not even worth trying to describe with words. Go signup for a free ClickChronicle account and see for yourself. After you have accumulated a few clicks, you’ll be able to browse them and page around and so forth: the HTML interface which allows you to do this is the TDB Controller. It is an Athena Widget that lets one page through the results of an Axiom query. The columns are customizable. The actions are customizable. The skin is customizable. All you have to do to get one of these things in your Mantissa application is instantiate TabularDataView with the customizations you desire and drop it onto a page someplace. Bam.



So now you’re really excited about using the TDB. You need to write a Mantissa application before you can take advantage of it, though. Fortunately, the other big improvement in this release is that writing a Mantissa application has gotten way easier. What you do now is write an IOffering plugin. It looks something like this:

from axiom import iaxiom, scheduler, userbase
from xmantissa import website, offering, provisioning
from clickchronicle import clickapp, publicpage, prods
import clickchronicle

chronicler = provisioning.BenefactorFactory(
    name = u'clickchronicle',
    description = u'An application with which to chronicle the clicks of you.',
    benefactorClass = clickapp.ClickChronicleBenefactor)

clicks = provisioning.BenefactorFactory(
    name = u'clickchronicle-clicks',
    description = u'Add some clicks to the click limit',
    benefactorClass = prods.ClickIncreaser,
    dependencies = [chronicler])

plugin = offering.Offering(
    name = u"ClickChronicle",

    description = u"""
    To-morrow, and to-morrow, and to-morrow,
    Creeps in this petty pace from day to day,
    To the last syllable of recorded time;
    And all our yesterdays have lighted fools
    The way to dusty death. Out, out, brief candle!
    Life's but a walking shadow; a poor player,
    That struts and frets his hour upon the stage,
    And then is heard no more: it is a tale
    Told by an idiot, full of sound and fury,
    Signifying nothing.
    """,

    siteRequirements = [
        (iaxiom.IScheduler, scheduler.Scheduler),
        (userbase.IRealm, userbase.LoginSystem),
        (None, website.WebSite)],

    appPowerups = [
        clickapp.StaticShellContent,
        publicpage.ClickChroniclePublicPage],

    benefactorFactories = [chronicler, clicks])


Actually, it might look exactly like this. This is the actual ClickChronicle IOffering plugin. Note that it is essentially all content: the boilerplate consists almost exclusively of importing modules and appeasing the Gods of Python syntax. This plugin assembles all the pieces which make up ClickChronicle into a coherent unit which can be deployed on a Mantissa server.




siteRequirements enumerate which must be available from the “site store”, which contains such things as the credentials database and the webserver configuration. appPowerups defines which Powerups are required by the “app store”, at least one of which is created for each application (ie, ClickChronicle); these can (and in this case, do) define the look of the public page for this application, as well as any other behavior which is not clearly attributable to a particular user.




benefactorFactories, predictably, defines a list of factories which create benefactor objects. A benefactor in Mantissa is an Item responsible for endowing a user with new functionality. In the case of ClickChronicle, there are two kinds of benefactors: one endows a user with the application itself, letting them record clicks and later browse them; the other raises the limit on the number of clicks the user is allowed to store. Note also that the latter depends on the former, indicating that benefactors produced by clicks cannot endow a user who has not first been endowed by a benefactor produced by chronicler.




Confused yet? If not, awesome. Go write some kick-ass Mantissa application. If so, don’t worry. I’m going to be writing some more in-depth documentation about the Offering system in the days to come.