[Grok-dev] Re: A Django-like admin in Grok

Wichert Akkerman wichert at wiggy.net
Fri Apr 25 03:27:00 EDT 2008


Previously Martijn Faassen wrote:
> Robert Gravina wrote:
> >:)... Django tempalates differ from ZPT in that they are not 
> >XML-based... so your output may not be valid, or even XHTML at all (can 
> >be used as a general text processor). Not sure how this effects Grok...
> 
> No problem at all; Grok (and Zope 3) can work with text-based processors 
> just as well as XML based. In the end what comes out will be strings, 
> after all.

Someones you really want a text based processor, for example when
creating emails, CSS or javascript. Of course you can do that using a
XMl based templating system but the result is very hard to read or edit .

One reason I really like genshi is that it can do both: it enforces
valid XML (although you can opt for html) using an attribute style
syntax similar to TAL but you can also use it using a substitution-style
syntax (in which case it will still enforce valid XML!). This is very
practical when producing xhtml where you need to insert a bit of
javascript. Being able to do something like this is right in your html
file is extremely practical:

    <script type="text/javascript">
/* <![CDATA[ */
        var rateChangedHandler = function (oArgs) {
            var record = oArgs.editor.record.getData();
            var postData = "rate=" + oArgs.newData;
            YAHOO.util.Connect.asyncRequest("POST",
                    "${h.url_for(controller='currency')}/" + record.code + "/update",
                    null, postData);
        };

/* ]]> */
    </script>

Wichert.

-- 
Wichert Akkerman <wichert at wiggy.net>    It is simple to make things.
http://www.wiggy.net/                   It is hard to make things simple.


More information about the Grok-dev mailing list