Re: Python: "dynamische" Klassenvariablen?

"Jens W. Klein" <[email protected]>
Newsgroups gmane.comp.web.zope.german
Organization Klein & Partner KEG, BlueDynamics Alliance
Message-ID <1265214800.4663.10.camel@minime>
Am Mittwoch, den 03.02.2010, 17:28 +0100 schrieb Andreas Jung:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Jens W. Klein wrote:
> > Am Mittwoch, den 03.02.2010, 16:50 +0100 schrieb Peter
> > Zechmeister:
> >> Hallo,
> >>
> >> ich schreibe gerade an einem Produkt für Zope. Es hat einige
> >> ZPTs, die ich im Products/zpt-Verzeichnis haben möchte und beim
> >> Erstellen einer Instanz _nicht_ in der ZODB haben will. Ich
> >> denke, das würde in etwa so gehen:
> >>
> >> class TestClass(Implicit, Persistent, RoleManager, Item): [...]
> >> zptA=PageTemplateFile('zpt/zptA.htm', globals())
> >> zptB=PageTemplateFile('zpt/zptB.htm', globals())
> >> zptC=PageTemplateFile('zpt/zptC.htm', globals()) [...]
> >
> > So ganz grob:
> >
> > import os
> >
> > class Test (...): zpt = {}
> >
> > # im Module danach dir = os.path.join(os.path.dirname(__file__),
> > 'zpt') for filename in os.listdir(dir): name =
> > mach_sinnvoll_aus_file_namen_einen_key(file) filepath =
> > os.path.join(dir, filename) TestClass.zpt[name] =
> > PageTemplateFile(filepath)
> >
> > idee sollte klar sein, oder?
> 
> Fehlt da nicht noch einiges an Security Declarations?

von security hat keiner was gesagt ;-) aber auch das läßt sich irgendwie
alles regeln.

lg Jens



_______________________________________________
zope mailing list
[email protected]
https://mail.dzug.org/mailman/listinfo/zope
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.