nuxeo-localizer
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Nuxeo-localizer] Re: Using Localizer in Python based Products for C


From: Juan David Ibáñez Palomar
Subject: Re: [Nuxeo-localizer] Re: Using Localizer in Python based Products for CMF
Date: Thu, 18 Jul 2002 10:57:01 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0) Gecko/20020610 Debian/1.0.0-1

Rainer Thaden wrote:

Hi,

No, 'manage_addLanguage' expects a single language id as parameter,
an string, don't pass it a tuple. Instead:

 for language in languages:
     self.manage_addLanguage(language)

O.K., tried that.
Problem:
Attribute Error. No Attribute manage_addLanguage.
So I fumbled around, tried to call the method directly from
LanguageManager via

from Products.Localizer import LocalProperty, LocalPropertyManager, 
LanguageManager
...
LanguageManager.manage_addLanguage(self,'de')

-> Attribute Error. 'Products.Localizer.LanguageManager' module has no
attribute 'manage_addLanguage'


Which Localizer version are you using? Just to be sure I look the
right source, because it should work.


Meanwhile i notice some strange behaviour like nervous laughs and
chewing on my fingernails ...

What does inheritedAttribute do? As i understood (after long time
of searching) the inheritedAttribute statement has to be used if an
attribute is inherited from classes programmed in C
(ExtensionClasses?). You use inheritedAttribute for some things in
LocalContent, but the base classes are just normal Python classes.


Yes, and LocalContent objects inherit from ExtensionClass.Base
and from Acquisition.Implicit, not sure which one is the responsible.

When you access a LocalContent object, within Zope, you access to an
acquisition wrapper around the real LocalContent instance, so you need
to use inheritedAttribute. This happens only when you specialize a method
of a parent class and want to call the method you're specializing.

Well, I'm not sure which is the cause, wether extension classes or
acquisition. Anyway, it's needed.


An alternative is to use "im_func", in LocalContent._delLocalProperty,
currently there's:

 LocalContent.inheritedAttribute('_delLocalProperty')(self, id)

you could use this instead:

 LocalPropertyManager._delLocalProperty.im_func(self, id)


I tried to access _languages directly in my class, but both with
inheritedAttribute and directly i get an attribute error.


First tell me which Localizer version are you using, and if you like,
send me your whole file, maybe this is the quickest.


--
J. David Ibáñez, http://www.j-david.net
Software Engineer / Ingénieur Logiciel / Ingeniero de Software





reply via email to

[Prev in Thread] Current Thread [Next in Thread]