Re: [Zope-Coders] Re: [Zope-dev] Speaking of 2.6...

2002-04-10 Thread Mario Valente

At 01:30 10-04-2002 +0300, Myroslav Opyr wrote:
Ok. Let's find out what we have and what we want. First of all we have 
strict hierarchy in ZODB where each object appears only once in the 
tree. Thus to access to an object it is only one way from root down to 
an object through containers. 

The idea is to allow user to specify several points of presence (pop) 
for an object. 


  Precisely. My first hack solves this and I've been using it OK in
 production sites.

  But I didnt like the fact that an object point of presence in the
 Zope tree was identical in every instance. That leads to confusion.
  
  My second hack creates a ProxyObject class thus allowing for
 a different metatype and a different icon. This reduces confusion. And
 you can also provide a management tab with links to the original object
 point of presence.

  I tried using Python 2.1 Proxy classes but Acquisition wasnt proxiable...

  C U!

  -- MV



___
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-Coders] Re: [Zope-dev] Speaking of 2.6...

2002-04-10 Thread Mario Valente

At 10:06 10-04-2002 -0400, Brian Lloyd wrote:
What is wrong with leaving this as an add-on product? Why does 
it _need_ to be a part of the core at all? Useful products are 
useful, whether or not they come with Zope, and there are 
plenty of very useful products that don't come built in.


  I totally agree. Thats what I previously thought was the case: that
 your earlier comments were very much towards the links stuff
 being Vetted and that it should be released as a patch/product.

  C U!

  -- MV



___
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-Coders] Re: [Zope-dev] Speaking of 2.6...

2002-04-10 Thread Mario Valente

At 15:12 10-04-2002 +0100, Toby Dickenson wrote:
User X is designated as a manager of folder /Xfolder. In todays Zope
/Xfolder is a secure environment He has no authority over objects
outside that folder, thanks to aq_inContextOf

Can he create links to objects outside that folder?


  No, he cant. To create a link (my hack...)  you first need to
 obtain the object reference (moniker) with a Copy operation
 so that you can then do a Paste Ref. operation.


Links would be pretty useless if not. 


  No they wouldnt.


A common use case would be to
create a link /XFolder/banner.gif to /stock_images/banners/mono.gif
(for example).

However if that is allowed, he now has management rights over that
image object.

I dont see how 'hard links' can possibly avoid this problem.


  Right. 

  But they would be useful to put an image in /Xfolder/images/
 and then be able to paste links to it into /Xfolder/layout1/ and
 /Xfolder/layout2/ and /Xfolder/Development without the need
 to create multiples instances of the same image or without
 coding multiple requests for that object.


  C U!

  -- MV











___
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] Re: [Zope] Object Links/references and Zope 2.6

2002-03-08 Thread Mario Valente


  Hi:


  Regarding my previous proposal.

  I would like to propose my Paste Reference/symlink hack for
 inclusion into Zope 2.6


  


  And referring to my previous msg.


At 19:04 07-08-2001 +0100, Mario Valente wrote:
  As discussed previously by others (re: object references) and
 asked by myself: I had the need to be able to refer to objects
 from different points of the folder hierarchy without duplicating
 those objects.


  - edited CopySupport.py
  - copied the manage_pasteObjects method to a manage_pasteMonikers
method
  - commented the #ob=ob._getCopy(self)  line  (the duplicate object part)
  - added a Paste Ref button to the lib/python/OFS/dtml/main.dtml file that
calls the pasteMonikers method

  
  input class=form-element type=submit
name=manage_pasteMonikers:method
   value=Paste Ref. /
  

   Issues/TODO

   - find a way to distinguish references from the original (tried to change
the meta_type at paste time but no luck). At least the meta_type/icon
should
change to provide a visual cue.
   - provide tool(s) to find impact of changing a reference. Provide a link
from a
reference object to the original. Provide a link from an object to its
several
references.


   I have now solved the issues/TODO. I now have implemented a way
 to distinguish references from the original. Links have a name like
 copy_of_ but instead its shortcut_to_XXX and they also have
 a different metatype and a different icon. There's also crude management
 screens to get to the original object.

  Here's the *major* hack :-) (its such a kludge that even I am shocked :-)
  But it serves to demonstrate the purpose.

  Like previously described I edited CopySupport.py and created a
 new method called pasteMonikers. This method is accessed by the
 interface button referred above.

  The coding difference is that this method now creates a *new* object
 (instead of copying the old one, which is the semantics of usual Copy/Paste,
  and instead of using the original object, which is the semantics of the
  PasteReference I created and described before).

  This is the relevant piece of code:

#ob=ob._getCopy(self)
  
id=self._get_linkid(ob.getId())
ob = SimpleItem.ItemShortcut(ob)
ob._setId(id)

self._setObject(id, ob)

ob = self._getOb(id)
ob.manage_afterClone(ob)

  As you can see a new id is created for the new object (method 
 _get_linkid is identical to method get_id but returns ids with the
 format shortcut_to_%s) and a new object of class ItemShortcut
 is created and pasted into the current folder.

  The ItemShortcut class was created at the SimpleItem.py file
 and its basically a Proxy pattern.
  This is the relevant code, added at the end of SimpleItem.py:


class ItemShortcut(SimpleItem):
Proxying class for shortcut implementation

meta_type = Shortcut
icon ='shortcut.gif'

manage_options= SimpleItem.manage_options + (
{'label':'View',
 'action':'index_html',
 'help':''},
)
manage_options= SimpleItem.manage_options + (
{'label':'Properties',
 'action':'manage_properties',
 'help':''},
)
#__ac_permissions__=(('View', ()),)
__ac_permissions__=(('View', ('__call__', '')),)

def __init__(self, obj=None):
self.__obj__ = obj

def __repr__(self):
return Proxy for +`self.__obj__`

def index_html(self):
Proxying class for shortcut implementation

return self.__obj__.__call__()

def manage_properties(self):
Proxying class for shortcut implementation

return HTMLhead/head
body
Shortcut for +`self.__obj__`+
p
a href=+`self.__obj__.absolute_url()`+View
original object/a
p
a
href=+self.__obj__.absolute_url()+/manage_workspaceEdit original
object/a
/body/html


   Once again, this is just proof of concept, and should be correctly
 (read 'nicely' :-) implemented for Zope 2.6.

  C U!

  -- Mario Valente


___
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] Zope 2.6 planning - call for contributors!

2002-03-07 Thread Mario Valente


  Hi:

  I think that the possibility of having inactive objects, objects that
 are instantied, exist in the ZODB and in the folder tree but are
 invisibile to the Zope machinery (acquisition, rendering, itemizing)
 by setting/unsettting a property flag would also be something of
 extreme usefulness.

  C U!

  -- Mario Valente



___
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] Zope 2.6 planning - call for contributors!

2002-03-06 Thread Mario Valente


  Hi:

  I would like to propose my Paste Reference/symlink hack for
 inclusion into Zope 2.6

  C U!

  -- Mario Valente



___
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 )