Jan Eden wrote:
> Jan Eden wrote on 22.11.2005:
>>Kent Johnson wrote on 20.11.2005:
>>
>>>Use getattr() to access attributes by name. SiteA is an attribute
>>>of Templates and Page is an attribute of SiteA so you can get use
>>>getattr() twice to get what you want:
>>>
>>>site = getattr(Templates,
Hi,
Jan Eden wrote on 22.11.2005:
>Hi,
>
>Kent Johnson wrote on 20.11.2005:
>>
>>Use getattr() to access attributes by name. SiteA is an attribute
>>of Templates and Page is an attribute of SiteA so you can get use
>>getattr() twice to get what you want:
>>
>>site = getattr(Templates, self.site_n
Hi,
Kent Johnson wrote on 20.11.2005:
>
>Use getattr() to access attributes by name. SiteA is an attribute of
>Templates and Page is an attribute of SiteA so you can get use
>getattr() twice to get what you want:
>
>site = getattr(Templates, self.site_name) self.template =
>getattr(site, self.temp
> import Templates
>
> self.site_name = 'SiteA'
> self.template_type = 'Page'
>
> self.template = ???
How about a dictionary holding references to the classes against their
names?
The dictionary could be a class attribute of the top level superclass or a
module
level dictionary. It should be upd
Kent Johnson wrote on 20.11.2005:
>Use getattr() to access attributes by name. SiteA is an attribute of Templates
>and Page is an attribute of SiteA so you can get use getattr() twice to get
>what
>you want:
>
>site = getattr(Templates, self.site_name)
>self.template = getattr(site, self.templa
Jan Eden wrote:
> The situation is this:
>
> For every object, two string attributes are determined during
> initialization (one being read from a database, the other inherited
> as a superclass attribute). The first contains the site name, the
> second the object type. I'd like to set the templat
Kent Johnson wrote on 19.11.2005:
>Danny Yoo wrote:
>>Here's a small example that shows how classes can be treated just
>>like any other value in Python:
>>
>> #
>> def makeYa(superclass):
>> class Ya(superclass):
>> def sayHi(self):
>>
Danny Yoo wrote:
> Here's a small example that shows how classes can be treated just like any
> other value in Python:
>
> #
> def makeYa(superclass):
> class Ya(superclass):
> def sayHi(self):
> superclass.sayHi(self)
> p
On Sat, 2005-11-19 at 15:23 -0800, Danny Yoo wrote:
> Here's a small example that shows how classes can be treated just like any
> other value in Python:
>
> #
> def makeYa(superclass):
> class Ya(superclass):
> def sayHi(self):
> su
On Sat, 19 Nov 2005, Jan Eden wrote:
> I have a number of classes, each of which should inherit from a related
> superclass in another module:
>
> class A(Super.A):
> ...
>
> class B(Super.B):
> ...
>
> class C(Super.C):
> ...
>
> Is there a way to dynamically determine the value of
Hi Kent,
Kent Johnson wrote on 19.11.2005:
>Jan Eden wrote:
>> Is there a way to dynamically determine the value of Super at
>> runtime? Background: Depending on certain object attributes which are
>> set during the object initialization, I need to use a different set
>> of templates for the res
Jan Eden wrote:
> Hi,
>
> I have a number of classes, each of which should inherit from a
> related superclass in another module:
>
> class A(Super.A): ...
>
> class B(Super.B): ...
>
> class C(Super.C): ...
>
> Is there a way to dynamically determine the value of Super at
> runtime? Backgroun
On Sat, 2005-11-19 at 16:45 +0100, Jan Eden wrote:
>
> Is there a way to dynamically determine the value of Super at runtime?
> Background: Depending on certain object attributes which are set during the
> object initialization, I need to use a different set of templates for the
> respective ob
Hi,
I have a number of classes, each of which should inherit from a related
superclass in another module:
class A(Super.A):
...
class B(Super.B):
...
class C(Super.C):
...
Is there a way to dynamically determine the value of Super at runtime?
Background: Depending on certain obje
14 matches
Mail list logo