Re: Zugriff von einem Utility auf die Datenbank

Vladislav Vorobiev <[email protected]>
Newsgroups gmane.comp.web.zope.german
Message-ID <CADmZVq8t0sQY8eADQzDQbopfPJ0SLXivCAFG5BLxjYzGuNeJ+g@mail.gmail.com>
Am 17. Juli 2011 16:32 schrieb Maik Derstappen, Derstappen IT
<[email protected]>:
> Am 16.07.2011 19:34, schrieb Vladislav Vorobiev:
>>
>> Am 15. Juli 2011 16:36 schrieb Maik Derstappen, Derstappen IT
>> <[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
>>
>> Hallo,
>>
>> ja es ist Zope2.
>>
>> (Pdb) from zope.site.hooks import getSite
>> (Pdb) getSite()
>> (Pdb) dir(getSite())
>> ['__class__', '__delattr__', '__doc__', '__format__',
>> '__getattribute__', '__hash__', '__init__', '__new__', '__reduce__',
>> '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__',
>> '__subclasshook__']
>>
>> (Pdb) from zope.app.component.hooks import getSite
>> (Pdb) getSite()
>> (Pdb) dir(getSite())
>> ['__class__', '__delattr__', '__doc__', '__format__',
>> '__getattribute__', '__hash__', '__init__', '__new__', '__reduce__',
>> '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__',
>> '__subclasshook__']
>> (Pdb)
>>
>> Weder das eine noch das andere erlaubt mir Zugriff auf  die Objekte.
>> Wie wendet ihr das an? Könntest du oder jemand ein Beispiel posten?
>>
>
> wie du in der Beschreibung (siehe link) sehen kannst, bekommst du beim
> Aufruf von getSite() das Portal-Root Objekt zurück, also deine Site.

Genau das bekomme ich nicht, siehe meine Debug Info. Letztendlich ist
es ja mein Ziel :)

>  Von da
> aus kannst du z.B. per portal.restrictedTraverse("folder1/objekt1") deine
> Objekte auflösen. Oder aber direkt über portal.folder1.objekt1. Falls
> Sonderzeichen in den id's sind, funktioniert analog
> portal["test-folder"]["test-objekt"].

dir(getSite()) listet die ja nicht auf. Da getSite() in diesem Fall ja
anscheinend kein siteRoot ist.

Gruß
Vlad


-- 
Best Regards
Vlad Vorobiev


_______________________________________________
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.