[Zope-dev] Q: Specialists, Racks, and ZCatalogs?
Hi all, I've started implementation of a simple ZPatterns based application, and so far things have been going well. The problem is, I'm not sure if I'm doing this right. Here is my setup: Zope 2.2.0 hosted at Codeit.com on a Linux box ZPatterns 0.4.3b2 'BookProduct' product *'BookClass' ZClass (inherits from _ZClass_for_CatalogAware, _ZClass_for_DataSkin) * Methods: editInstanceForm, editInstance, index_html, AllTextMethod 'Books' Specialist * defaultRack which stores 'Book' ZClasses * Methods: addBookForm, addBook, index_html, BookSearch, BookResults (the last two methods are a Z Search Interface) *'Catalog' ZCatalog The 'BookClass' editInstance method contains: [snip] dtml-call "propertysheets.Standard.manage_changeProperties(REQUEST)" dtml-call reindex_object [snip] The 'Books' Specialist's addBook method contains: [snip] dtml-let ni="newItem(isbn)" dtml-call "ni.propertysheets.Standard.manage_changeProperties(Authors=Authors, Title=Title, Price=Price)" dtml-call "ni.index_object()" /dtml-let [snip] I've snipped out only the most relevant parts of these methods. As I said, so far this has worked ok. But it seems to me that either the reindex_object or the index_object is in the wrong place, but I'm not sure which. I'm also not sure it's a good or bad idea to place the ZCatalog directly into the Specialist. Also, I would like to replace the three indexes I'm maintaining on the books with a single text index on a computed attribute. I understand that this involves adding a SkinScript to the Rack containing something like 'WITH SELF COMPUTE AllText=AllTextMethod', but I'm unsure of the details. I have a method (AllTextMethod) on the ZClass that returns several fields concatenated as a single string, which I would like to use as a text index. So, I decided to ask for a critique of the application design (such as it is). I also seem to recall mention of 'indexing agents' that might make this a bit more elegant, but haven't found a how-to on the subject. Thanks, Michael Bernstein. ___ 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] How to get the mailing list to work
Just address your emails to [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] Q: Specialists, Racks, and ZCatalogs?
Michael Bernstein wrote: 'BookProduct' product *'BookClass' ZClass (inherits from _ZClass_for_CatalogAware, _ZClass_for_DataSkin) Don't derive from CatalogAware when you're also deriving from DataSkin. Rather than use the CatalogAwareness mechanism to manually call reindex() when your object changes, you should use some SkinScript in your Specialist or in your Customizer to catalog, uncatalog and recatalog on changes. WHEN OBJECT ADDED CALL Catalog.catalog_object(self, _.string.join(self.getPhysicalPath(),'/')) WHEN OBJECT DELETED CALL Catalog.uncatalog_object(_.string.join(self.getPhysicalPath(),'/')) WHEN OBJECT CHANGED CALL Catalog.uncatalog_object(_.string.join(self.getPhysicalPath(),'/')), Catalog.catalog_object(self, _.string.join(self.getPhysicalPath(),'/')) I'm also not sure it's a good or bad idea to place the ZCatalog directly into the Specialist. That's a good idea. The catalog is what the specialist uses to answer questions from other parts of your application such as "what instances have baz for the foo property". So, it should live inside the Specialist, and you should provide a set of methods in the Specialist that answer the questions the rest of you application need answered. Also, I would like to replace the three indexes I'm maintaining on the books with a single text index on a computed attribute. I understand that this involves adding a SkinScript to the Rack containing something like 'WITH SELF COMPUTE AllText=AllTextMethod', but I'm unsure of the details. I have a method (AllTextMethod) on the ZClass that returns several fields concatenated as a single string, which I would like to use as a text index. You don't need a method for this; do it all with SkinScript like this: WITH SELF COMPUTE all_text='%s %s %s' % (title, headline, content) -- Steve Alexander Software Engineer Cat-Box limited http://www.cat-box.net ___ 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] ZClasses vs. Python Products
Morten W. Petersen wrote: Hi peeps, I'm trying to figure out whether to continue work on an existing ZClass product, or rewrite it from scratch. I get a claustrophobic feeling working with ZClasses, and using Python products is more intuitive to me.. I've also seen several people (including guys from DC) refer to ZClass products as (paraphrasing) not-so-good and half-baked.. Anyways, would you care to help me list the pros and cons for ZClasses and Python products? Sounds to me like your needs would best be served with two related products: a TTW ZClass product and a Python Product. Each ZClass is derived from an associated Python base class. You get to keep you flexibility, but also get the advantages of TTW development when you need it. -- Steve Alexander Software Engineer Cat-Box limited http://www.cat-box.net ___ 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] Q: Specialists, Racks, and ZCatalogs?
Steve Alexander wrote: Michael Bernstein wrote: 'BookProduct' product *'BookClass' ZClass (inherits from _ZClass_for_CatalogAware, _ZClass_for_DataSkin) Don't derive from CatalogAware when you're also deriving from DataSkin. Ok. Rather than use the CatalogAwareness mechanism to manually call reindex() when your object changes, you should use some SkinScript in your Specialist or in your Customizer to catalog, uncatalog and recatalog on changes. WHEN OBJECT ADDED CALL Catalog.catalog_object(self, _.string.join(self.getPhysicalPath(),'/')) WHEN OBJECT DELETED CALL Catalog.uncatalog_object(_.string.join(self.getPhysicalPath(),'/')) WHEN OBJECT CHANGED CALL Catalog.uncatalog_object(_.string.join(self.getPhysicalPath(),'/')), Catalog.catalog_object(self, _.string.join(self.getPhysicalPath(),'/')) Thanks, Steve. I'll try this a little later today. What are your thoughts on placing this in the Specialist's 'Plug-ins' tab vs. the Rack's? [snip] Also, I would like to replace the three indexes I'm maintaining on the books with a single text index on a computed attribute. I understand that this involves adding a SkinScript to the Rack containing something like 'WITH SELF COMPUTE AllText=AllTextMethod', but I'm unsure of the details. I have a method (AllTextMethod) on the ZClass that returns several fields concatenated as a single string, which I would like to use as a text index. You don't need a method for this; do it all with SkinScript like this: WITH SELF COMPUTE all_text='%s %s %s' % (title, headline, content) Thanks again, Steve. Cheers, Michael Bernstein. ___ 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] Zope server dies with Netscape's FTP
Hi! I am running Zope 2.3.0 under Linux in a remote machine. When I try to access Medusa through FTP (port 8021) using Netscape 4.5 under Windows, Zope dies silently. Is this a known issue? How can I trace what is happening to Zope's FTP server causing it to die? Cheers! -- Pablo Bleyer Kocik | pbleyer|"Rintrah roars shakes his fires in the burdend air; @embedded.cl | Hungry clouds swag on the deep" William Blake ___ 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] ZClasses vs. Python Products
On Sat, 3 Feb 2001, Steve Alexander wrote: Sounds to me like your needs would best be served with two related products: a TTW ZClass product and a Python Product. Each ZClass is derived from an associated Python base class. You get to keep you flexibility, but also get the advantages of TTW development when you need it. Ahah! That's a very good (and simple) solution. Thanks for the help! -Morten (who still wants to add HTMLFile and Image editing TTW for Python based products). ___ 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] Creating IMAP and SMTP services for Zope
Hi guys, I'm wondering about creating IMAP and SMTP services for Zope. Someone mentioned to me that extending (using?) the ZServer could be a Good Thing (tm). Could anyone point me in the right direction? Thanks. -Morten ___ 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] Creating IMAP and SMTP services for Zope
On Sat, 3 Feb 2001, Morten W. Petersen wrote: Hi guys, I'm wondering about creating IMAP and SMTP services for Zope. Someone mentioned to me that extending (using?) the ZServer could be a Good Thing (tm). Could anyone point me in the right direction? I took a stab at IMAP once... http://www.zope.org/Members/michel/MyWiki/IMAPServer I haven't touched it in a while, and I cannot say much about it, it was over a year ago. -Michel Thanks. -Morten ___ 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] Q: Specialists, Racks, and ZCatalogs?
Michael Bernstein wrote: Thanks, Steve. I'll try this a little later today. What are your thoughts on placing this in the Specialist's 'Plug-ins' tab vs. the Rack's? A Specialist manages objects that play a particular role in your application. You will usually have one Specialist for each role in your application; try listing all the roles, and what they do, and that's a good start for thinking about what specialists you need. A Rack manages the storage for a particular class of objects. Therefore, you will have different racks for different classes of object. You will also have different racks for different ways of storing the same class of object. For example, let's say I have a Specialist "GoPlayers", which manages objects that represent people who play the board-game Go with other people. I have two implementation classes: AmateurGoPlayer and ProfessionalGoPlayer. Objects of these classes have exactly the same interface to the rest of the application. However, the implementation of some of the methods varies. So, I'll need two racks in my GoPlayers specialist: one for AmateurGoPlayers and one for ProfessionalGoPlayers. Let's complicate things by saying that I have the records for some ProfessionalGoPlayers in a relational database, but the rest of the ProfessionalGoPlayers are stored in the ZODB. All the AmateurGoPlayers are stored in the ZODB. So, I need three Racks altogether: AmateurGoPlayers (stored in ZODB) ProGoPlayers_zodb (stored in ZODB) ProGoPlayers_rdbms (from legacy rdbms) I'm indexing all the players that are stored in the ZODB using a ZCatalog called Catalog, in the GoPlayers specialist. Now, when I want to answer a query such as "return all go players called 'bill'", I need to do the following: * create a PythonScript in GoPlayers called list_players_by_name(name) * implement this method as follows: - query the ZCatalog for players who have that name - query the RDBMS using an SQL query for players who have that name - return the union of the results of both queries In this scenario, I'd put the SkinScript to catalog AmateurGoPlayers in the AmateurGoPlayers rack, and likewise for the ProGoPlayers_zodb rack. I'm not indexing the players from the rdbms in a ZCatalog because, in this example, other systems external to Zope can independently update the RDBMS. If this wasn't the case, and the all changes to data in the RDBMS go through Zope, then I could put one set of cataloging skinscript as a data-plugin in the Specialist, and make the list_players_by_name(name) method just return the results from a ZCatalog search. The rest of my application uses the interface provided by the Specialist, and can remain ignorant of where a particular GoPlayer's records are stored. Note that the specialist provides exactly the methods that the rest of the application requires; ideally no more, and no fewer. Beware when returning results from a ZCatalog query that you are only returning Catalog Brains -- simple objects that record the meta-data archived when the original object was cataloged. Where speed of execution is not an issue, you should return a list of actual GoPlayer objects rather than a list of CatalogBrains. An alternative is to return a list of string ids. Often, a better plan is to determine exactly what information is needed by the part of your application that requires the list_players_by_name(name) method call; then provide exactly that information. -- Steve Alexander Software Engineer Cat-Box limited http://www.cat-box.net ___ 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] Creating IMAP and SMTP services for Zope
On Saturday 03 February 2001 10:28, Morten W. Petersen wrote: Hi guys, I'm wondering about creating IMAP and SMTP services for Zope. Someone mentioned to me that extending (using?) the ZServer could be a Good Thing (tm). probably. i've always been curious though about the threads in zserver, i thought they were allocated to handle only zpublisher requests (maybe just http requests). assuming you don't want to tie up the thread handling the asyncore it seems you might need to create a pool of threads for handling requests, or adjust your code to translate imap/smtp requests into zpublisher requests so the default pool can be used. granted if you're not also running a busy website on this than it probably won't be a concern as esp. if the server operations are fast. Could anyone point me in the right direction? micheal already pointed out his imap code. i'd like to give warning that handling imap properly with different clients can be a pain. the protocol is a bit complex and there are some gray areas, which different clients handle differently. pop is much, much simpler if you want to go that route (with the option of just leaving mail on the server, you might be able to treat it superficially like imap). barry warsaw has an async implementation of a smtp server that he uses to test out mailman, its on his homesite at http://www.wooz.org/users/barry/software/Code/smtpd.py HTH, kapil ___ 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] Q: Specialists, Racks, and ZCatalogs?
Steve Alexander wrote: Michael Bernstein wrote: Thanks, Steve. I'll try this a little later today. What are your thoughts on placing this in the Specialist's 'Plug-ins' tab vs. the Rack's? [snip excellent explanation] Thanks, Steve. That was very helpful. To summarize your explanation, if I understood correctly: This is strictly an implementation issue. If the SkinScript has functionality that should be shared by more than one Rack, it should go in the Specialist, otherwise keep it with the Rack that it's specific to. Or, looked at another way, common functionality should be factored out and acquired. All in all, a very 'Zopish' principle. Cheers, Michael Bernstein. ___ 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-Annce] DTML Eval Tag Released
--- Phill Hugo [EMAIL PROTECTED] wrote: Hi Casey, This looks good but I got the feeling that it may be better to use the RESPONSE object to store variables in since this won't taint the input REQUEST. I'm not sure what your feeling is in this regard (I'm not sure the RESPONSE object is ever used for variable lookup as the REQUEST is (albeit last of all)) - this could actually be a good thing though as it would force people to use RESPONSE['variable'] in all cases rather than sometimes using variable and sometimes REQUEST['variable'] depending on the variable's name. The other option would be to pop them on top of the namespace as the _.namespace method and dtml-let tag seem to do. This would remove the need to alter either REQUEST or RESPONSE. I'm not sure how straightforward this would be though. Let me know your thoughts, Phill Hi Phill, Thanks for the feedback. As for the REQUEST vs. RESPONSE usage, the latter can't be used to store values and is really there as a way to communicate to the browser. The former is used pretty regularly to store scratch variables already. I agree that a better solution is to use a namespace. That was my original intention. However, namespaces must be explicitly scoped (ala dtml-let). That is, you can't create (push) one without explicitly popping it back off later down the road before the method ends. One of the primary goals of the eval tag was that you can assign variables that implicitly have the same scope as the method they are in, just like any other decent language. I also considered just manipulating whatever namespace happened to be on top of the stack, but there is no guarantee that the top NS is a mutable object, so that wouldn't work. A possible solution to this is for the method to push an empty scratch namespace for itself when it starts and pop it when it finishes. Then the eval tag can just use this namespace to store variables. I considered that too complex for my first release, but I certainly will reconsider it for future ones. Again thanks for the feedback. = | Casey Duncan | Kaivo, Inc. | [EMAIL PROTECTED] `- __ Get personalized email addresses from Yahoo! Mail - only $35 a year! http://personal.mail.yahoo.com/ ___ 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 )