Re: [Zope] Acquisition not working as expected

2006-03-03 Thread Roman Klesel
Andrew Milton schrieb: Perhaps if you describe the problem you're trying to solve, we can actually help you. Yes, thank you! I just want to be able to do what I'm used to do from TTW: - There is a hirarchy of Folder/File objects - In the root directory there is an python script

Re: [Zope] Acquisition not working as expected

2006-03-03 Thread Roman Klesel
Andrew Milton schrieb: | ul | li tal:repeat=elem context/objectValues | img tal:attributes=src string: ${elem/absolute_url}/genGraph plot /img | /li | ul In what way doesn't this work? I've certainly used this pattern in my FS products without problems. Hmm? Did I miss something?

Re: [Zope] Acquisition not working as expected

2006-03-03 Thread Roman Klesel
that this is somehow evil. From a previous thread: Roman Klesel wrote: form OFS.Image import File - I build a class _File(File): I really doubt you need to do that... - pimped it up a little bit. What, specifically, did you add? - _setObject'ed it You shouldn't be calling that directly... If you CAN'T

Re: [Zope] Acquisition not working as expected

2006-03-02 Thread Roman Klesel
Hello, Roman Klesel schrieb: I can call this method on whatever folder inside the product instance I want, it will always return the id of the product and not the id of the product I call it on. In order to make my problem more obvious I created a minimal product. See attachmet

[Zope] Acquisition not working as expected

2006-03-01 Thread Roman Klesel
Hello, sorry to come up with this again. I startet 2 pretty confused threads on the same problem allready: [Zope] Error Value: 'File' object has no attribute 'manage_fixupOwnershipAfterAdd' Re: [Zope] context in fs product Unfortunatly I'm still not getting it right. I

Re: [Zope] Acquisition not working as expected

2006-03-01 Thread Roman Klesel
Hello Andrew, Andrew Milton schrieb: Are you sure your genId() method works? Well, yes, it does what it's ment to do. It generates an id, a string. Here it is: def genId(self,context): asdf items = [ int(e[2:]) for e in context.objectIds('Folder') ]

Re: [Zope] Acquisition not working as expected

2006-03-01 Thread Roman Klesel
Andrew Milton schrieb: Did you paste this code, because it has errors... Ahh sorry, I missed the last charakter, a ). Here it is again: def genId(self,context): asdf items = [ int(e[2:]) for e in context.objectIds('Folder') ] if items ==

Re: [Zope] Acquisition not working as expected

2006-03-01 Thread Roman Klesel
Dieter Maurer schrieb: I can call this method on whatever folder inside the product instance I want, it will always return the id of the product and not the id of the product I call it on. I fear you will need to more clearly describe what you mean with the product (on one hand) and the

[Zope] context in fs product

2006-02-20 Thread Roman Klesel
Hello, from doing TTW I'm used to call methods on the object that is passed in by the context variable. I'm just writing my first fs based product and was wondering how I can get context from within a method? Of course I can try to construct it from self.REQUEST, but ... is this _THE_ way to

Re: [Zope] context in fs product

2006-02-20 Thread Roman Klesel
Lennart Regebro schrieb: It's usually called self... hmmm ... strange ... in a class: class Controller(Implicit,ObjectManager, SimpleItem): asfd I have a method: def testspace(self,REQUEST=None): tests req = self.absolute_url(self) return req and on whatever URL I call

Re: [Zope] context in fs product

2006-02-20 Thread Roman Klesel
Hello, Andrew Milton schrieb: | Thanks so far! Is it set inside the ZODB yet? *bling* yes, that kicked me out of the mental loop. As you suggested this test class is not in ZODB and therefore the aquisition does not work. Therefore my testcase is useless and I've to investigate my

Re: [Zope] Error Value: 'File' object has no attribute 'manage_fixupOwnershipAfterAdd'

2006-02-20 Thread Roman Klesel
Chris Withers schrieb: for id in self.manage_targets.keys(): title = self.manage_targets[id]['name'] self.tgt_folder=Folder() This is dangerous... Why is that? self._setObject(id,self.tgt_folder)

Re: [Zope] Error Value: 'File' object has no attribute 'manage_fixupOwnershipAfterAdd'

