[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 do it?

Greetings Roman
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] context in fs product

2006-02-20 Thread Andreas Jung



--On 20. Februar 2006 09:36:25 +0100 Roman Klesel 
[EMAIL PROTECTED] wrote:




Of course I can try to construct it from self.REQUEST, but ... is this
_THE_ way to do it?


'self' inside the a Zope product is the _same_ as 'context' or 'here' within
ZPT or PythonScripts.

-aj

pgp0N2XZfxmVw.pgp
Description: PGP signature
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


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 it , it returns the base URL of the product instance 
...

All classes in the product subclass form Acquisition.Implicit. What am I 
missing here?

Thanks so far!

Roman


___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] context in fs product

2006-02-20 Thread Andrew Milton
+---[ Roman Klesel ]--
| Lennart Regebro schrieb:
|   It's usually called self...
| 

I missed the start of this thread...

| 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

self.absolute_url()

You shouldn't need to pass self in.

| and on whatever URL I call it , it returns the base URL of the product 
instance ...
| 
| All classes in the product subclass form Acquisition.Implicit. What am I 
missing here?
| 
| Thanks so far!

Is it set inside the ZODB yet?

-- 
Andrew Milton
[EMAIL PROTECTED]
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


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 problem in a 
different way.

Thanks
Roman




___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] context in fs product

2006-02-20 Thread Lennart Regebro
On 2/20/06, Roman Klesel [EMAIL PROTECTED] wrote:
 Therefore my testcase is useless and I've to investigate my problem in a 
 different way.

Ah.

Read this: http://www.catb.org/~esr/faqs/smart-questions.html

Especially: Be precise and informative about your problem and
Describe the problem's symptoms, not your guesses.

--
Lennart Regebro, Nuxeo http://www.nuxeo.com/
CPS Content Management http://www.cps-project.org/
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )