RE: [Zope-dev] Zope and python namespaces
> > I wrote an external method that uses Graphite, Sping and PIL to > > generate charts, but I ran into some namespace problems. Execution > > of the external method fails because there is a clash in the namespace > > between PIL and Zope. PIL has a module "ImageFile" and Zope does as > > well. Evenif I insert PIL's path explicitly as the > first entry in > > the path, Zope's ImageFile is still being used. > > > > How can I resolve this and what is the best strategy to avoid namespace > > problems here? > Use Pythons package feature, i.e. use > > import PIL > > PIL.ImageFile I don't import ImageFile directly - it's imported by dependant PIL modules and in all cases the Package is explicitly mentioned: from PIL import ImageFile Roché ___ 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 and python namespaces
I wrote an external method that uses Graphite, Sping and PIL to generate charts, but I ran into some namespace problems. Execution of the external method fails because there is a clash in the namespace between PIL and Zope. PIL has a module "ImageFile" and Zope does as well. Even if I insert PIL's path explicitly as the first entry in the path, Zope's ImageFile is still being used. How can I resolve this and what is the best strategy to avoid namespace problems here? Roché ___ 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] ZPatterns Design Issue
I generally follow this approach for long lists and reports, but the tree tag is a bit more tricky because you only have a simple "data" object without the context that a real object provides. A real object makes it a lot simpler if you recursively draw a hierarchy - doing it with simple "data" objects requires some thinking but thanks for pointing me in the right direction. Roché > Just return the result directly. If the data is all from SQL, that's all > you need to do. The catch is that you may have to structure your ZClass > differently to allow it to be returned from an SQL method. > > The simplest thing, though, is to define your application API's so that > methods which must return multiple objects in this fashion are returning > sequences of simple "data" objects which do not provide the full > semantics > of the real objects. In essence, define the API as returning "reporting > data" rather than objects. This is similar to the ZCatalog > approach which > returns dumb record objects, but can optionally retrieve the real > object if > needed. It is generally the best approach for report-like > situations (such > as use of the tree tag). > ___ 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] ZPatterns Design Issue
How do you bind a SQL Result with multiple records with multiple instances of the class? Can you do this in Skinscript? Or do you mean I should return the sql result directly? Roché > Why don't you just have the rack's getChildrenFor() method return > instances > of the correct class, with all the data filled in from the SQL > method? There should be no need to re-retrieve the same items with > getItem(). Note, by the way, that this does not violate encapsulation, > since the specialist and racks are specifically the place to put > implementation-specific versions of multi-object methods like this. > > (Btw, if anybody's compiling a ZPatterns FAQ, this should probably get in > there.) > ___ 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] ZPatterns Design Issue
Hi Everybody We are porting a desktop application to Zope using Interbase and ZPatterns. In this application objects like Vintage, Farm, Vineyard, Block and Panel form a hierarchy and are displayed with the Zope tree widget. To build the hierarchy we use a method called getChildrenFor() on each level to retrieve the children for the object at hand. Behind getChildrenFor() lies a ZSQL Method on their respective racks to retrieve the result set. Building the tree leads to a whole bunch of queries to the database that really slows thing down ie. besides the queries that retrieve children, select queries to retrieve individual instances is called by getItem through SkinScript for each item in the tree. I haven't been able to figure out a way to get some performance back without talking to the database directly through ZSQL Methods but this defies the whole point of using ZPatterns. Some guidance/pointers would really be appreciated. Roché ___ 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] ZPatterns: getItem returns None
> Seems like the first element of the list of result objects returned by > sqlGetAllotmentArea doesn't define anything called 'AllotmentArea_ID'. > Could it be a case problem? What datbase/db_adaptor are you using? It is a case problem, which really surprised me because Interbase is not case sensitive. I feel a bit stupid for not having considered this as a possible problem but for anybody using the Gvib Interbase DA, note that column names are capatilized in results. Dammit stupidity can waste a lot of time. Thanks for pointing out the obvious. Roché ___ 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] ZPatterns: getItem returns None
> On Mon, 19 Mar 2001, Roch'e Compaan wrote: > > In all simplicity I still can't get it to work but here's some more info > > from the console: > > > > Traceback (innermost last): > > File > > C:\PROGRA~1\ZOPE230\lib\python\Products\ZPatterns\AttributeProviders.py, > > line 335, in _AttributeFor > > (Object: GAPMixin) > > File C:\PROGRA~1\ZOPE230\lib\python\Products\ZPatterns\Expressions.py, > > line 13 > > 6, in eval > > KeyError: AllotmentArea_ID > > If I knew more about the internals of ZPatterns I bet this would tell me > exactly what's wrong, but I don't, so it doesn't. Have you looked at > the information screen that tells you which attributes are handled by > which providers to make sure it is your skinscript that is providing the > attribute? To my limited knowledge it looks like maybe the wrong > attribute A single line of SkinScript acts as the "Getter" for AllotmentArea_ID: WITH QUERY sqlGetAllotmentArea(AllotmentArea_ID=self.id) COMPUTE AllotmentArea_ID, AreaName, AreaCode There are no persistent attribute or sheet providers - I deleted all of them and the proxy role for the SkinScript is set to manager. I fired up the python debugger as well and it seems if and "instance" is retrieved but the attribute is not computed as specified by the SkinScript. > provider is getting into the act. Hopefully someone with more knowledge > than me will chime in . We'll thanks for your pointers anyway. Roché ___ 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] ZPatterns: getItem returns None
> In my experience, getItem will return None if *anything* goes wrong > with data retieval or object creation. Sometimes you get a traceback in > the STUPID_LOG, and sometimes you don't (and I haven't figured out the > pattern yet). Test everything you can independently, and simplify > everything to the bare minimum until you get it to work, and then > add back the other variables, etc. In all simplicity I still can't get it to work but here's some more info from the console: Traceback (innermost last): File C:\PROGRA~1\ZOPE230\lib\python\Products\ZPatterns\AttributeProviders.py, line 335, in _AttributeFor (Object: GAPMixin) File C:\PROGRA~1\ZOPE230\lib\python\Products\ZPatterns\Expressions.py, line 13 6, in eval KeyError: AllotmentArea_ID Roché ___ 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] ZPatterns: getItem returns None
I think I've read everything on the mailing lists on this issue, but have found no joy. I have a ZClass derived dataskin called AllotmentArea matching a table with the same name in my SQL RDBMS. I have a Specialist called AllotmentAreas with storage set to the AllotmentArea ZClass and load attribute set to "AllotmentArea_ID" and this property does not exist on the ZClass propertysheet. When I call getItem() on the specialist, it returns None. SkinScript for retrieval: WITH QUERY sqlGetAllotmentArea(AllotmentArea_ID = self.id) COMPUTE AllotmentArea_ID, AreaName, AreaCode Note: The Proxy Role for the SkinScript is set to Manager. sqlGetAllotmentArea: Select * from AllotmentArea where AllotmentArea_ID = Roché ___ 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] Specialists and __bobo_traverse__
> Phillip J. Eby wrote: > > > I'm pretty sure DTML methods *won't* work. "Python Methods" > > might. I don't know about external methods, python scripts, etc. > > > I have successfully used PythonScripts for this. Did you have to do anything special in setting up rights for your traversal method. I get: Unauthorized: You are not authorized to access traversal_method. Roché ___ 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] Specialists and __bobo_traverse__
> Phillip J. Eby wrote: > > > I'm pretty sure DTML methods *won't* work. "Python Methods" > > might. I don't know about external methods, python scripts, etc. > > > I have successfully used PythonScripts for this. Does this mean I have to upgrade to 2.3 beta 1, because Python Methods on 2.2.4 doesn't work? Roché ___ 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] Specialists and __bobo_traverse__
> I don't have the slightest idea what you're trying to accomplish here - I > probably missed the beginning of this thread. Do you want to change the > way the specialist processes the string "dataskin1", or the way dataskin1 > processes the URL component that comes next? Each requires a different > approach. I want to process the way dataskin1 processes the URL component that comes next. Just to make sure I communicate some sense :) Roché ___ 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] Specialists and __bobo_traverse__
> It sounds to me like you're trying to have SkinScript supply a > bobo_traverse for the Specialist itself, and this you cannot do. (There > are other ways to change a Specialist's bobo_traverse behavior, but > SkinScript is not one of them.) The SkinScript you're doing is meaningful > only if you want to go to specialist/skin1/something, in which case your > traversal_method should be called to process "something". This is exactly what I want to do ie. process "something". > I don't have the slightest idea what you're trying to accomplish here - I > probably missed the beginning of this thread. Do you want to change the > way the specialist processes the string "dataskin1", or the way dataskin1 > processes the URL component that comes next? Each requires a different > approach. The best way to describe this is with an example I suppose. I have a specialist "Products" and nested within "Products" is another specialist "Modules". The current status quo: I go to a Product dataskin with a url like Products/. I go to a Module dataskin with a url like Products/Modules/ Where I want to be: The url to the Product dataskin stays the same. I go to a Module dataskin with url like Products// As I see it the is like the "something" you mentioned above. The module dataskin would obviously not be found by the Products specialist, and in that case I simply want to tell it to go look in the Modules specialist for the module. I hope this makes more sense, if not I'll be glad to explain more. Many thanks Roché ___ 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] Specialists and __bobo_traverse__
I'm still lost as to when __bobo_traverse__ is checked for object traversal and when not. I have very simple piece of SkinScript: WITH SELF COMPUTE __bobo_traverse__ = traversal_method. Looking at the traverse method in BaseRequest.py it looks to me as if an object is always checked if it has a __bobo_traverse__ method but this is not what is happening. If I manually type in a url, say path.to.specialist/dataskin1, where dataskin1 exists, my traversal_method is not called. When I type in path.to.specialist/dataskin2, where dataskin2 does not exist then my traversal_method is called. Noticing that the traversal_method is called when an object can not be found I tried path.to.specialist/dataskin1/dataskin2, where dataskin1 is in the specialist's rack but dataskin2 is in another specialist's rack and will therefor not be found. In this case my traversal_method was not called. If it was then I could retrieve it from the appropriate specialist. I hope the above is clear because I'm somewhat desperate at the moment. If I'm trying the impossible, a simple "forget about it" will also do. Roché ___ 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] Specialists and __bobo_traverse__
> With your code below, and with a concrete example, can you say what you > want to happen, and what actually does happen? In my traversal_method I have one line that simply changes a property on the specialist to see if the method is actually called but it does not seem like the traversal_method is called at all. The skinscript I use (as said in my previous mail) is: WITH SELF COMPUTE __bobo_traverse__=traversal_method Roché ___ 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] Specialists and __bobo_traverse__
> With your code below, and with a concrete example, can you say what you > want to happen, and what actually does happen? > > Thus results in a url like this: > > /RequestTypes//Task Templates/ > instance>, > > and what I ideally want is: > > /RequestTypes//. Let's say I have a RequestType called "Evaluation of Product". For this request type I create Task Templates called "Record Customer Details" and "Ship Product to Customer". If I go to the Request Type "Evaluation of Product" the url is: path.to.requestypes/evaluation_of_product. This gives me the detail of the request type as well as the list of task templates relating to this request type. If I now follow the link to the task template "Record Customer Details", I simply want to click on a url that says path.to.requesttypes/evaluation_of_product/record_customer_details and do not explicitly want to go the TaskTemplates with path.to.requesttypes/evaluation_of_product/TaskTemplates/record_customer_det ails. In other words, my traversal_method for the RequestTypes specialist should first seek the object on it's own rack and if it can not find it is should ask the nested TaskTemplates specialist for the object. Roché ___ 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] Specialists and __bobo_traverse__
Recent sightings of the use of __bobo_traverse__ in SkinScript gave me hope of giving users a more useable breadcrumbs trail in the case where I have nested specialists. My TaskTemplates specialist is nested inside my RequestTypes specialist. When I retrieve a dataskin from the RequestTypes specialist I have a tab that lists TaskTemplates for that RequestType specialist. Following a link from the TaskTemplate list takes you to that instance. Thus results in a url like this: /RequestTypes//Task Templates/, and what I ideally want is: /RequestTypes//. I read all the comments about __bobo_traverse__ and created a python method, "traversal_method" inside the "RequestTypes" specialists. I must admit that I don't really understand Zope's traversal machinery yet and would appreciate some guidance. My SkinScript for RequestTypes: WITH SELF COMPUTE __bobo_traverse_=traversal_method My traversal_method: ob = getattr(self, name) if ob is not None: return ob else: ob = self.TaskTemplates.getItem(name) if ob is not None: return ob raise 'NotFound' Any help would be greatly appreciated. Roché ___ 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] ZPatterns and ZClass Views
I was wondering to what extent people using ZPatterns find the Views one can set up for a ZClass tolerant of the Role-centric approach followed by ZPatterns. For example: I have two Specialists, DocumentedProducts and Products. The Products specialist manages ZClasses of type 'Product'. Products are remapped to DocumentedProducts (where product plays the role of documented product). Typically in Zope, ZClass Views has bearing on a single Zope Object and Views are filtered according to User Roles, thus the focus is security. ZPatterns makes it possible to extend the roles an object has. Ideally the Views in a ZPatterns Application framework would be security AND role (the role the object plays) focused ie. when I look at a Product instance where it plays the role of documented product, I might have the views FAQs, HOWTOs, etc. But when I look at a Product inside the Products specialist I want the views Properties, Associated Files, etc. I like the idea of making the Views of a ZClass my starting point because at least it already filters according to the role a user might have. Any other ideas/comments? Roché ___ 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] External method
This is not a strictly zope related question but it is zopeish :) In an external method I need to call an executable and capture the output it generates. This executable however needs to connect to a running X Server. I used the popen2 command but it returns with the obvious error : "theprogram : cannot connect to X Server". So how does one tell a program to attach to a X server? Any help would truly delight me Roché ___ 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] ZPatterns: General Design Question
>However, if your application needs to have end-user (as opposed to integrator-user) What is a integrator-user? > There is also an option "c", which would be to model > LicensePropertyDefinition and LicenseProperty objects in your > domain model. > This approach leads to a bit more work defining your model, as well as in > setting up the specialists and their interactions, but the payoff is in > better documentation of what your app is doing and easier re-mapping from > one database type to another. Just to check if I understand correctly - will this result in a LicenseType instance with related LicensePropertyDefinition instances. If a new License of a particular LicenseType is created LicenseProperty instances will be created based on the LicensePropertyDefinitions of the selected LicenseType. Many thanks Phillip Roché ___ 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] ZPatterns: General Design Question
As part of a Customer Relationship Management system our company is developing, we have a Licenses specialist which manages product licenses. All license objects do not have the same attributes however. The various attributes relating to different licence types are not known attributes from the outset. My idea is to have a LicenseType class for which the user can define extra attributes per instance eg: LicenseType1 with properties A,B,C LicenseType2 with properties D,E,F When new licenses are created the user first selects a LicenseType. Based on this selection the properties of the selected LicenseType are added to a specific License instance. As I see it one can take two approaches to this: a) either add a single dictionary property for both license and licensetypes which holds user defined attributes or b) explicityly call manage_addProperty per instance to add properties. Any ideas? Roché ___ 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] FW: ZPatterns, ObjectDomain, UML and all that.....
> If you want to store one DataSkin inside another, where either one of them > is stored in a Rack, you will have to create appropriate SkinScript or > custom attribute providers to do so. But what if I always store dataskins in there own racks but simply assign an attribute of one Dataskin to the instance of another Dataskin? I simply want to be able to say Customer.Address.Street... > > > >PS: I checked Rack.py: > > > >CreateItem call _RawItem and in _RawItem the Rack for that instance is set: > > item._setRack(Self) # Connect to Rack > > > >I might be wrong but after a quick look at the attributehandling code in > >Dataskins.py suggests that the Dataskin does not know who its datamanager > >is. > > Yes, it does. _setRack() is called whenever a DataSkin is retrieved from a I meant to say "it DOES know" - but I do NOT :) Roché ___ 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] ZPatterns: Still Properties that are objects
I use external methods to set properties that are objects for my Dataskins. I have a Customer Dataskin with a property Address. Address is another Dataskin. In my editInstance for Customer I change the properties of Address directly: but this results into a keyError afters a couple of edits ie. it works SOMETIMES but not all the time. Roché ___ 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] Mail and zope
> > Is there anyway to get a hold off the message-id of e-mail sent through > > the sendmail tag? > > As far as I can see, there isn't any generation of a message-id in the > MailHost product. > [snip] Thanks for the suggestion, this is what I'm trying to do: We're building a customer relationship management system and one part of it is a request tracking system. For a particular request there can be many tasks assigned to various supporters. A supporter can give feedback to customer from a task assigned to him. If the customer replies to this task via e-mail I want to associate that message with the task where the feedback originated from but most e-mail clients discard custom headers but preserve a 'In-Reply-To' header with the original message-id. This is what I do currently: If the supporter sends feedback to the customer I send a copy of the mail back into zope to get the message-id generated by the MTA and then store the message with the approriate task. When the customer replies to this message I search a catalog for the original message-id via the 'In-Reply-To' header and then associate the reply with the correct task. In this way one can keep track of all correspondence on a specific task. If I can generate the message-id like you suggested then I don't have to send a copy of the message back into zope but can save a copy directly in Zope. Any other suggestions would be more than welcome. Roché ___ 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] Mail and zope
Is there anyway to get a hold off the message-id of e-mail sent through the sendmail tag? Roché ___ 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] Method calls
All apologies, I was looking at the wrong "dtml-in". It must be me choking on the workload :) roché >OK.. it's the 'in' tag that's causing the problem. Why not try: > > > > and see what 'in' is choking on... ___ 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] ZPatterns: Properties that are objects
I use external methods to set properties that are objects for my Dataskins. I have a Customer Dataskin with a property Address, that is another Dataskin. In my editInstance for Customer I change the properties of Address directly: but this results into a keyError afters a couple of edits. When I get the Address directly from the Rack it works fine: Why does the "simple" way of doing not work consistently? Is this a bug, maybe? Roché ___ 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] Method calls
>OK.. it's the 'in' tag that's causing the problem. Why not try: > > > > and see what 'in' is choking on... It's choking on a list of instances. This is what is returned when I "var" the expression: [, , , ] ___ 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] Method calls
Here's the whole traceback (i don't use hasattr in my code): Traceback (innermost last): File /usr/local/zope/2-2-2/lib/python/ZPublisher/Publish.py, line 222, in publish_module File /usr/local/zope/2-2-2/lib/python/ZPublisher/Publish.py, line 187, in publish File /usr/local/zope/2-2-2/lib/python/Zope/__init__.py, line 221, in zpublisher_exception_hook (Object: 10) File /usr/local/zope/2-2-2/lib/python/ZPublisher/Publish.py, line 171, in publish File /usr/local/zope/2-2-2/lib/python/ZPublisher/mapply.py, line 160, in mapply (Object: editLicenseForm) File /usr/local/zope/2-2-2/lib/python/ZPublisher/Publish.py, line 112, in call_object (Object: editLicenseForm) File /usr/local/zope/2-2-2/lib/python/OFS/DTMLMethod.py, line 172, in __call__ (Object: editLicenseForm) File /usr/local/zope/2-2-2/lib/python/DocumentTemplate/DT_String.py, line 528, in __call__ (Object: editLicenseForm) File /usr/local/zope/2-2-2/lib/python/DocumentTemplate/DT_Let.py, line 147, in render (Object: modList="Products.Modules.getModulesForProduct(this(), _, ProductID)") File /usr/local/zope/2-2-2/lib/python/DocumentTemplate/DT_In.py, line 691, in renderwob (Object: modList) File /usr/local/zope/2-2-2/lib/python/DocumentTemplate/DT_In.py, line 672, in renderwob (Object: Modules) File /usr/local/zope/2-2-2/lib/python/OFS/ObjectManager.py, line 601, in __getitem__ (Object: ProviderContainer) File /usr/local/zope/2-2-2/lib/python/OFS/ObjectManager.py, line 241, in _getOb (Object: ProviderContainer) TypeError: (see above) > Hi Roch, > >The whole traceback would be helpful.. one clue: > > Error Type: TypeError > Error Value: hasattr, argument 2: expected string, int found > > 'hasattr' is the function that is complaining do you use > it in your code? > > -steve > >>>>> "Roch'e" == Roch'e Compaan <[EMAIL PROTECTED]> writes: > > Roch'e> I have a method called getModulesForProduct to which I > Roch'e> pass a ProductID eg: Roch'e> "Products.Modules.getModulesForProduct(this(), _, > Roch'e> ProductID)" sort=name> > > Roch'e> If ProductID is passed on from a form variable it works > Roch'e> fine. > > Roch'e> If I set the ProductID through REQUEST.set: Roch'e> "REQUEST.set('ProductID',_.str(Product.id))"> , > > Roch'e> I get a TypeError: > > Roch'e> Error Type: TypeError Error Value: hasattr, argument 2: > Roch'e> expected string, int found > > Roch'e> I've been banging my head against this problem the whole > Roch'e> day so help would really be appreciated. > > Roch'e> Roché > > > > > > > Roch'e> ___ Zope-Dev > Roch'e> maillist - [EMAIL PROTECTED] > Roch'e> http://lists.zope.org/mailman/listinfo/zope-dev ** No > Roch'e> cross posts or HTML encoding! ** (Related lists - > Roch'e> http://lists.zope.org/mailman/listinfo/zope-announce > Roch'e> 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] Method calls
I have a method called getModulesForProduct to which I pass a ProductID eg: If ProductID is passed on from a form variable it works fine. If I set the ProductID through REQUEST.set: , I get a TypeError: Error Type: TypeError Error Value: hasattr, argument 2: expected string, int found I've been banging my head against this problem the whole day so help would really be appreciated. Roché ___ 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] ZPatterns: Methods of specialits
I have a specialist Contacts and for Contacts I have a method getAllContactsForCustomer. Whenever I want to call this method I have to pass on the whole namespace and the object itself to get it to work eg: getAllContactsForCustomer(this(), _, _.None). Why is this the case? And what does _.None actually mean? Roché ___ 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] ZPatters: Roles and remapping
An Organisation can play the role of Customer and of Requester. In this case the Requester specialist will remap from the Customer specialist. In terms of roles all Customers do not play the role of Requester. Would it be correct to say that the remapping to Requester only occurs at that point in time, when the Customer plays the role of Requester and therefor becomes a Requester, as opposed to mapping the Customer to a Requester as soon as the Customer is created? In the latter case the Customer's rack pushes attributes to the Requester's rack and in the former the requester will first ask the Customer specialist for all Customers and then create a Requester for the Customer selected from the list. The reason I ask this is: Remapping in some way implies that the existence of the one implies the existence of the other. This is one place where frameworks colloborate and I think that colloboration should be carefully exercised so any input would be greatly appreciated. Roché ___ 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] ZPatterns: Remapping object from on to another specialist
Another fuzzy freaky area for me: How will one implement the remapping of an object from on to another specialist? Say I have Requesters (Customer's with service requests) specialist that I want to map to Customers Should I still set up a rack and set it's storage to the Customer ZClass and add a skinscript method to copy attributes from the Customer specialist? or Should I simply write a method for Requester, getRequester, which asks the Customers specialist for a Customer. Another question: If I pass an attribute that is not registered with any attributeproviders in a manage_changeProperties call to the object's propertysheet, will that attribute automatically be added on top of the object? Should one explicitly call manage_addProperty? Roché ___ 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] ZPatterns: Dataskin property sheets
I'm not as clear as I'd like to be on when to use Dataskin property sheets and when to use common instance property sheets. I understand that with a Dataskin Property Sheet attributes are stored in way that is compatible with attribute providers making overriding of default values possible. If this is the case shouldn't one always use a Dataskin Property Sheet to retain this flexability. Roché ___ 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: RFC : ZPatterns Customer Relationship Management Framework
Thanks for your comments on our model Philip, it is really appreciated and very enlightening. >From your comments some other questions came to mind (I posted this on the Wiki as well): It seems that we did not give enough consideration for the pattern, Roles Before Objects but we can retrofit this pattern to our existing design without to much trouble. The area where I need more guidance is on the ability of a specialist to add attributes on top of objects. Thinking out load: Objects might have different attributes depending on the roles they play in various application frameworks. Specialists make it possible to add these attributes through AttributeProviders. One might create a Person ZClass with properties Name, Surname, Age. When the Person plays the role of Customer we will create a Customers specialist for that role providing us with services relevant to dealing with Customers. Let's say for now that the properties defined on our ZClass propertysheet for Person suffices for the Customer role. Our Person object also plays the role of Requester in our Requesters specialist. For this role we need an extra attribute, Priority. The Requesters specialist will ask the Customers specialist for properties Name, Surname and Age but will store the attribute Priority in it's own rack. For storage in the ZODB this will imply that the extra attributes will be stored persisently in the slots of the Requester. For non-ZODB storage like a SQL RDB one will have to add a table to the RDB. Roché ___ 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] RFC : ZPatterns Customer Relationship Management Framework
Thanks a lot for all the guidance on ZPatterns so far. Our company is building a Customer Relationship Management system using ZOPE and ZPatterns. We have a object model and basic Dataskins and Specialists in place. At this point we thought it a good idea to share the object model with the Zope community and invite comments since we will be giving it back to the Zope community. Go to http://www.zope.org/Members/sparroy/CRM to download a pdf of the model and make some comments. Roché ___ 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] ZPatterns: Non-ZODB storage and Racks
> It's determined by the radio button setting on the Storage tab. If you > neglected to set it to "loaded by accessing attribute " and > fill in the > blank, then your objects have been stored in the ZODB, as well as in the > RDBMS. > Thanks. I set "loaded by accessing attribute" to the attribute "id". Storing items in the RDBMS works fine. But when I try to retrieve them with getPersistentItemIDs() nothing is returned? I have a skinsript method getCustomer: WITH getCustomerSQL(CUSTOMER_ID=self.id) COMPUTE id=CUSTOMER_ID, name=NAME and getCustomerSQL is a SQL method. Roché ___ 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] ZPatterns: Non-ZODB storage and Racks
> I'm not sure I understand your question. If you don't have something > special you want to do by subclassing Rack, then the answer would be > "no". :) You do answer my question below. I was wondering if this line would not cause an object to be stored in the ZODB by default. > > The comment is perhaps misleading. What it means is that the _setSlot > call isn't needed if your Rack implements a non-ZODB storage mechanism. > The reason *why* it isn't needed, is that the DataSkin will ask for a > slot on demand, so that a ZODB record is only created if something needs > to be stored persistently. However, in the case where you have not set > a "load" attribute (i.e., you are storing actual objects in the ZODB), > then one might as well tell the object its slot, because the slot is > where the object itself is going to be stored. Technically, the > _setSlot call isn't necessary even then, because the DataSkin could > still ask for it on demand. > However, since the code at this point has gone to the trouble of > getting > the slot object, it might as well pass it to the DataSkin immediately. Here I loose you. What does "setting the load attribute" mean? I did manage to store objects in a SQL RDBMS through some skinscript methods that call sql methods. I assumed selecting a ZClass on the storage tab simply informs the ZClass what it's rack is. I couldn't verify if these objects were stored in the ZODB as well as in my RDBMS. Besides writing some skinscript and sql methods is there anything else one should do to only use non-ZODB storage. When will I use attribute and sheetproviders and do they come into play at all with non-ZODB storage. Roché ___ 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] Objects that are properties
>This is a known problem. Use: > > > > > > > Now you have the required itemIDs in itemIDs. > > Thanks Steve and thank you Phillip for ZPatterns. I've managed to create a very basic framework storing attributes in the ZODB and in a SQL RDBMS. I'm elated. This is the way to write applications, IMHO. A couple of things are still unclear but I at least feel that I can create now. Roché ___ 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] ZPatterns: Non-ZODB storage and Racks
In Rack.py I noticed the following: a = self.loadAttrib if not a: slot = self._writeableSlot(key) slot[SelfKey] = item.aq_base# strip acquisition wrapping item._setSlot(slot) # Not needed for non-ZODB storage If item._setSlot set is not needed for non-ZODB storage should I subclass rack and override createItem? Roché ___ 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] Objects that are properties
I have a Customer and Address ZClasses based on Dataskin as well as a CustomerManager specialist. The Customer ZClass has a external method setAddress: def setAddress(self, Address) self.Address = Address CustomerManager has a defaultRack and addressRack. The methods that adds the instance contains this: and it seems to work fine. Then to retrieve the Customer addresses I call: but there seems to be a problem with permissions because Zope prompts me for username and password although i'm already working in the management interface. Roché ___ 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] ZPatterns and Properties that are objects
On the Road: I created a couple of ZClasses based on Dataskin. In the way I grok ZOPE, properties that are objects can not go onto property sheets. So if I have a Customer ZClass that has a property Address (a property that is an object) then I would create the address object as a "method" of the Customer that makes references like Customer.Address.Street possible. To achieve this without ZPatterns I would base my ZClass on a objectmanager so that I can create an instance of an Address object within Customer. So how does one do this with ZPatterns. In one posting I picked up that one does not have much joy with ZPatterns and the ObjectManger base class? Roché ___ 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] It's been a while
> DataSkins are for PD and UI classes. It's usually simplest to combine PD > and UI, and as long as you ensure that UI methods call PD methods, not the > other way around, then it works fine. Thanks Philip, simple divide with great effect on my understanding and thanks Steve for the links. My Roadmap then: 1.For my Problem Domain objects, I create ZClasses (with Dataskin as base class) with normal/dataskin? propertysheets 2.Then I delegate data management for my ZClasses to specialists: - Create specialists for my Dataskins - Select the ZClass under storage tab of relevant rack - Add Skinscript methods which store and retrieve properties in RDBMS, delete & insert objects into RDBMS. Is this right? ___ 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] It's been a while
It's been a while since i've had time to explore ZPatterns - and now the time has come that I am considering to base development for a new project on ZPatterns. I think I'm better prepared now - I read Coad's Object Models, and implemented a data management layer in Delphi. The project envolves Customer Relationship Management - like openticket, but I don't like openticket's tight coupling with the SQL databases. First stupid question: Are ZClasses based on Dataskins PD (Problem Domain) objects or DM (Data Management) objects? Can somebody possible categorize the main classes in ZPatterns according to Problem Domain, User Interface, Data Management? Would it be safe to base development on ZPatterns if I want to use an SQL RDBMS as storage and ZPatterns as DataManagement layer ie. is ZPatterns stable engough? Roché ___ 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] ZODB
I am getting really funny problems with my Zope installation and I have no idea where to start looking. I for instance deleted a python product from the Products directory and when I start Zope the product is still listed in the Product list. I then packed the ZODB, cleared my Browser's cache, and refreshed the Product List but still the product is visible. I can however delete the python product (which is by the way not in my Products directory) from the Control Panel. Somewhere something is cached and I don't know where. It seems to cache errors as well and they stick. A reinstallation fixed this problem, but now it seems more fundamental. I've come accross this odd caching behaviour again after reinstall and can't reinstall every time this happens. I run Zope 2.2.2 behind Apache 1.3.9 and do virtualhosting with the ProxyPass directive. Please help!! Roché ___ 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 )