Scrolling Plone and Prohibited Zope IDs

Although you can generate code contents with an identifier starting with an underscore , such as " _foo", it seems that you cannot go through an element with this special identifier. Each attempt to access content with a name using a browser results in a NotFound error. Methods such as __bobotraverse__or __getitem__, for example, are not called if this restriction is checked very early.

How does this restriction work and how can I change it? Can I access subobjects with the underscore prefix in id?

+4
source share
1 answer

unrestrictedTraverse OFS.Traversable:

if name[0] == '_':
    # Never allowed in a URL.
    raise NotFound, name

... . , , @Mathias ZPublisher.BaseRequest.DefaultPublishTraverse publishTraverse.

if name[:1]=='_':
    raise Forbidden("Object name begins with an underscore at: %s" % URL)

- :

  • unrestrictedTraverse Plone ( )
  • publishTraverse (, ?)

- monkeypatch.

+6

Source: https://habr.com/ru/post/1628335/


All Articles