The dal is dumb. It is sees a list, it converts it as if it where a
list:string because it has no other option. The type does affect how
the data looks like when you you retrieve it. For a list:string you
get back the list, else you get the a string.

On Apr 27, 10:01 pm, mart <msenecal...@gmail.com> wrote:
> hum, i think you're right...
>
> here is how I update:
>
> result=compExec.procCmd(cmdline,logfile=None,updateString=None)
>
> self.db(self.db.scriptCompiler.id==self.id).update(log=result)
> so, with subprocess, proc.communicate() returns a list ['','']. index
> 0 is stdout and index 1 is stderr. So i guess the stderr is outputting
> a list...
>
> So, this means, that if I happen to try to update a text field (no
> 'string:list') dal will automatically accept a list, without having to
> set the type? So, if we really want to store text, i could simply
> quote it?
>
> Thanks,
> Mart :)
>
> On Apr 27, 8:23 am, Massimo Di Pierro <massimo.dipie...@gmail.com>
> wrote:
>
>
>
>
>
>
>
> > My guess is that you are passing a list instead of a string of text.
> > In order to put a list into a text field, web2py joins the elements
> > using a '|'.
>
> > In your code I do not see where you do insert.
>
> > On Apr 27, 12:36 am, mart <msenecal...@gmail.com> wrote:
>
> > > woops! almost forgot, in the sqlite db, the log field will have
> > > something like this:
>
> > > |'', 'java.lang.NoClassDefFoundError: org/antlr/Tool\r|Caused by:
> > > java.lang.ClassNotFoundException: org.antlr.Tool\r|\tat
> > > java.net.URLClassLoader$1.run(Unknown Source)\r|\tat
> > > java.security.AccessController.doPrivileged(Native Method)\r|\tat
> > > java.net.URLClassLoader.findClass(Unknown Source)\r|\tat
> > > java.lang.ClassLoader.loadClass(Unknown Source)\r|\tat
> > > sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)\r|\tat
> > > java.lang.ClassLoader.loadClass(Unknown Source)\r|Could not find the
> > > main class: org.antlr.Tool.  Program will exit.\r|Exception in thread
> > > "main" '|
>
> > > On Apr 27, 1:33 am, mart <msenecal...@gmail.com> wrote:
>
> > > > Hi,
>
> > > > so, this part is done using DAL (scripted).
>
> > > > I use subprocess like below to run external scripts and stuff. when
> > > > failures, I want to dump the log in the DB.
>
> > > > proc = subprocess.Popen(strCmd,shell=True,
> > > >                         stdin=subprocess.PIPE,
> > > >                         stdout=subprocess.PIPE,
> > > >                         stderr=subprocess.PIPE)
>
> > > >             if updStr is None:
> > > >                 out = proc.communicate()
> > > >                 ... bla bla
> > > >                 if len(out[1])>0:
>
> > > > so the resulting 'out[1] gets stored in the DB.
>
> > > > here's an example of one of the tables:
>
> > > >         db.define_table('scriptCompiler',
> > > >                 Field('uuid',length=64,default=uuid.uuid4()),
> > > >                 Field('cmdName'),
> > > >                 Field('scriptCompiler_directory'),
> > > >                 Field('log','text'))
> > > >         db.commit()
>
> > > > I use 'text' to provide for larger logs.
>
> > > > thanks for your help! :)
>
> > > > Mart
>
> > > > On Apr 27, 12:03 am, Massimo Di Pierro <massimo.dipie...@gmail.com>
> > > > wrote:
>
> > > > > No. Can you provide an example of code that make that happen?
>
> > > > > On Apr 26, 7:17 pm, mart <msenecal...@gmail.com> wrote:
>
> > > > > > Hi,
>
> > > > > > is it expected for a text field to split the text on line breaks and
> > > > > > insert the '|' character? If yes, is there a way to change that
> > > > > > behavior?
>
> > > > > > Thanks,
> > > > > > Mart :)

Reply via email to