Hi,
Can anyone help with the following. I need to have some back end, out
of sight, server stuff happening. But, need to share the SQLite DB
with web2py. So, i copied the gluon environment (the folder) where I
can reference it to handle the data stuff at the back end - oiut of
the web2py normal environment (doing this because, this must not be
run anywhere near a web front end)... everything seems to be happening
fine, except that it doesn't work ;) and I think it should work... I
have no problems referencing what I need from gluon, i can create
tables, I get good logging from sql.log, etc... but the tables are
empty, and no exception is being thrown.... (relevant code is below -
unless you need more)
Any help, would be appreciated. I am promoting the use of web2py to a
bunch of snarly upper management types, who were hard to convince.
This is for a home grown, in house build system, where i am trying to
implement lots of new ideas & strategies. I would like to have web2py
hold everything together. If this could be implemented, I will then
push the idea company wide (~ 7000 employees). This would offer good
exposure to web2py as lots of people will be looking at this with the
hope of replacing existing build infrastructure. So, here is a snippet
of my grief (in line comments are related to the question).
Thanks in advance,
Mart :)
I have this;
MODEL:
db.define_table("cumulativeProperties",
SQLField("name"), # just the key/value pairs of
SQLField("value" )) # a properties object
db.define_table("objBuildAll",
SQLField("cumulativeProperties", "upload"), # the
properties object
SQLField("etree_builtIn", "upload"), # an xml etree object
SQLField("etree_builder", "upload"), # an xml etree
object
SQLField("x2_builtIn", "upload"), # a dict with object
function
#__init__, __getattr__,__setattr__,__str__
SQLField("x2_builder", "upload")) # another dict with object
function
AND THIS, WHICH SHOULD EXECUTE:
pObj = bluePickles.pickles() # reference to object Pickler
# I have quite a few of the following
pObj.pickledToFile('{0}/
x2_builtIn'.format(self.etherRoot),self.x2_builtIn) #pickle to file
(they are fine and get created
# this is web2py stuff, taken from the book. I want to insert objects
as blobs (not images).
stream = open('{0}/x2_builtIn'.format(self.etherRoot),'rb')
db.objBuildAll.insert(x2_builtIn=db.objBuildAll.x2_builtIn.store(stream,'{0}/
x2_builtIn'.format(self.etherRoot)))
# store the key/value pairs as strings, separate from the stored
properties object
keys = self.cumulativeProperties.getPropKeys()
for key in keys:
db.cumulativeProperties.insert(name=key,value=self.cumulativeProperties.getPropertyValue(key))
db.commit()
del pObj
THEN, I WANT TO SEE IF THERE IS SOMETHING, SO I DO:
class setCmd(baseCmd):
def cmd(self):
rows = db().select(db.objBuildAll.ALL)
for row in rows:
print row
AND I GET THESE ERRORS (I am not trying to delete any records, so
don't know why I get the 'delete_record')
<Row {'update_record': <function <lambda> at 0x10163cb90>,
'etree_cmdInit': None, 'id': 1, 'delete_record': <function <lambda> at
0x10163cc08>, 'x2_cmdInit': 'objCmdInit.x2_cmdInit.90b447efe2beeb4e.
78325f62616e6e6572.txt'}>
<Row {'update_record': <function <lambda> at 0x10163cc80>,
'etree_cmdInit':
'objCmdInit.etree_cmdInit.aa0fe61a0eb59c46.78325f62616e6e6572.txt',
'id': 2, 'delete_record': <function <lambda> at 0x101666848>,
'x2_cmdInit': None}>
<Row {'update_record': <function <lambda> at 0x1016668c0>,
'etree_cmdInit': None, 'id': 3, 'delete_record': <function <lambda> at
0x101666938>, 'x2_cmdInit': 'objCmdInit.x2_cmdInit.9326c3985102299d.
78325f696e69744275696c64.txt'}>
<Row {'update_record': <function <lambda> at 0x1016669b0>,
'etree_cmdInit': 'objCmdInit.etree_cmdInit.
98a5ce6fb36e2ac1.78325f696e69744275696c64.txt', 'id': 4,
'delete_record': <function <lambda> at 0x101666a28>, 'x2_cmdInit':
None}>