[Zope3-Users] Configuring a package to use a file in buildout

2007-11-23 Thread Darryl Cousins
Hi,

I have a custom logger in a package registered with utility

zope:utility  factory=.logger.MyLogger name=logger /

In the code it sets itself a logfile to write to, up to now that has
been in a 'log' directory in the package itself.

Now I want to use a log file which is in the buildout of the
application. How could I go about finding that directory from python
code in the package?

The only route that I have come up with so far is to write a
meta:directive which I can use to register the logging utility with a
file path. Something like:

  meta:directive
  namespace=http://namespaces.zope.org/rdb;
  name=provideLogger
  schema=.zcml.IProvideLoggerDirective
  handler=.zcml.loggerhandler
  /

Which I could use like

  provideLogger component=.logger.MyLogger
 log=/path/to/log/file /

But there may be a better/easier way. Suggestions?

Regards,
Darryl

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] third try: containment

2007-11-23 Thread catonano

Hello zopers,

well this is my third try to ask a question, after the first two ones 
went totally ignored, in the last few days. The second one was quite 
simple: how do I instruct the ftp server to write some lines in the 
access log ?


Silence. How comes ? Did I hurt or piss off anyone ? If so, I'm 
sorry; I'm ready to apologize as soon as someone explains me what I got wrong.


Anyhow, here's my third try: I'm trying to learn the Zope 3 
architecture and costumes starting from the book example (the 
messageboard and the messages).


I created two example components: shelf and book. Of course, a shelf 
can contain books.


So far my components are NOT persistent. The do NOT inherit from 
Persistent nor they do implement some sort of persistence themselves. 
This is because I'm just trying to explore the containment stuff and 
I don't want to put in too many layers too early.


My shelf has no attribute, the only difference between it and the 
common folders (containers) is that shelf can contain books ONLY.


A book has 3 attributes: title, author, editor; it can be contained 
in a shelf only and it is NOT a container; it can't contain anything.


In the ZMI I see my components, I added a shelf and inside the shelf 
a book. So far, so good !


BUT, when in the book component, one of the views the ZMI offers is 
content, which, as far as I know, is referred to the containers 
contents and my book is NOT a container ! I swear ! It does NOT 
implement the IContainer interface or any descendant interface !


Still the ZMI offers to see the contents of it. If I click on the 
contents tab a white screen pops up telling my a system error 
occurred, and the output in the terminal shows a message about a 
forbidden attribute items called.


How is that ? The ZMI takes it correctly when it's about to add 
content to the shelf, proposing to add a book only, in the left bar, 
and also, inside the book component, there's no action add in the 
actions stripe. Still, there's the content tab in the views tabs !!


How is that ?

I'm on win XP and Zope 3.3.1

Thanks so much anyone for any hint !

Bye
Catonano


___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] third try: containment

2007-11-23 Thread Stephan Richter
On Friday 23 November 2007, catonano wrote:
 Hello zopers,

 well this is my third try to ask a question, after the first two ones
 went totally ignored, in the last few days. The second one was quite
 simple: how do I instruct the ftp server to write some lines in the
 access log ?

I think nobody has looked at FTP for a while, so the answer is not easily 
produced by anyone. You will have to read the code to see how it is done.

 Silence. How comes ? Did I hurt or piss off anyone ? If so, I'm
 sorry; I'm ready to apologize as soon as someone explains me what I got
 wrong.

Silence usually means that nobody knows the answer.

 So far my components are NOT persistent. The do NOT inherit from
 Persistent nor they do implement some sort of persistence themselves.
 This is because I'm just trying to explore the containment stuff and
 I don't want to put in too many layers too early.

Then you loose!

 BUT, when in the book component, one of the views the ZMI offers is
 content, which, as far as I know, is referred to the containers
 contents and my book is NOT a container ! I swear ! It does NOT
 implement the IContainer interface or any descendant interface !

Based on what follows, you are lying to us. ;-) As Roger suggested, try 
inspecting the object.

 Still the ZMI offers to see the contents of it. If I click on the
 contents tab a white screen pops up telling my a system error
 occurred, and the output in the terminal shows a message about a
 forbidden attribute items called.

This is because the system sees that the book is a container and tries to 
access attributes that have no security declaration/

 How is that ? The ZMI takes it correctly when it's about to add
 content to the shelf, proposing to add a book only, in the left bar,
 and also, inside the book component, there's no action add in the
 actions stripe. Still, there's the content tab in the views tabs !!


Regards,
Stephan
-- 
Stephan Richter
CBU Physics  Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


AW: [Zope3-Users] third try: containment

2007-11-23 Thread Roger Ineichen
Hi Catonano

 Betreff: [Zope3-Users] third try: containment
 
 Hello zopers,
 
 well this is my third try to ask a question, after the first 
 two ones went totally ignored, in the last few days. The 
 second one was quite
 simple: how do I instruct the ftp server to write some lines 
 in the access log ?
 
 Silence. How comes ? Did I hurt or piss off anyone ? If so, 
 I'm sorry; I'm ready to apologize as soon as someone explains 
 me what I got wrong.

