[Tutor] Dynamic inheritance?

Jan Eden lists at janeden.org
Sun Nov 20 15:59:28 CET 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, self.site_name)
>self.template = getattr(site, self.template_type)
>

Thank you! I did not take into account that modules and classes can be treated just like data attributes.

- Jan
-- 
Remember: use logout to logout.


More information about the Tutor mailing list