Re: [Zope-dev] ZPatterns, ZClasses, Specialists: Assigningresponsibilities
>Itai Tavor wrote: > >>I have the following ZClasses, with matching Specialists: Product, >>Graphic, Order, OrderLineItem. When a customer adds a product to >>their order, they have to provide a graphic file which will be >>printed on the product (imagine buying a lunch box with your cat's >>photo on it). The Graphics Specialist can provide a >>addGraphicSnippet form. But who's responsible for asking for this >>graphic when adding the product to the order? Is it still the >>Product object? But a Product turns into a Product-with-Graphic >>only when it's a part of an order, so is it correct for the Product >>to even know about Graphics? the alternative is to move the >>addToOrder methods to either Order or OrderLineItems, but this >>doesn't make any more sense because these would then have to know a >>lot more about a Product than is good for them. Any ideas? > >Sounds to me like you have a new type of Product. > >You have your basic products (of which there are many kinds), and >you have ProductWithGraphic products. A ProductWithGraphic is a >"calculated product": it is composed of a basic product and a >graphic. Its cost, delivery time, packing charge, and so forth, are >calculated based on the combination of the basic product and the >graphic. > >To the rest of the application, a ProductWithGraphic is just another >kind of product. Thanks, this is an interesting suggestion... but I'm not sure how it would work. It gets very complicated when I try to think of implementing it. The application accesses products using a Products Specialist, with a Rack for each type of product. The contents of these Racks make up the Product catalog of the store. The Products Specialist implements the role of 'things that can be added to an order'. On the other hand, ProductWithGraphic is not part of the store's catalog. A new instance of it is created every time a shopper adds a product to their cart. So it does not fill the role 'thing that can be added to an order'. rather, its role is of something that has been ordered and is being fabricated. So treating ProductWithGraphic as another kind of Product doesn't seem to make sense... I do realize I need a new kind of product - CustomizableProduct. But, looking at the role of a ProductWithGraphic, it looks a lot more like an OrderLineItem than a Product. It's part of an order. It's state changes are part of the order handling process. So wouldn't it make sense to have a lineItemWithGraphic object in the OrderLineItems Specialist? That seems much simpler to me... except that the responsibilities question in it is still open. Back to square 1. This is how I see it: - Products Specialist productRack customizableProductRack - OrderLineItem Specialist lineItemRack lineItemWithGraphicRack - product.addMeToOrder(): order.addLineItem(product_id=id, add='lineItem') - custimazable_product.addMeToOrder(): order.addLineItem(product_id=id, add='lineItemWithGraphic') I imagine, then, that the UI for uploading the graphic would be included in product.addMeToOrderForm, using a UI snippet from the OrderLineItemsWithGraphic Specialist. Then I could pass REQUEST on to order.addLineItem and to OrderLineItemsWithGraphic.add, which would then upload the file? Woof... so long. I'd appreciate any comments on this - especially on the question on whether it's better to have a specialized type of OrderLineItem, or to link the standard OrderLineItem to a Product object in case of a standard product, or, in the case of a customizable product, to a new object which stores the graphic and tracks the fabrication of the customized item. TIA Itai -- Itai Tavor"Je sautille, donc je suis." C3Works[EMAIL PROTECTED] - Kermit the Frog "If you haven't got your health, you haven't got anything" ___ 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] urllib not available in Python Scripts?
Evan Simpson wrote: >From: "Itai Tavor" <[EMAIL PROTECTED]> >> > import urllib >> > urllib.__allow_access_to_unprotected_subobjects__ = 1 > >> Ok, this is simple enough, and it works. But... it opens access to >> everything in urllib. > >For now, the best way is to use a dictionary of names, like this: > > import urllib > urllib.__allow_access_to_unprotected_subobjects__ = { > 'quote': 1, 'unquote': 1, > } > >Cheers, > >Evan @ digicool & 4-am Thanks! Nice and simple. The moral of this story is, you got to know what to ask :-) -- Itai Tavor"Je sautille, donc je suis." C3Works[EMAIL PROTECTED] - Kermit the Frog "If you haven't got your health, you haven't got anything" ___ 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] Re: ZPatterns, ObjectDomain, UML and all that.....
>Hi Itai, > >Ok.. I'm working an DumbZPatternsExample V3.0 so this is exactly >the sort of conversation that needs to take place for me. ;-) Godd to hear that (both that the discussion is helping you, and that you're working on a new dumb example :-) ) >It seems to me that when you want a Reseller, or a Customer you >certainly want to go to the Resellers or Customers Specialist and ask >for the Participant. So.. since there is never more than one Actor for >each Participant, I think I'd keep the information about the actor_id >in the Participant. I might even suggest that you could use the actor_id >as the participant_id, depending on how these id's are implemented. >(it seems that it would be particularly nice if the ids are known to >be globally unique that you could use this fact to help identifying >relationships...) I'm already using globally unique ids, but still, doesn't using the same id for the Participant and the Actor make these objects too tightly coupled? Seems to me that Actors should provide an interface for finding actors to the rest of the application; other objects should not make assumptions about the internal storage of Actors, and particularly what ids they use. No? >Now.. you seem to be asking how to run it the other way around. >How do we get the correct Participant from the Actors specialist? >Hmm... I'm not sure what the scenario would be that would require >this, but it seems to me that it's a reasonable enough possibility. Well, Actors store user info such as login_name, password, and roles. So it's natural (I think) for acl_users to authenticate against Actors, rather than ask each Participant Specialist to search all the Actors associated with its Participants. So AUTHENTICATED_USER is an Actor. But the application needs to know the Participant - for example, if a Customer is placing an order, she will be asked to identify her Reseller. But if a Reseller is placing the order, the application already knows the Reseller, but it needs to ask for a Customer. So, from the Actor, I need to know the Participant type, id, name, etc. Unless, of course, I'm making things too complicated again, and it really is better to authenticate Participants rather than Actors... >How about a little search... : > >PythonScript: getParticipantFor( self, participantSpecialistList ) > > while Participants in participantSpecialistList: > theParticipant = Participants.getParticipantForActor( self.actor_id ) > if theParticipant is not None: >break > > return theParticipant > >It's up to the 'Participants' Specialists to implement getParticipantForActor >based on the actor_id. (if actor_id is the same as reseller_id then it's >just getItem!) Now... to make this slick, add an attribute handler for >your actor that does this automagically when you ask for 'participant'. > >I think something like: > >WITH self.getParticipantFor( [Resellers, Customers] ) COMPUTE >myParticipant = RESULT or NOT_FOUND > >should do it. In code you just say: > >resellerName = self.myParticipant.name > >or somthing like that. > >Of course.. I've not tried this. But it *seems* like it should work. ;-) I imagine it would... and it looks pretty good. The question is, and that brings us back to the object connections table, whether this is really the way you would want to do it. Itai >-steve > >> "Itai" == Itai Tavor <[EMAIL PROTECTED]> writes: > > Itai> There might be many ways to implement each connection, but I > Itai> think that there will always be one or two ways that would > Itai> be simplest and most robust... so this would not only save > Itai> you the trouble of figuring it out alone every time, but > Itai> would also prevent you from getting stuck down the road. > > Itai> The problem is that we have at best guesses, and at worst > Itai> empty table cells in the guide. I'm still struggling with > Itai> many of these... The worst one seems to be XOR type > Itai> connections, where a Specialist implementing a role is not > Itai> involved. Example: > > Itai> Actor: Person. > > Itai> Participants: Customer, Reseller > > Itai> Object connections: (Customer) 1---[XOR A] 1 (Actor) > Itai> [XOR A] 1---1 (Reseller) > > Itai> acl_users Login Manager authenticates users using Actor > Itai> objects (by connecting the the Actors Specialist). The > Itai> application needs to identify the Participant. > > Itai> If you add participant_id to Actor, you still don't know > Itai> which Participant Specialist to load the Participant > Itai> from. You don't want to add participant_type to Actor (at > Itai> least, I don't think you do - it seems real ugly). So, what > Itai> do you do? Do you place the Customers and Resellers > Itai> Specialists inside a Participants Specialist? We'll have to > Itai> call it MegaSpecialist :-). Bad idea - other parts of the >
Re: [Zope-dev] urllib not available in Python Scripts?
From: "Itai Tavor" <[EMAIL PROTECTED]> > > import urllib > > urllib.__allow_access_to_unprotected_subobjects__ = 1 > Ok, this is simple enough, and it works. But... it opens access to > everything in urllib. For now, the best way is to use a dictionary of names, like this: import urllib urllib.__allow_access_to_unprotected_subobjects__ = { 'quote': 1, 'unquote': 1, } Cheers, Evan @ digicool & 4-am ___ 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] urllib not available in Python Scripts?
Evan Simpson wrote: >From: "Itai Tavor" <[EMAIL PROTECTED]> >> The reason I could do urllib.quote in Python Methods was that I >> implemented the MoreBuiltins trick someone described here a while >> ago. > >That would be me :-) Ok ,then, thank you for it :-) > > Is there anything that can be done so that adding modules continues >> to work? > >Sure. Since you've already got a MoreBuiltins module, that's probably a >fine place to put this. In MoreBuiltins/__init__.py (or a brand new Product >directory of your choice) put the following lines: > > import urllib > urllib.__allow_access_to_unprotected_subobjects__ = 1 > >...and similarly if you want to declare other modules PS-importable. As of >2.3, the proper way to do this will be: > > from AccessControl import ModuleSecurityInfo > ModuleSecurityInfo('urllib').setDefaultAccess(1) Ok, this is simple enough, and it works. But... it opens access to everything in urllib. I played around a bit and found that I can't do any harm with urlopen because I still don't have access to URLopener objects. But urlretrieve does work, and I can imagine being able to do some damage with it. MoreBuiltins selected a subset of urllib methods to make available for Python Methods - can that be done for Python Scripts? -- Itai Tavor"Je sautille, donc je suis." C3Works[EMAIL PROTECTED] - Kermit the Frog "If you haven't got your health, you haven't got anything" ___ 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] IE5 / Medusa bug?
seb bacon writes: > IE does not get last 11 bytes > - it's always the last 11 bytes that are missing, however large the > page is > > - I've sent exact copies of the HTTP headers to the server, using > telnet, and there's no problem there I made the experience that IE is very strict with the "Content-Length" header. If it is there, it must be correct. Otherwise, IE will show wrong results. Dieter ___ 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] Problem in current CVS
Jimmie Houchin writes: > I just updated my current CVS build of Zope2. > > ImportError: cannont import name end_of_header_search This may be the effect of a fix for a problem discussed recently in "zope-dev": Zope looked for "" and added it, if not present. Unfortunately, it forgot to update "Content-Length" accordingly. This fixing was dropped. Dieter ___ 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] more on keyword indexes
Josh Zeidner writes: > OK. Is it possible to query keyword indexes for several keywords at once? Not that I know of. You either have to extend ZCatalog or wait some time. There are different people working on ZCatalog enhancements. >Again, I am reporting a bug You already know the Collector? It is Zope's bug tracking system. You find it via zope.org. Its old URL has been URL:http://classic.zope.org:8080/Collector but this might have changed after the recent changes on zope.org. I have had very good response to Collector bug reports for Zope itself. At least in the past, bug reports and even patches for ZCatalog probably have been ignored, however. I hope, this has changed meanwhile. By the way: * What does "unpredictable results" mean? Dieter PS: I have just blocked mail from "hotmail.com" (and "excite.com") because I got an increasing number of bulk email ad's with a faked "from: [EMAIL PROTECTED]" header. This means: I will no longer see direct messages from you, only your Zope mailing list messages which reach me with a delay of up to one day. ___ 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 )