Viewing posts for the category Development
I wrote a page with quite a few dropdown lists .. since it gets tedious to just copy and paste I wrote myself a DropDownList class which takes a name and default:
Here some small code - snippets where some form of data gets passed to a page / element. This could of course be changed to get more data or not a dict/axiom db but I prefer it this way (Pretty much every axiom/nevow app will need something like this afaik):# -*- coding: utf8 -*-
from nevow.rend import Page
from nevow.page import Element, renderer
from nevow import loaders
from nevow import tags as T
class PageWithDB(Page):
"""
Own Page class to save myself passing the db object to every sub-page
"""
def __init__(self, db, original = None, docFactory = None):
self.db = None
if not db:
raise ValueError("No Database given")
self.db = db
Page.__init__(self, original, docFactory)
class ElementWithData(Element):
"""
Element with Data
"""
def __init__(self, data, docFactory = None):
self.data = None
if data == None:
raise ValueError("No Data")
self.data = data
Element.__init__(self, docFactory)
class ContainerPage(PageWithDB):
"""
Container Page which just has title and content renderer and
loads only skeleton page. To be used with Elements
The render_title and render_content methods should be overridden
"""
addSlash = True
docFactory = loaders.xmlfile(u'templates/pageskel.xml')
def render_title(self, ctx, data):
return u'TITLE RENDER'
def render_content(self, ctx, data):
return u'CONTENT'
Busy day again..
After having to go to a clients site yesterday it was quite busy again.
In my lunch break I went to the library (had some books due back tomorrow which i couldn't renew anymore ;'( ) and fixed some drupal modules for postgresql. list below:
birthdays module had no pgsql code at all so big patch for this to make everything work: http://drupal.org/node/137907
Releasemonitor pgsql SQL install (create table) code had a bug. fixed that too: http://drupal.org/node/137885
BUEditor had some insert problems on pgsql 8.1 (no multiple inserts - apparently the latest and greatest pgsql has that but not many ppl use it yet afaik ...). fixed that ;) : http://drupal.org/node/137006
and of course loads of work anyway ;)
will probably not write anything for the next 2 days because of the taikai.