Readme.txt
INSTALL
Unpack the tar-file in our Products directory.
HOWTO USE
Your Product file:
...
from Products.DCDSQL.DCDSQLMethod import DCDSQLMethod
from Products.DCDSQL.DCDSQLConnection import DCDSQLConnection
connection=DCDSQLConnection()
connection.edit("<database connection string>")
...
class YourProduct(<base classes>):
class MyBrain:
"""\
MyBrain is a class that gets returned by a
SQL Method. You can add stuff to it like methods
and attributes.
"""
def dollar_volume_backordered(self):
return self.name * self.id
mysql_method=DCDSQLMethod('mysql_method', connection,
'''\
id:int
''', '''\
select * from mytable where id=<dtml-sqlvar name="id" type="int">;
''', MyBrain)
def manage_test_method(self, id=1, REQUEST=None):
"""\
Calling the 'mysql_method' method.
It returns a list of MyBrains.
"""
out=""
result=self.mysql_method(id=id)
for r in result:
out=out+"%d: %s<br>" %(r.id, r.dollar_volume_backordered())
return out
...
Globals.InitializeClass(YourProduct)
def initialize(context, globals):
"""Initialize EasyEditable Product"""