On Monday 14 January 2008 11:22:55 am Adrian Klaver wrote:
>  -------------- Original message ----------------------
> From: johnf <[EMAIL PROTECTED]>
>
> > On Monday 14 January 2008 10:14:57 am Adrian Klaver wrote:
> > > Found where the defaults are entered, the method below in dBizobj.py.
> > >
> > > def _onNew(self):
> > >     """ Populate the record with any default values.
> > >
> > >     User subclasses should leave this alone and instead override
> > > onNew(). """
> > >     cursor = self._CurrentCursor
> > >     currKey = self.__currentCursorKey
> > >     if self.AutoPopulatePK:
> > >       # Provide a temporary PK so that any linked children can be
> > > properly # identified until the record is saved and a permanent PK is
> > > obtained. tmpKey = cursor.genTempAutoPK()
> > >       if currKey is None:
> > >         self.__currentCursorKey = tmpKey
> > >         del self.__cursors[currKey]
> > >         self.__cursors[tmpKey] = cursor
> > >     # Fill in the link to the parent record
> > >     if self.Parent and self.FillLinkFromParent and self.LinkField:
> > >       self.setParentFK()
> > >     cursor.setDefaults(self.DefaultValues)
> > >     cursor.setNewFlag()
> > >
> > > Hope this helps,
> > > --
> > > Adrian Klaver
> > > [EMAIL PROTECTED]
> >
> > No it does not.  On my system Postgres 8.1.x and SUSE 10.3
> > using psycopg2  I can't reproduce the results you are getting.  Here is
> > what I'm doing:
> >
> > On the Postgres side I add a default value for
> > mytest character varying(3) DEFAULT 'ABC'::character varying
> >
> > If I do an insert the value is set.
> > I get a new PK (serial)
> > and I get 'ABC' in mytest.
> >
> > However, when I do the following I don't reproduce your results.
> >
> > Open a form with a bizobj that contains the field 'mytest' as in above;
> > open dShell
> > self.new()
> > mybiz=self.getBizobj()
> > mybiz.getFieldVal('mytest')
> > u''
> >
> > I get a blank field.  In fact I have not been able to reproduce anything
> > like what you are getting.
>
> At this point I have no fresh ideas. When I get some time I will try to
> step through my code and procedures to see if I can explain what I am
> seeing.
>
> > Are you sure you did not provide some default values somewhere in Dabo? 
> > The section of code y0ou make reference too works with the bizObj's
> > setDefaultValues as in
> > self.DefaultValues={"lactive":True,"lvendor":False,"cinvlang":'English'}
>
> Yea, I see that now. I scanned through the code too quickly.
> The bigger issue for the moment is not so much where the values are coming
> from, but the fact they are in the control and are not being included in
> the INSERT statement.
>
> > Also I'm concerned that you were not able to insert after turning off the
> > constriant.  If the insert will not work without a constriant then it
> > won't work with a constriant.
>
> It just ran a foul of another constraint, the NOT NULL clause on the
> columns.
>
> > --
> > John Fabiani
>
> Thanks,
> --
> Adrian Klaver
> [EMAIL PROTECTED]

OK let's start over. Turn off all constraints -including the "NOT NULL"'s. 
>From the dShell try
self.new()
self.save()

If that works then at least the PK is working.  Keep turning stuff on until 
you get an error you don't understand.  Tell me the error message you are 
getting.




-- 
John Fabiani


_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/dabo-users/[EMAIL PROTECTED]

Reply via email to