well, i think so but, even if a field is set to 'string', and a script
receives something comma delimited, DAL will will want to treat it as
a list.

so doing x.type takes me half the way, then i need to check if a list
wasn't inserted into the record instead (most of the time i get a
string, but sometime I get a list)

Mart :)



On Jul 6, 2:20 pm, Anthony <[email protected]> wrote:
> Doesn't db.myTable.myField.type work? Or am I missing something?
>
> Anthony
>
>
>
>
>
>
>
> On Wednesday, July 6, 2011 12:59:54 PM UTC-4, mart wrote:
> > almost :) i'm looking to guess the field types. for example, at the
> > cmd line i can use a quick and dirty helper like this:
>
> > -table myTable fields=id,name,value
>
> > this displays a nice ascii table but, the fields are comma delimited
> > so if the returned field is a list (also comma delimited), the table
> > isn't very pretty anymore (because it separates the field items with
> > commas :))
>
> > so if I can get the script to guess the field type, i can replace the
> > comma with a line break (which would just extend the table field in
> > height)
>
> > thanks,
> > Mart :)
>
> > On Jul 6, 12:48 pm, Anthony <[email protected]> wrote:
> > > db.tables is a list of the names of the tables in db, and
> > > db.tablename.fields is a list of the names of the fields in db.tablename.
> > Is
> > > that what you're looking for?
>
> > > Anthony
>
> > > On Wednesday, July 6, 2011 12:27:09 PM UTC-4, mart wrote:
> > > > hi,
>
> > > > question:
>
> > > > how could I guess the field in something like an interactive shell?
>
> > > > i assume, I have to specify db.tableName.filedName?
>
> > > > is there something like db.myTable.myField.type?
>
> > > > thanks,
> > > > Mart :)
>
> > > > On Jul 4, 12:11 pm, mart <[email protected]> wrote:
> > > > > ah ha! thank you very much!!!!! :)
>
> > > > > On Jul 4, 11:46 am, Massimo Di Pierro <[email protected]>
> > > > > wrote:
>
> > > > > > f = Field('myString')
>
> > > > > > print f.type
> > > > > > if isinstance(f.type,str) and f.type=='string': ..
> > > > > > if isinstance(f.type,str) and f.type=='text': ..
> > > > > > if isinstance(f.type,str) and f.type=='upload': ..
> > > > > > if isinstance(f.type,str) and f.type=='blob': ..
> > > > > > ..
> > > > > > if not isinstance(f.type,str): # custom field probably
>
> > > > > > On Jul 4, 10:17 am, mart <[email protected]> wrote:
>
> > > > > > > woops, sorry....
>
> > > > > > > so something like:
>
> > > > > > > if isinstance(Field,list): blala
> > > > > > > elif isinstance(Field,str): blala
> > > > > > > else:blabla
>
> > > > > > > thanks,
> > > > > > > Mart :)
>
> > > > > > > On Jul 4, 11:15 am, mart <[email protected]> wrote:
>
> > > > > > > > Can dal guess field type even if not explicit?
>
> > > > > > > > I.e. if I have a Field like Field('myString') but a script ends
> > up
> > > > > > > > inserting something that looks like a list, how can I have a
> > > > default
> > > > > > > > check?
>
> > > > > > > > something like:

Reply via email to