Re: Zugriff von einem Utility auf die Datenbank
"Maik Derstappen, Derstappen IT" <[email protected]>
| Newsgroups | gmane.comp.web.zope.german |
|---|---|
| Organization | Derstappen IT Consulting |
| Message-ID | <[email protected]> |
Am 15.07.2011 13:40, schrieb Vladislav Vorobiev: > Hallo Maik, > > du meinst den getSite von > from zope.app.component.hooks? > > getSite scheint irgend ein info Objekt zusein. > > (Pdb) dir(getSite()) > ['__class__', '__delattr__', '__doc__', '__format__', > '__getattribute__', '__hash__', '__init__', '__new__', '__reduce__', > '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', > '__subclasshook__'] > (Pdb) getSite() > (Pdb) print getSite() > None > > Es erlaubt mir kein Zugrif auf den Rootbaum. > ja es kommt darauf an womit du unterwegs bist, in zope2 bekommst du mit getSite wie folgt: http://inqbus-hosting.de/support/dokumentation/docs/plone-portal-root-object-ermitteln Gruß Maik > Grüß > Vlad > > Am 15. Juli 2011 12:49 schrieb Maik Derstappen, Derstappen IT > <[email protected]>: >> Am 15.07.2011 11:25, schrieb Vladislav Vorobiev: >>> Hallo, >>> >>> wie kann ich von einem Utility auf die Datenbank zugreifen? >>> >>> class IGreeter(Interface): >>> >>> def greet(name): >>> """Say hello""" >>> >>> class Greeter(MyZopeObject): >>> implements(IGreeter) >>> def greet(self,ss): >>> return self.objectIds(): >>> >>> >>> gsm = getGlobalSiteManager() >>> greet = Greeter() >>> gsm.registerUtility(greet, IGreeter) >>> >>> class SiteSchema(): >>> countries_ = values=getUtility(IGreeter)) >>> >>> Eventuell ist es auch der Falsche Ansatz um einem Attribut dynamisch >>> werte aus der Datenbank zuzuweisen. >>> Kann mir jemand ein Tip geben wie es geht? >> auf welche Datenbank willst du Zugreifen, ZODB oder MySQL& co? >> Bei der ZODB nimmst du dir am besten das Site-Objekt mit getSite() und >> traversierst dich durch den Baum. >> >> Gruß Maik >> >> -- >> ======================================================================== >> >> Derstappen I T Consulting Tel: +49 ( 341 ) 600 13 0 31 >> Zope/E-Mail/Backup/Monitoring Mobil: +49 ( 178 ) 861 2 833 >> M a i k D e r s t a p p e n Fax: +49 ( 180 ) 5 021 121 90 56 >> H e r l o ß s o h n s t r 12 Email: [email protected] >> 0 4 1 5 5 L e i p z i g Internet: http://www.derstappen-it.de >> >> ======================================================================== >> >> >> >> _______________________________________________ >> zope mailing list >> [email protected] >> https://mail.dzug.org/mailman/listinfo/zope >> > > -- ======================================================================== Derstappen I T Consulting Tel: +49 ( 341 ) 600 13 0 31 Zope/E-Mail/Backup/Monitoring Mobil: +49 ( 178 ) 861 2 833 M a i k D e r s t a p p e n Fax: +49 ( 180 ) 5 021 121 90 56 H e r l o ß s o h n s t r 12 Email: [email protected] 0 4 1 5 5 L e i p z i g Internet: http://www.derstappen-it.de ======================================================================== _______________________________________________ zope mailing list [email protected] https://mail.dzug.org/mailman/listinfo/zope