[Erp5-dev] broken Account_getGap* scripts

Jérôme Perrin jerome at nexedi.com
Tue Jan 10 18:37:29 CET 2006


Le Mardi 10 Janvier 2006 17:43, Bartek Gorny a écrit :
> On 1/9/06, Jérôme Perrin <jerome at nexedi.com> wrote:
> > Le Lundi 9 Janvier 2006 17:55, Bartek Gorny a écrit:
> > > Hello
> > >
> > > Scripts Account_getGapItemList and Account_getGapId are broken because
> > > of a change in behaviour of portal_preferences.
> > >
> > > The portal_preferences apparently used to acquire default properties
> > > from default_site_preference (function
> > > getPreferredAccountingTransactionGap returned value of
> > > default_site_preference/preferred_accounting_transaction_gap). Now it
> > > does not, and you have to explicitly call
> > > portal_preferences.default_site_preference.getSomething, the result
> > > being that scripts Account_getGapItemList and Account_getGapId return
> > > nothing.
> >
> > Hello,
> >
> > portal_preference didn't change his behaviour, the only change that have
> > been done is that now it uses the catalog to search preferences
> > (searchFolder) instead of using contentValues.
> > Please make sure that your portal_preference is correctly indexed in the
> > catalog.
>
> Seems to be - it is in the catalog. Anyway, it is not the question of
> returning None or a wrong value - the getters are just not there, when
> I try to call, for example:
> portal_preferences.getPreferredAccountingTransactionFromDate()
> I get an attribute error, while
> portal_preferences.default_site_preference.getPreferredAccountingTransactio
>nFromDate() works as expected.
>
> In my laptop installation everything is fine, the problem is on the
> LiveCD station where everything is from CVS.

PreferenceTool overrides _aq_dynamic (which behaviour is similar to 
__getattr__ ), so that accessors like 
getPreferredAccountingTransactionFromDate not found on the PreferenceTool are 
called dynamically on the "best" preference for the user.
Then the 'best' is the first preference (active) in the list returned by 
_getSortedPreferenceList wich returns the list of preferences that are 
visible to the user according to catalog results (because we use 
searchFolder). 
My advise is to reindex the whole portal_preference and make sure the 
default_preference is 'active' in preference workflow.

-- 
Jérome



More information about the Erp5-dev mailing list