plonewars.com

April 15th, 2007

Netsight Internet Solutions – Zope and Plone Consulting, Bristol, UK

Netsight Internet Solutions – Zope and Plone Consulting, Bristol, UK

Originally from del.icio.us/tag/plone by matsh


from Yoda http://plonewars.com/2007/04/15/netsight-internet-solutions-zope-and-plone-consulting-bristol-uk/







April 15th, 2007

plope – Advanced Page Templates

plope – Advanced Page Templates

Originally from del.icio.us/tag/plone by shimizukawa


from Yoda http://plonewars.com/2007/04/15/plope-advanced-page-templates/







April 15th, 2007

plope – Appendix C: Zope Page Templates Reference

plope – Appendix C: Zope Page Templates Reference

Originally from del.icio.us/tag/plone by shimizukawa


from Yoda http://plonewars.com/2007/04/15/plope-appendix-c-zope-page-templates-reference/







April 15th, 2007

plope – Using Zope Page Templates

plope – Using Zope Page Templates

Originally from del.icio.us/tag/plone by shimizukawa


from Yoda http://plonewars.com/2007/04/15/plope-using-zope-page-templates/







April 15th, 2007

Open Source — la mont pagnotte familly

OPEN SOURCE SPOTED

Open Source — la mont pagnotte familly

Originally from del.icio.us/tag/plone by camusdesbois


from Yoda http://plonewars.com/2007/04/15/open-source-a%c2%80%c2%94-la-mont-pagnotte-familly/







April 15th, 2007

CIGNEX – Plone LIVE Book Offer

CIGNEX – Plone LIVE Book Offer

Originally from del.icio.us/tag/plone by paulmccarthy


from Yoda http://plonewars.com/2007/04/15/cignex-plone-live-book-offer/







April 15th, 2007

Forums — la mont pagnotte familly

Forums — la mont pagnotte familly regorge d’astuces, totoriaux en tout genres

Forums — la mont pagnotte familly

Originally from del.icio.us/tag/plone by camusdesbois


from Yoda http://plonewars.com/2007/04/15/forums-a%c2%80%c2%94-la-mont-pagnotte-familly/







April 15th, 2007

Plone Visual — nagosui.org

Plone Visual — nagosui.org

Originally from del.icio.us/tag/plone by o0gasawa


from Yoda http://plonewars.com/2007/04/15/plone-visual-a%c2%80%c2%94-nagosuiorg/







April 15th, 2007

Plone products, Plone content management software directory

Plone products, Plone content management software directory

Originally from del.icio.us/tag/plone by wx672


from Yoda http://plonewars.com/2007/04/15/plone-products-plone-content-management-software-directory-7/







April 15th, 2007

Ian Bicking: lxml Transformations

In followup to my previous post on form generators, I thought I’d
note some implementation details of the pipeline approach I advocate
there.

So, one thing I proposed is that we have some notion of requiring some
Javascript or CSS from within an HTML element. Let’s say it looks
like: <input type="date" js-require="DateSelect">. There’s a
function find_library_url(name, type), called in this case like
find_library_url('DateSelect', 'js'), and it returns something
like "http://localhost:8080/static/js/DateSelect.js" (we won’t
worry about how it is implemented).

Here’s how you could do this transformation using lxml:

from lxml import etree
from urlparse import urljoin
def resolve_js_require(doc, doc_url, find_library_url):
    if isinstance(doc, basestring):
        doc = etree.HTML(doc)
    script_hrefs = set()
    for el in doc.xpath('//*[@js-require]'):
        name = el.attrib['js-require']
        del el.attrib['js-require']
        url = find_library_url(name, 'js')
        script_hrefs.add(url)
    # Check that we aren't duplicating any explicit <script> tags:
    for el in doc.xpath('//script[@src]'):
        url = urljoin(doc_url, el.attrib['src'])
        if url in script_hrefs:
            script_hrefs.remove(url)
    try:
        head = doc.xpath('//head')[0]
    except IndexError:
        # No <head>
        head = etree.Element('head')
        doc.insert(0, head)
    # Add in the <script> tags:
    for url in script_hrefs:
        el = etree.Element('script')
        el.attrib['type'] = 'text/javascript'
        el.attrib['src'] = url
        head.append(el)
    return doc

Extending this for CSS is hopefully obvious. You can see the code
with an explanatory doctest in my recipe repository.
Hopefully this example seems easy enough that people will see the
benefit of the technique. lxml is a great library, and would be great
for cleaning up the implementation of things like the
HTMLParser-based monstrosity
of htmlfill. (Note: do not use
HTMLParser, it’s not
worth the effort.)

Ian Bicking: lxml Transformations

Originally from Planet Plone


from Yoda http://plonewars.com/2007/04/15/ian-bicking-lxml-transformations/