Re: Python: "dynamische" Klassenvariablen?
Andreas Jung <[email protected]>
| Newsgroups | gmane.comp.web.zope.german |
|---|---|
| Organization | ZOPYX Ltd & Co. KG |
| Message-ID | <[email protected]> |
-----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?
Andreas
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAktppEoACgkQCJIWIbr9KYzPvwCdENl/V5amep1ldUgDh6RxpxfR
VMoAn0jh23oD3NgMregtS/R6Y/GpuWpg
=vniy
-----END PGP SIGNATURE-----
_______________________________________________
zope mailing list
[email protected]
https://mail.dzug.org/mailman/listinfo/zope
lists.vcf
(text/x-vcard, 331 B)
begin:vcard fn:Andreas Jung n:Jung;Andreas org:ZOPYX Ltd. & Co. KG adr;quoted-printable:;;Charlottenstr. 37/1;T=C3=BCbingen;;72070;Germany email;internet:[email protected] title:CEO tel;work:+49-7071-793376 tel;fax:+49-7071-7936840 tel;home:+49-7071-793257 x-mozilla-html:FALSE url:www.zopyx.com version:2.1 end:vcard