2006-02-20 Thread Roman Klesel
Hello Sascha, Sascha Welter schrieb: manage_addFile (and some others like manage_addFolder, ...) work directly without xy.manage_addProduct[...]. That part is in the Zope book. The syntax with manage_addProduct[... is used for filesystem based products (like the stuff you have in your

Re: [Zope] Error Value: 'File' object has no attribute 'manage_fixupOwnershipAfterAdd'

2006-02-16 Thread Roman Klesel
Hello, Jens Vagelpohl schrieb: If that object subclasses from the normal Zope Folder class (or is a Zope Folder) you *will* have manage_addProduct. Yes, actually you guys a right! self.manage_addProduct is available... Hmmm ... wonder what made me think it's not ... Still I can't get what

Re: [Zope] Error Value: 'File' object has no attribute 'manage_fixupOwnershipAfterAdd'

2006-02-16 Thread Roman Klesel
Hello, one more thing ... Roman Klesel schrieb: Your error *may* mean that 'system' is not yet wrapped. Are your positive that 'system' is a folder that already exists in the ZODB, i.e. has already been _setObject'ed? As far as I can tell: Yes! Actually I'm pretty shure, because as I

Re: [Zope] Error Value: 'File' object has no attribute 'manage_fixupOwnershipAfterAdd'

2006-02-16 Thread Roman Klesel
Hello again, I works! I just managed to get everything as I expected it to be. How I did it: form OFS.Image import File - I build a class _File(File): - pimped it up a little bit. - instatiated it - _setObject'ed it ... et voila I have nice File-objects with nice CMI interface... Thanks for

[Zope] How to get $PRODUCT_HOME

2006-02-07 Thread Roman Klesel
Hello again, I just started with FS products and have trouble to figure some things out ... From within zope I would like to call scripts that I provide in the product folder on the file system like eg.: handle = os.popen('gnuplot %s/bin/loadgraphs.gplt' % product_folder, 'r') How can I get

Re: [Zope] How to get $PRODUCT_HOME

2006-02-07 Thread Roman Klesel
Hello Andrew, Andrew Milton schrieb: | | How can I get the path to the product folder? from Globals import package_home package_home(globals()) should give you what you need. yes this does the trick! Thanks! Greetings Roman ___ Zope

Re: [Zope] How to get $PRODUCT_HOME

2006-02-07 Thread Roman Klesel
Hi Tino, Tino Wildenhain schrieb: How can I get the path to the product folder? Thanks in advance! see the __file__ variable in your module. for example via: os.path.dirname(os.path.abspath(__file__)) you get the absolute path of the directory where your module is. Complete it

[Zope] inheritance and aqusition question

2006-02-03 Thread Roman Klesel
Hello, im just learning zope and python and find it difficult to get the details of aquisition and inheritance. I have the following problem: (FS product) My base class has an attribute manage_editSettingsForm In its __init__ method I instantiate a contoller class. In the methods of the

Re: [Zope] inheritance and aqusition question

2006-02-03 Thread Roman Klesel
Hello Andrew, thanks for your reply. Andrew Milton schrieb: One (or more) of the following two; Your class isn't yet fully instantiated and Acquisition wrapped, this normally doesn't occur until your class is inside the ZODB. That's true! And it's nor supposed to be. It's only a

Re: [Zope] Newbee interfaces and implementations

2006-01-19 Thread Roman Klesel
bruno modulix schrieb: So you recommend that I should just skip them as long as I'm on Zope2? Short answer : yes. Unless you plan to switch to Zope3 really soon, but then, I'd recommand that you skip Zope 2.x !-) No, I'll be with Zope2 for a while. I'm running an Plone site too and dont't

[Zope] Newbee interfaces and implementations

2006-01-18 Thread Roman Klesel
Hello, I'm in the process of learning to develop fs-zope-products. The developers guide recommends to write interfaces and implement them in classes. Now my question: When I have an interface: DoThings with several methods: doThis() doThat() doThattoo() ... and I have an implementation:

Re: [Zope] Newbee interfaces and implementations

2006-01-18 Thread Roman Klesel
bruno desthuilliers schrieb: Looks like you're newbie to OO too !-) A class defines a type. You then need to have an instance of that type (like, say, 42 is an instance of type integer and 'foo' is an instance of type string). Yes, true! :-) (Interfaces (I mean, 'explicit' interfaces)

[Zope] adding property to new Folder: can't pickle module objects

2005-08-30 Thread Roman Klesel
Hello everyone, again I'm stuck :-( I have a python script that looks as follows: results=[] for ids in context.objectIds('Folder'): results.append(ids) newid = str(int(max(results)) + 1) context.manage_addProduct['OFSP'].manage_addFolder(newid, title=person) newaddr=getattr(context,

[Zope] passing parameters from form to script

2005-08-29 Thread Roman Klesel
Hello everyone, I'm dynamically generate a form e.g like this: form action=paramtest method=post table class=normal tr valign=top align=left tal:repeat=item python:context.Templates.AddressTemplate.propertyIds() td tal:content=itembla/td tdinput type=text