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.  

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'}

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.  

-- 
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