Just try to write shorter mails and you will become more 
response, hopfully.

In general, we are to less people and all have to much work.
It's not your fault, just keep asking. Probably try the
IRC channel, zope3-dev at freenode.

 How is that ? The ZMI takes it correctly when it's about to 
 add content to the shelf, proposing to add a book only, in 
 the left bar, and also, inside the book component, there's no 
 action add in the actions stripe. Still, there's the 
 content tab in the views tabs !!
 
 How is that ?

I have not idea, but try to take a look at the
introspector.html view on the object. There you 
can see the interfaces and adapters. Probably this
will give you a hint about what's implemented and 
provided by what.

btw,
You have to set the dev mode flag in zope.conf e.g.
devmode = on

This will bring in the additional introspector.html
view if not allready there.

Hope that helps a little bit.

Regards
Roger Ineichen 

 I'm on win XP and Zope 3.3.1
 
 Thanks so much anyone for any hint !
 
 Bye
 Catonano
 
 
 ___
 Zope3-users mailing list
 Zope3-users@zope.org
 http://mail.zope.org/mailman/listinfo/zope3-users
 

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Re: Configuring a package to use a file in buildout

2007-11-23 Thread Darryl Cousins
Hi Jürgen,

Thanks! I'll try that out.

Darryl

On Fri, 2007-11-23 at 11:00 +0100, Jürgen Kartnaller wrote:
 In your buildout you do :
 
 [instance]
 recipe = zc.zope3recipes:instance
 application = app
 address = 8080
 zope.conf =
 
product-config my-config-name
  storagedir ${buildout:directory}/parts/log
/product-config
 
 
 If you need the log dir precreated you do :
 
 [extfiledir]
 recipe = lovely.recipe:mkdir
 path = parts/log
 
 
 To access the product config from python :
 
 from zope.app.appsetup.product import getProductConfiguration
 
 config = getProductConfiguration('my-config-name')
 if config is not None:
  path = config.get('logpath')
 
 
 Use your utility name as my-config-name.
 
 
 Jürgen
 
 Darryl Cousins wrote:
  Hi,
  
  I have a custom logger in a package registered with utility
  
  zope:utility  factory=.logger.MyLogger name=logger /
  
  In the code it sets itself a logfile to write to, up to now that has
  been in a 'log' directory in the package itself.
  
  Now I want to use a log file which is in the buildout of the
  application. How could I go about finding that directory from python
  code in the package?
  
  The only route that I have come up with so far is to write a
  meta:directive which I can use to register the logging utility with a
  file path. Something like:
  
meta:directive
namespace=http://namespaces.zope.org/rdb;
name=provideLogger
schema=.zcml.IProvideLoggerDirective
handler=.zcml.loggerhandler
/
  
  Which I could use like
  
provideLogger component=.logger.MyLogger
   log=/path/to/log/file /
  
  But there may be a better/easier way. Suggestions?
  
  Regards,
  Darryl
 
 ___
 Zope3-users mailing list
 Zope3-users@zope.org
 http://mail.zope.org/mailman/listinfo/zope3-users

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Re: Configuring a package to use a file in buildout

2007-11-23 Thread Jürgen Kartnaller


In your buildout you do :

[instance]
recipe = zc.zope3recipes:instance
application = app
address = 8080
zope.conf =

  product-config my-config-name
storagedir ${buildout:directory}/parts/log
  /product-config


If you need the log dir precreated you do :

[extfiledir]
recipe = lovely.recipe:mkdir
path = parts/log


To access the product config from python :

from zope.app.appsetup.product import getProductConfiguration

config = getProductConfiguration('my-config-name')
if config is not None:
path = config.get('logpath')


Use your utility name as my-config-name.


Jürgen

Darryl Cousins wrote:

Hi,

I have a custom logger in a package registered with utility

zope:utility  factory=.logger.MyLogger name=logger /

In the code it sets itself a logfile to write to, up to now that has
been in a 'log' directory in the package itself.

Now I want to use a log file which is in the buildout of the
application. How could I go about finding that directory from python
code in the package?

The only route that I have come up with so far is to write a
meta:directive which I can use to register the logging utility with a
file path. Something like:

  meta:directive
  namespace=http://namespaces.zope.org/rdb;
  name=provideLogger
  schema=.zcml.IProvideLoggerDirective
  handler=.zcml.loggerhandler
  /

Which I could use like

  provideLogger component=.logger.MyLogger
 log=/path/to/log/file /

But there may be a better/easier way. Suggestions?

Regards,
Darryl


___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Zope3, ZEO and RAMCache

2007-11-23 Thread Chris Withers

Thierry Florac wrote:

As it's name implies, RAMCache utility only stores it's data in RAM. So
I guess that ZODB won't be impacted by cache updates, as other Zope
frontends...
So what do you mean by find it's way back to ZEO ? And how can you
handle this ??


Oh, I have no idea about RAMCache...

cheers,

Chris

--
Simplistix - Content Management, Zope  Python Consulting
   - http://www.simplistix.co.uk
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users