Re: [Zope-dev] Soft links again
> > On Fri, 29 Sep 2000, Ibañez Palomar Juan David wrote: > > > It would be great if the symbolic link could have a different id than > > the object referenced. But with the __of__ based solution "link.id" is > > always "referenced_object.id". > > > > How this could be done? > > I think you'd need a special kind of wrapper. It would have the > ability to act as if it were the object itself while transparently > overriding specific attributes. I've pondered creating such > a wrapper before, but it crashed so much that I eventually moved on to > easier stuff. :-) > > I think the ability is all there in ExtensionClass, but the details are > quite difficult. > > Shane > If I've understanded it right it means I must go to C risking my mental sanity (1), other possibility would be to redesign/reimplement my app (2). Ummhh... I think I'll try 1, it seems more entertaining :), so wish me luck. thanks, david ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Soft links again
On Fri, 29 Sep 2000, Ibañez Palomar Juan David wrote: > It would be great if the symbolic link could have a different id than > the object referenced. But with the __of__ based solution "link.id" is > always "referenced_object.id". > > How this could be done? I think you'd need a special kind of wrapper. It would have the ability to act as if it were the object itself while transparently overriding specific attributes. I've pondered creating such a wrapper before, but it crashed so much that I eventually moved on to easier stuff. :-) I think the ability is all there in ExtensionClass, but the details are quite difficult. Shane ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Soft links again
Hi Shane, and thanks for Symlink, it's a big step towards solve the problem, but remains an issue... It would be great if the symbolic link could have a different id than the object referenced. But with the __of__ based solution "link.id" is always "referenced_object.id". How this could be done? > > Okay, I've posted a proof of concept. Please keep in mind that this > could be dangerous in terms of security, although I've done a couple of > things to make it safer. Also, there's currently a buglet in > acquisition that makes it so that you can only perform the actions on > the symlink which "anonymous" is allowed to do. > > http://www.zope.org/Members/hathawsh/Symlink/index_html > > Shane > ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Soft links again
Toby Dickenson wrote: > > On Wed, 27 Sep 2000 09:06:18 -0400, Shane Hathaway > <[EMAIL PROTECTED]> wrote: > > > Also, there's currently a buglet in > >acquisition that makes it so that you can only perform the actions on > >the symlink which "anonymous" is allowed to do. > > Woooh! Someone else that agrees this is a bug in Acquisition. > > Full report and patch at > http://classic.zope.org:8080/Collector/1066/view Not only are you 100% correct, but we were planning to do the same thing! You were several steps ahead of us. The patch works perfectly, although I added a couple of comments. Sorry the patch didn't get applied sooner. Shane ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Soft links again
On Wed, 27 Sep 2000 09:06:18 -0400, Shane Hathaway <[EMAIL PROTECTED]> wrote: > Also, there's currently a buglet in >acquisition that makes it so that you can only perform the actions on >the symlink which "anonymous" is allowed to do. Woooh! Someone else that agrees this is a bug in Acquisition. Full report and patch at http://classic.zope.org:8080/Collector/1066/view Toby Dickenson [EMAIL PROTECTED] ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Soft links again
Okay, I've posted a proof of concept. Please keep in mind that this could be dangerous in terms of security, although I've done a couple of things to make it safer. Also, there's currently a buglet in acquisition that makes it so that you can only perform the actions on the symlink which "anonymous" is allowed to do. http://www.zope.org/Members/hathawsh/Symlink/index_html Shane Andre Schubert wrote: > > Hi, > > i have read the two messages about Soft Link, and i tried to work with it, > because it it very important for my Product. > The problem is that the Soft Link class won't work and i don't know why. > I use zope 2.2.2 and python 1.5.2. > root: > -myproductfolder > -SoftLink to testdtmldoc > -testfolder > -testdtmldoc > > In myproduct i have the following function, the class SoftLink is the same > as of Shane Hathaway. > I wan't to add a SoftLink in myproductfolder which links to testdtmldoc. > When i call the function manage_addSoftLink nothing happens?? > > def manage_addSoftLink(self, REQUEST=None): > . > obj=SoftLink('Test/link') > self._setObject('TestSoftLink',obj) > > Whats going wrong, or did i missunderstand something? > Who can help? > > as > > Shane Hathaway schrieb: > > > [cut] > > Try this. I failed to account for the fact that sometimes the object is > > not in context and therefore the linked object will not be found. > > > >def __of__(self, parent): > > try: > > ob = self.restrictedTraverse(self.path) > > except: > > # We're not in context or the object was not found. Default to > > self. > > return self > > else: > > return getattr(ob, 'aq_base', ob).__of__(parent) > > > > Keep in mind, though, that there are all kinds of security > > implications. Someone will have to think hard about security before > > this is viable. > > > > OTOH perhaps it's really simple. Try this as the last line instead: > > > > return getattr(ob, 'aq_inner', ob).__of__(parent) > > > > This way, the security context might be retained. If it doesn't work, > > try changing the last line to: > > > > return ob.__of__(parent) > > > > Shane > > > > ___ > > Zope-Dev maillist - [EMAIL PROTECTED] > > http://lists.zope.org/mailman/listinfo/zope-dev > > ** No cross posts or HTML encoding! ** > > (Related lists - > > http://lists.zope.org/mailman/listinfo/zope-announce > > http://lists.zope.org/mailman/listinfo/zope ) > > ___ > Zope-Dev maillist - [EMAIL PROTECTED] > http://lists.zope.org/mailman/listinfo/zope-dev > ** No cross posts or HTML encoding! ** > (Related lists - > http://lists.zope.org/mailman/listinfo/zope-announce > http://lists.zope.org/mailman/listinfo/zope ) ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Soft links again
Hi, i have read the two messages about Soft Link, and i tried to work with it, because it it very important for my Product. The problem is that the Soft Link class won't work and i don't know why. I use zope 2.2.2 and python 1.5.2. root: -myproductfolder -SoftLink to testdtmldoc -testfolder -testdtmldoc In myproduct i have the following function, the class SoftLink is the same as of Shane Hathaway. I wan't to add a SoftLink in myproductfolder which links to testdtmldoc. When i call the function manage_addSoftLink nothing happens?? def manage_addSoftLink(self, REQUEST=None): . obj=SoftLink('Test/link') self._setObject('TestSoftLink',obj) Whats going wrong, or did i missunderstand something? Who can help? as Shane Hathaway schrieb: > [cut] > Try this. I failed to account for the fact that sometimes the object is > not in context and therefore the linked object will not be found. > >def __of__(self, parent): > try: > ob = self.restrictedTraverse(self.path) > except: > # We're not in context or the object was not found. Default to > self. > return self > else: > return getattr(ob, 'aq_base', ob).__of__(parent) > > Keep in mind, though, that there are all kinds of security > implications. Someone will have to think hard about security before > this is viable. > > OTOH perhaps it's really simple. Try this as the last line instead: > > return getattr(ob, 'aq_inner', ob).__of__(parent) > > This way, the security context might be retained. If it doesn't work, > try changing the last line to: > > return ob.__of__(parent) > > Shane > > ___ > Zope-Dev maillist - [EMAIL PROTECTED] > http://lists.zope.org/mailman/listinfo/zope-dev > ** No cross posts or HTML encoding! ** > (Related lists - > http://lists.zope.org/mailman/listinfo/zope-announce > http://lists.zope.org/mailman/listinfo/zope ) ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Soft links again
"Ibañez Palomar Juan David" wrote: > > Hi all, > > First, I'm using Zope 2.2.1 (Debian package). > > I've been trying to implement zope objects that behave like unix soft > links. The message > > http://lists.zope.org/pipermail/zope-dev/2000-July/005963.html > > by Shane proposes an implementation based in the __of__ method: > (snip) > but it fails when I try to create an instance. Try this. I failed to account for the fact that sometimes the object is not in context and therefore the linked object will not be found. def __of__(self, parent): try: ob = self.restrictedTraverse(self.path) except: # We're not in context or the object was not found. Default to self. return self else: return getattr(ob, 'aq_base', ob).__of__(parent) Keep in mind, though, that there are all kinds of security implications. Someone will have to think hard about security before this is viable. OTOH perhaps it's really simple. Try this as the last line instead: return getattr(ob, 'aq_inner', ob).__of__(parent) This way, the security context might be retained. If it doesn't work, try changing the last line to: return ob.__of__(parent) Shane ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )