SourceForge.net Logo
Overview
Features
History
News
Todo
Download
Install
Documentation
License
Widgets
Epydoc

Overview

        
        pyhtmloo is a library that allows python developers to use HTML
        code like any other python objects. My final goal of this work
        is to have a library of HTML 'widgets'.
        This will allow us to no re-invent the wheel when we build HTML pages.
        
        An another interesting aspect of pyhtmloo is to split the work
        between web page desingers and python developers.
        This is an another idea of split between web layout and web content.
        
        In the same area you can also look at HTMLGen and
        pyweb
        
       

Features

        
        - any HTML tag is a python object
        - pyhtmloo objects can be inherited to have additional methods (for example addrow for Table obect).
        - simple widgets are available. For some examples, check widgets web page.
        
       

History

        
        As any other lazy people, I was a bit furstrated to redo nearly
        the same work for different web pages I build. From that fact,
        the idea comes to have a kind of library of flexible widgets
        to allow me to concentrate the effort on the web page content.
        My idea seems to have the same philosophy as phphtmllib for php.
        
       

News

        
        September 10th, 2003 : first public release
        
        September 20th, 2003 : presentation of the widgets web page.
                               release 0.7.
                               
        March 11th, 2006: Release 0.8 on Sourceforge.  
                               Thanks to Richard Whitehurst and Kamal Mustafa, several bug fixes and 
                               implementation of new features. 
                               Unfortunately, this new release breaks backward compatibility with 0.7.
                               Indeed, the HTML attributes are no more pyhtmloo object's prameters, you 
                               must use .setattr() or .getattr() instead.
        
       

Todo

        
        - Build a setup.py module : Done
        - Testing on Linux : 1 tester
        - Testing on Windows : 1 tester
        - Testing on Mac : 0 tester
        - Building a pyhtmloo logo : Your help is welcome for this
        - Build a web interface allow everyone to post their widgets (any volunteers ;-))
        
       

Download

        
        You can find it at sourceforge.
        Version 0.8 is in a tar file; last update are available via the 
        sourceforge CVS.
        
       

Install

        
        Simply untar the the tar file and execute setup.py.
        You can test the code with given widgets.
        
       

Documentation

        
        Any HTML elements are python objects. Any HTML attributes are
        python arguments. All those classes are child of the "Tag" class.
        As exception, "content" is the dedicated argument for the text
        of the tag.
        For simplicity the first argument is "content", others are HTML attributes.
        
        Here after the different way to produce the same result :
        1) test=pyhtmloo.html(pyhtmloo.body("test",bgcolor="white"))
        
        2) test=pyhtmloo.html(pyhtmloo.body(bgcolor="white",_tc="test"))
        
        3) body=pyhtmloo.body("test")
           body.setattr(bgcolor="white")
           test=pyhtmloo.html(body)
        
        4) test=pyhtmloo.html(pyhtmloo.body("test"))
           test.TC[0].setattr(**{'bgcolor':"white"})
        
        By printing test, you will get:
        <html>
         <body bgcolor="white">
          test
         </body>
        </html>
        
        As You can see, pyhtmloo indent automatially the produced html file.
        If for some specific reasons, you don't want to respect the default
        behaviour, you can look the "_params" object.
        For example with the previous example, we can do :
            test.TC[0].setparam(delimiter='')
        Then you will get :
        <html>
         <body bgcolor="white"> test</body>
        <html>
        
        

Tips for Textarea

If you have textarea HTML Tag in your code with predefined values, you can avoid the "indent effet" within your html textarea by setting the global indent to "". import pyhtmloo pyhtmloo.gobal_indent="" More examles in the widgets/form.py

Tips for HTML Attributes

Because of python reserved keywords, several attributes will generate python errors: class, def, if, ... 2 possibilities to avoid such issues: 1) use _attrs. For example do: pyhtmloo.div('some text',_attrs={'class':'content'}) 2) use uppercase letters: For example do: pyhtmloo.div('some text',Class='content')

License

        
        This code is released under the GPL License.
        
       

This page was build with on Sat Mar 11 18:35:56 2006