Re: [Zope-dev] Granularity of Persistent Objects
> > Or shall I wrap each one in a custom class that subclasses Persistent? > > That is usually an even better idea. And for big dictionaries, you may > want to use the BTree objects for storage. So in my containing class, I just have class MyContainer( Persistent ): subObject = None def __init__( self ): self.subObject = BTree() and etc.? That's all there is to it?? Thanks, ..Ian ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Granularity of Persistent Objects
Greetings. I'm developing a Zope (2.7) product, and I've got a particular persistent object that's going to be a real bottleneck, in that there will be many threads trying to change the state of the object more or less simultaneously. I'd like to "spread out" the problem by taking member fields of the object (lists, dictionaries, etc.) and making them persistent sub-objects in their own right. That way, changes made to one of them can be saved to the ZODB without causing thread conflicts with changes being made to others, removing at least some of the thred conflicts. However, I don't know how to do this. Is it as simple as using a PersistentMapping where I'd normally use a standard Python dictionary? Or shall I wrap each one in a custom class that subclasses Persistent? Does my parent object have to handle these in any special way so that the ZODB knows to give them their own DB records? I've tried looking at how ObjectManager does things, and found it less than enlightening. Thanks, ..Ian Beatty University of Massachusetts Amherst ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] ZODB for Java?
Greetings. Does anyone know of a good (stable, reliable, fast enough for production use in a web app) ZODB-equivalent for persisting Java objects? Thanks, ..Ian -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- Dr. Ian Beatty [EMAIL PROTECTED] Physics Education Researchvoice: 413.545.9483 Department of Physics fax: 413.545.4884 Univ. of Massachusetts AIM: (available upon request) Amherst, MA 01003-9337 USA http://umperg.physics.umass.edu/ -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Threads, Locks, Volatility, and Angst
On 2004-03-31 5:42 PM, [EMAIL PROTECTED] is reputed to have said: > Do you use this unique ID only as some kind of session ID? Yes, exactly. > If you only > need these IDs during a session (don't have to store them in ZODB), you > can create a thread safe class for managing them and then use an instant > of this class as a module global variable in your product. > AFAIR, this is the way how exUserFolder implements it's usercache. You > can get a clue by examining these files... I'll check them out. Thanks. ..Ian -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- Dr. Ian Beatty [EMAIL PROTECTED] Physics Education Research Group voice: 413.545.9483 Department of Physics fax: 413.545.4884 Univ. of Massachusetts AIM: (available upon request) Amherst, MA 01003-4525 USA http://umperg.physics.umass.edu/ -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Threads, Locks, Volatility, and Angst
Greetings. I'm looking for a little wisdom -- specifically, about thread locks and Zope. I'm developing a Python-based product. One of the classes needs to hand out unique IDs to clients as they connect for the first time. I generate these by keeping an index integer in the instance that starts at zero, incrementing it by one for every new client, and using the new value for the unique ID. In order to prevent race conditions when two clients connect almost simultaneously, I have another instance variable in my class that holds a threading.lock(). I call acquire() on that lock just before the increment-and-report code, and release() just after. So far so good. That seemed to work just fine yesterday when I coded it. Then I shut down Zope overnight and started it up again today. Now, I cannot create a new instance of the class without getting the Zope error "UnpickleableError: Cannot pickle objects". (I'd swear it was working yesterday, though.) I thought "Okay, no problem. I'll just make the lock variable volatile, since I don't really care whether it persists when Zope shuts down." So I renamed the lock to begin with '_v_'. That solves my "UnpickleableError" problem nicely. Unfortunately, it introduces a different problem: the code that calls acquire() on the lock now throws "AttributeError: 'NoneType' object has no attribute 'acquire'". I'm sure I initialize that variable to a threading.Lock() in the object's __init__ method. So now I'm worried that Zope is doing all kinds of pickling-unpickling activity behind the scenes, and anything I have that's volatile can disappear without warning. Are there any thread-wise Zopistas out there who can steer me right? Thanks, ..Ian -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- Dr. Ian Beatty [EMAIL PROTECTED] Physics Education Research Group voice: 413.545.9483 Department of Physics fax: 413.545.4884 Univ. of Massachusetts AIM: (available upon request) Amherst, MA 01003-4525 USA http://umperg.physics.umass.edu/ -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Product Access to Files
On 2004-03-11 7:04 AM, Chris Withers is reputed to have said: >> I'm overriding '__getitem__' and using Python's "os" package to directly >> access the local file system. I just sniff the file name extension and set >> the response content-type, then return the contents of the named file. >> Simple and stupid. > > Ooo... I hope you're confident in what you're doing :-S Not in the least! =8-0 I've never mucked around this deep within Zope before. What's the danger... threading issues? > Should be vaguely okay, provided you're not writing to those files with the > os module. No writing, only reading. > Mindyou, Apache could serve 'em a LOT faster... It's a whole lot easier to have those files nicely packaged inside my product, so that all someone needs to do is install the product and be done with it. No separate directory of files to put somewhere, no Apache configuration to do, no URL issues. I'm wide open to suggestions for a better way to do this! >> (If anyone's curious, I'm using a Zope product for a back-end to a >> Mozilla/XUL front-end. This static file stuff allows the product to provide >> the XUL, JavaScript, and CSS files needed to define the Mozilla-based >> interface.) > > Cool :-) I think so! ;-P In the long run, I may set up the XUL/etc. to be installed into the user's Mozilla "Chrome", and then it would be permanently resident. So it would only be downloaded once per user, which makes efficiency less important and Apache (hopefully) unnecessary. Cheers, ..Ian -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- Dr. Ian Beatty [EMAIL PROTECTED] Physics Education Research Group voice: 413.545.9483 Department of Physics fax: 413.545.4884 Univ. of Massachusetts AIM: (available upon request) Amherst, MA 01003-4525 USA http://umperg.physics.umass.edu/ -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Product Access to Files
On 2004-03-10 10:14 AM, Chris Withers is reputed to have said: > Ian Beatty wrote: > >> I've been messing around with DTMLFile and ClassicHTMLFile and the like, >> haven't been able to figure out how to get it to work for arbitrary paths. >> They also require all my file names end in '.dtml', which is quite a pain. >> >> Any suggestions? > > Local FS? > What Sandor said? > Apache and rewrite rules? I'm overriding '__getitem__' and using Python's "os" package to directly access the local file system. I just sniff the file name extension and set the response content-type, then return the contents of the named file. Simple and stupid. I actually delegate the file-serving to a helper class, and use recursion to handle arbitrary-length paths for arbitrary-depth file system hierarchies. Simple, stupid, and inelegant, but it seems to work. FileSystemSite seemed geared towards providing ZMI access to static files. I just want my product to be able to dish out preset files that are part of the product. (If anyone's curious, I'm using a Zope product for a back-end to a Mozilla/XUL front-end. This static file stuff allows the product to provide the XUL, JavaScript, and CSS files needed to define the Mozilla-based interface.) Thanks for all the suggestions. Cheers, ..Ian -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- Dr. Ian Beatty [EMAIL PROTECTED] Physics Education Research Group voice: 413.545.9483 Department of Physics fax: 413.545.4884 Univ. of Massachusetts AIM: (available upon request) Amherst, MA 01003-4525 USA http://umperg.physics.umass.edu/ -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Catching "extra path"
Hi again. I'm chipping away at the problem I asked about earlier ("Product Access to Files") -- or perhaps just beating my head against it -- and I've got another question. If I'm writing a Python script within the ZMI, any URL that resolves to my script will invoke the script, even if the URL has "extra" stuff appended: http://host/folder/script/a/b/c will invoke a script at /folder/script. Furthermore, I can get at the "a/b/c" part from within the script by accessing 'traverse_subpath'. The question is, how can I do this from within a Python-based product? Calling http://host/folder/object/method/a/b/c fails to invoke the method 'method' on my custom object 'object'. Instead, I get a "Cannot locate object" page. It's hard to believe there's something I can do with a ZMI Python script that I can't do in a Python product... Thanks, ..Ian -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- Dr. Ian Beatty [EMAIL PROTECTED] Physics Education Research Group voice: 413.545.9483 Department of Physics fax: 413.545.4884 Univ. of Massachusetts AIM: (available upon request) Amherst, MA 01003-4525 USA http://umperg.physics.umass.edu/ -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Product directory?
Greetings again. This has to be an easy one. >From within my Python-based product's code, how do I get access to the product's directory on the filesystem? os.getcwd() seems to provide the working directory of the shell used to launch Zope, at least when running in debug mode. I've tried ferreting it out from the source to DTMLFile and etc., but I can't trace it. Thanks, ..Ian -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- Dr. Ian Beatty [EMAIL PROTECTED] Physics Education Research Group voice: 413.545.9483 Department of Physics fax: 413.545.4884 Univ. of Massachusetts AIM: (available upon request) Amherst, MA 01003-4525 USA http://umperg.physics.umass.edu/ -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Product Access to Files
Greetings. I'm developing a Python-based product that needs to serve up a variety of XML files out of the product's directory. That is, certain URLs handled by instances of a product-defined type need to return an XML file that's on disk along with the product's DTML views and the like. Let's say that the URL http://localhost/foo/bar resolves to an object my product class defines. Then I'd like http://localhst/foo/bar/static/a to serve a file named 'a' in a directory named 'xml_files' in my product's directory. Similarly, http://localhst/foo/bar/static/b/c should serve a file named 'c' within a directory named 'b' within 'xml_files' in my product's directory. I'd rather not hard-code every single file in the Python module, since there will be many, and they'll be changing a lot during development. I've been messing around with DTMLFile and ClassicHTMLFile and the like, haven't been able to figure out how to get it to work for arbitrary paths. They also require all my file names end in '.dtml', which is quite a pain. Any suggestions? Thanks, ..Ian -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- Dr. Ian Beatty [EMAIL PROTECTED] Physics Education Research Group voice: 413.545.9483 Department of Physics fax: 413.545.4884 Univ. of Massachusetts AIM: (available upon request) Amherst, MA 01003-4525 USA http://umperg.physics.umass.edu/ -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Schizophrenic ObjectManager?
Greetings. I'd like to create a type in a Python-based product that's kind of like two folders fused together. What I mean by that is I've got a folderish object type -- let's call it 'F' -- that inherits from ObjectManager. I've set it up so that it can contain objects of type 'A' and nothing else, by using the all_meta_types property. So far so good. Now, I want to have it also contain objects of type 'B', but displayed and managed through a separate tab in the ZMI. If I click on the "Contents" tab of an instance of F, I get the list of contained A-type objects, with cut, copy, paste, delete, etc. If I click on another tab named, say, "OtherStuff", I want to see exactly the same kind of contents-list management page, but for contained B-type objects. I'm thinking that I might try having F contain an instance of ObjectManager as a property, and delegate all B-managing functionality to that. Management of A would be handled through F's inherited ObjectManager behavior. What concerns me is that the "encapsulated" second ObjectManager wouldn't have a container in the usual way, and that could seriously mess up acquisition. Another possibility is to maintain only one collection, but to create the illusion of two separate collections by having two copies of the contents ('manage_main') page, each modified to display only one kind of child. Any thoughts, oh masters of Zope Zen? Cheers, ..Ian -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- Dr. Ian Beatty [EMAIL PROTECTED] Physics Education Research Group voice: 413.545.9483 Department of Physics fax: 413.545.4884 Univ. of Massachusetts AIM: (available upon request) Amherst, MA 01003-4525 USA http://umperg.physics.umass.edu/ -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Re: Custom class: cut,copy,rename?
On 2004-03-02 2:15 PM, Ian Beatty is reputed to have said: > Here's what I have now: a hierarchy of five custom > classes, pretty close to identical for now. All five subclass ObjectManager, > CatalogAware, PropertyManager, and SimpleItem in that order. The top one > ("A") may be added to any old Zope folder; B may only be added to A; C to B; > D to C; and E to D. Standard Zope Images may be added to E. > > I can now freely rename A, C, D, and any images within an instance of E. I > *cannot* rename B or E; when I try, I get "The object term_0 does not > support this operation" ('term_0' is an instance of B) On 2004-03-02 9:55 AM, Chris Withers is reputed to have said: > I suspect the way you're trying to ensure only certain types of object can go > in certain containers is to blame here... Aah, finally, I figured it out. So simple. You were right, Chris. For the problem classes, B and E, the meta_type value defined in the class definition wasn't exactly the same as the type name specified in the container class' all_meta_types' field. *Sigh* And I thought that value in all_meta_types was simply to provide the visual label in the combo box. Thanks for the help, folks. I definitely needed it. Cheers, ..Ian -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- Dr. Ian Beatty [EMAIL PROTECTED] Physics Education Research Group voice: 413.545.9483 Department of Physics fax: 413.545.4884 Univ. of Massachusetts AIM: (available upon request) Amherst, MA 01003-4525 USA http://umperg.physics.umass.edu/ -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Re: Custom class: cut,copy,rename?
On 2004-03-01 7:21 PM, Max M is reputed to have said: > So if SimpleItem is before ObjectManager the traversal order of the > parent objects will make shure that you get the wrong methods :-( So > this will *not* work... Aha... that explains a lot of my "irreproducible" behavior. After correcting the order of inheritance, *most* of the bizarre behavior is gone. But not all. Here's what I have now: a hierarchy of five custom classes, pretty close to identical for now. All five subclass ObjectManager, CatalogAware, PropertyManager, and SimpleItem in that order. The top one ("A") may be added to any old Zope folder; B may only be added to A; C to B; D to C; and E to D. Standard Zope Images may be added to E. I can now freely rename A, C, D, and any images within an instance of E. I *cannot* rename B or E; when I try, I get "The object term_0 does not support this operation" ('term_0' is an instance of B), with the following traceback: Traceback (innermost last): Module ZPublisher.Publish, line 100, in publish Module ZPublisher.mapply, line 88, in mapply Module ZPublisher.Publish, line 40, in call_object Module OFS.CopySupport, line 230, in manage_renameObjects Module OFS.CopySupport, line 247, in manage_renameObject Module OFS.CopySupport, line 393, in _verifyObjectPaste Copy Error: Not Supported ! The object term_0 does not support this operation. I've scrutinized all five classes, and I can't figure out what makes B and E different from the rest. On 2004-03-02 9:55 AM, Chris Withers is reputed to have said: >> I'll talk about the top 3. I've got things set up so that I can create >> instances of A within my Zope root (or any other "normal" Zope folder), I >> can create instances of B and only B within A, and I can create instances of >> C and only C within B. > > How have you tried to make that happen? My __init.py__ file registers all five classes, but all except the top one (A) have the line 'container_filter = containerFilter_makePrivate,' where 'containerFilter_makePrivate' is a trivial method that returns zero. In other words, classes B through E reject all containers. Then each of the classes declares "all_meta_types" for the classes it is supposed to contain, like this (from A): all_meta_types = ( { 'name':'Type B', 'action':'manage_addProduct/MyProduct/manage_BAddForm' }, ) Since explicitly calling the constructors avoids the container_filter, this has the effect that I want. >> I presume you mean "for cut, paste, rename, etc." If I remove >> PropertyManager, my 'Properties' ZMI tab disappears. > > That's odd, I could have sworn ObjectManager used that. Hmmm, maybe use Folder > instead of ObjectManager ;-) I've been tempted to subclass Folder instead, but I'm not sure what other undesired functionality I might unwittingly inherit. > The HTML would be handy ;-) Okay, see the traceback above in my response to Max M. > What version of ZOpe are you using? Zope 2.7.0 rc2, which claims to be "(unreleased version, python 2.3.3, darwin)" in the ZMI. > I suspect the way you're trying to ensure only certain types of object can go > in certain containers is to blame here... I tried removing all the container_filter statements from the registration code in __init.py__, so that all classes are addable to any Zope folder. I still can't rename an instance of B that's inside A, but if I add a B to the ZMI root folder, I **can** rename it there! Same with E. So the class isn't intrinsically un-renamable; it's either a function of how it was added, or of the container. I still can't get my head around why the problem only occurs for B and E. Thanks for the thoughts. Is there a better or more standard way to create a folderish object that can only contain a specific set of other object types, other than using all_meta_types? Thanks, ..Ian -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- Dr. Ian Beatty [EMAIL PROTECTED] Physics Education Research Group voice: 413.545.9483 Department of Physics fax: 413.545.4884 Univ. of Massachusetts AIM: (available upon request) Amherst, MA 01003-4525 USA http://umperg.physics.umass.edu/ -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Re: Custom class: cut,copy,rename?
On 2004-03-01 3:44 PM, Chris Withers is reputed to have said: > Ian Beatty wrote: > >> OFS.ObjectManager.ObjectManager >> Products.ZCatalog.CatalogPathAwareness.CatalogAware >> OFS.PropertyManager.PropertyManager >> OFS.SimpleItem.SimpleItem > > I'm pretty sure all you should actually need is: > >> OFS.ObjectManager.ObjectManager >> Products.ZCatalog.CatalogPathAwareness.CatalogAware I presume you mean "for cut, paste, rename, etc." If I remove PropertyManager, my 'Properties' ZMI tab disappears. I'm not quite sure what SimpleItem provides for me, but it's in the examples I'm trying to work from. >> OFS.SimpleItem.Item (subclassed by OFS.SimpleItem.SimpleItem) is supposed to >> provide cut-and-paste functionality. So, how might I be breaking it? > > Show us some error messages, exceptions, types ,values and tracebacks adn > amaybe > we can help ;-) Okay. This is bizarre. I've got a containment hierarchy of several classes; I'll talk about the top 3. I've got things set up so that I can create instances of A within my Zope root (or any other "normal" Zope folder), I can create instances of B and only B within A, and I can create instances of C and only C within B. When I try to rename an instance of A, the ZMI gives me the standard rename-object form; but when I type in a new ID and click 'OK', I get a ZMI page with a red exclamation mark, an 'OK' button, and nothing else except the word '_notifyOfCopyTo'. The error log shows a "Copy Error" with the following traceback: Traceback (innermost last): Module ZPublisher.Publish, line 100, in publish Module ZPublisher.mapply, line 88, in mapply Module ZPublisher.Publish, line 40, in call_object Module OFS.CopySupport, line 230, in manage_renameObjects Module OFS.CopySupport, line 252, in manage_renameObject Copy Error: [html snipped] Now, If I view the ZMI for A, select a contained item of type B, and try to rename it, it fails but with a different signature: the notification page says 'The object term_0 does not support this operation' instead of '_notifyOfCopyTo'. ("term_0 is the ID of the B instance.) The error log shows a Copy Error with this traceback: Traceback (innermost last): Module ZPublisher.Publish, line 100, in publish Module ZPublisher.mapply, line 88, in mapply Module ZPublisher.Publish, line 40, in call_object Module OFS.CopySupport, line 230, in manage_renameObjects Module OFS.CopySupport, line 247, in manage_renameObject Module OFS.CopySupport, line 393, in _verifyObjectPaste Copy Error: [html snipped] Attempting to rename an instance of C within B fails in the same way as renaming A (i.e., with a '_notifyOfCopyTo'). I've currently got A subclassing ObjectManager, CatalogAware, and PropertyManager; B subclassing the same plus SimpleItem (just as an experiment); and C subclassing the same as A. If I remove SimpleItem from B's list of superclasses, I still get the same set of errors, *except* when attempting to rename C. Now, I instead get the failure message 'You do not possess the permission required to call manage_addProduct/KBProduct/manage_KBCourseAddForm in the context of the container into which you are pasting, thus you are not able to perform this operation.' The Error Log traceback is: Traceback (innermost last): Module ZPublisher.Publish, line 100, in publish Module ZPublisher.mapply, line 88, in mapply Module ZPublisher.Publish, line 40, in call_object Module OFS.CopySupport, line 230, in manage_renameObjects Module OFS.CopySupport, line 247, in manage_renameObject Module OFS.CopySupport, line 378, in _verifyObjectPaste Copy Error: [html snipped] I'm completely bewildered here. Any suggestions would be tremendously appreciated. By the way, if this isn't the appropriate venue for this kind of question, please point me in the right direction. This list seems to focus on Zope's internals, but the Zope Users list seems a bit low-level for Python-based product development. Thanks, ..Ian -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- Dr. Ian Beatty [EMAIL PROTECTED] Physics Education Research Group voice: 413.545.9483 Department of Physics fax: 413.545.4884 Univ. of Massachusetts AIM: (available upon request) Amherst, MA 01003-4525 USA http://umperg.physics.umass.edu/ -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Custom class: cut,copy,rename?
Greetings. I've created a package in Python with some basic classes. They work in the ZMI, except for the fact that the ZMI paste and rename functionality fails with the message "The object xxx does not support this operation." I've dug into the source code for standard types ('OFS.Folder', 'OFS.SimpleItem', etc.) and discovered some tantalizing bits (such as 'manage_renameObject' in 'OFS.CopySupport'), but I can't figure out how to put it together to make my classes renameable and pasteable. I'm rather surprised that behavior doesn't come automatically when inheriting from the standard base classes. One of my folderish classes subclasses the following bases: OFS.ObjectManager.ObjectManager Products.ZCatalog.CatalogPathAwareness.CatalogAware OFS.PropertyManager.PropertyManager OFS.SimpleItem.SimpleItem Am I not inheriting from the proper set of base classes? Is there an easier way? According to the ZDG (2.4 edition, vs. my Zope 2.7), OFS.SimpleItem.Item (subclassed by OFS.SimpleItem.SimpleItem) is supposed to provide cut-and-paste functionality. So, how might I be breaking it? Bewildered, ..Ian -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- Dr. Ian Beatty [EMAIL PROTECTED] Physics Education Research Group voice: 413.545.9483 Department of Physics fax: 413.545.4884 Univ. of Massachusetts AIM: (available upon request) Amherst, MA 01003-4525 USA http://umperg.physics.umass.edu/ -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Making a custom class addable to another class in product, but not to Zope
Greetings. I'm relatively new to Python-based development of Zope products. I've got two classes in my product; let's call them Container and Thing. I want to have Container addable to any old folder in the ZMI; that's no problem, I just register it in my product's __init__.py file. I want Container to allow instances of Thing to be added to it, and nothing else; that's also no problem, using all_meta_types. However, I want Thing to be addable to Container, but not to any other ObjectManager-based object. I can't figure that one out. I assumed I could do it by having an entry for Thing in Container's all_meta_types property, and by *not* registering it in __init__.py. Unfortunately, that fails. If I click on the "Add Thing" button in the ZMI when viewing the content of a Container, I get Cannot locate object at http://localhost:8080/kb0/manage_addProduct/ [ignore line break] MyProduct/manage_addThingForm If I register Thing in __init__.py, then the Add Thing button works perfectly, but I can add a Thing to any folder in the ZMI. It looks like the registration process is necessary to get manage_addThingForm added to whatever registry of constructors manage_addProduct['MyProduct'] accesses. Is there a way around this? I'd think what I'm trying to do is pretty standard, but I can't find anything enlightening. Thanks, ..Ian ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )