[Zope3-Users] Re: zope.testbrowser and ZMI?

2007-03-02 Thread Philipp von Weitershausen

Basil Shubin wrote:

Philipp von Weitershausen wrote:

Stephan Richter wrote:

On Thursday 01 March 2007 10:17, Basil Shubin wrote:

  browser.addHeader('Authorization', 'Basic admin:admin')


This authorization is not correct. You need to use:

   manager.addHeader('Authorization', 'Basic mgr:mgrpw')

At least this is the default.


In most Zope 3 ftest layers it is. I believe he's on Zope2, though.

I think his problem is that he's using the Zope 3 test browser in Zope 
2. He should be using Products.Five.testbrowser.Browser.


  from Five.testbrowser import Browser


That's Products.Five


  browser = Browser()
  browser.addHeader('Authorization', 'Basic mgr:mgrpw')
  browser.open('http://localhost:8080/manage')
Loading Zope, please stand by ... done (3.729s)
Traceback (most recent call last):

...

AttributeError: 'NoneType' object has no attribute '_p_jar'

Totaly confused, again!


Are you using FunctionalDocFileSuite from Testing.ZopeTestCase? I bet not...

--
http://worldcookery.com -- Professional Zope documentation and training
Next Zope 3 training at Camp5: http://trizpug.org/boot-camp/camp5

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


Re: [Zope3-Users] Web Component Development with Zope 3 (2nd edition)

2007-03-02 Thread Weisglass Ofer

Hay Jonathan

Do you know if they ship it to Israel?

Thank you

Ofer Weisglass


On 2/28/07, Jonathan [EMAIL PROTECTED] wrote:


For whoever may be interested...

Amazon.com is finally shipping the second edition of Philipp's book
(ordered
Dec 6/06, shipped on Feb 24/07, arrived today!)



Jonathan

___
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] Zope3 startup

2007-03-02 Thread Giovannetti, Mark
Hi Marius,

Thanks for confirming some of my questions!  Is there a book
that you would recommend that explains how python deals with
all this?  I have read Apress' Beginning Python and I have read
bits and pieces of the online python docs.  I am willing to
pick up other python books if there are some good ones.

Other comments inline:

 From: Marius Gedminas
 On Wed, Feb 28, 2007 at 11:47:15AM -0500, Giovannetti, Mark wrote:
  Hello,

[snip]

  
  1. At zope startup, each *-configure.zcml in etc/package-includes
  is read.  
  Q. The __init__.py file for each package is then executed, correct?
  A. Yes, since my testing indicates this is the case.  I had problems
  understanding this since the idiom is to just place a comment in 
  the __init__ file and it seemed rather useless to a new user.
 
 The __init__.py file is executed when you import a package.  That
 happens as a side effect when ZCML directives refer to classes and
 functions in packages.  The purpose of a __init__.py is to 
 define names that could be imported, and not to run some 
 initialization code.
 
 In fact, this is how Python imports modules: it executes the 
 .py file of the module.  (It does this at most once during the 
 program's execution, unless you explicitly ask it to reload 
 modules.  Zope 3 never asks.)

Great, now I think I have a good handle on what is going on.  This
also explains why I have to restart zope when I make code changes
(something that puzzled me very briefly when I started learning).

So if I wanted to register utilities without using ZCML, I could
place the provideUtility(...) calls in an __init__.py or directly
within the utility's .py module.  Yes?

 
  2. Each configure.zcml file in the package's root directory (the
  one pointed to by the *-configure.zcml in package-includes) is
  parsed.
  Q. Does each class referred to in a class.. directive have
  the class' entire module loaded/executed or is the class just
  registered somewhere for future use?  
  A. ?
 
 Yes, the module is imported.

Thank you.

 
  3. Utilities and such in zcml.
  Q. Does each utility have its module executed to create the
  instance (utilities are instances, right?)
  A. I think so, but I'm not sure, see #2.
 
 Yes, the module is imported.
 
  I hope someone can clear this up for me.  I never managed to
  find a good explanation of the flow of control for zope3 
  startup and initialization.  I have read both books already.
 
 In brief, Zope 3 reads the configuration file (zope.conf), 
 finds out the
 name of the root zcml file (site.zcml, usually), then loads the ZCML
 configuration (which involves parsing all the zcml files that include
 each other, importing Python modules and accessing names defined in
 those), executes the configuration (which involves modifying global
 registries of adapters, utilities, security declarations 
 etc), opens or creates the ZODB database, and then starts 
 listening on network ports.
 
 Marius Gedminas

I noticed that I could see this happening by watching the 
output of:

# tail -F zope-instance/log/transcript.log

if I add the following 'level debug' option to zope.conf 
(from a prior thread):

eventlog
  # This sets up logging to both a file and to standard output
  # (STDOUT).  The path setting can be a relative or absolute
  # filesystem path or the tokens STDOUT or STDERR.
  level debug

  logfile
path $LOGDIR/z3.log
formatter zope.exceptions.log.Formatter
  /logfile

  logfile
path STDOUT
formatter zope.exceptions.log.Formatter
  /logfile
/eventlog

I can see all of the zcml files being called.

Mark

-- 
613-947-1359
System Scientist / Scientifique, spécialiste des systèmes
Canada Centre for Remote Sensing / Centre canadien de télédéction
Natural Resources Canada, 588 Booth Street, Ottawa, Ontario, Canada, K1A 0Y7
Ressources naturelles Canada, 588 rue Booth, Ottawa, Ontario, Canada, K1A 0Y7
Government of Canada / Gouvernement du Canada
  
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Web Component Development with Zope 3 (2nd edition)

2007-03-02 Thread Jonathan


- Original Message - 
From: Weisglass Ofer [EMAIL PROTECTED]

To: Jonathan [EMAIL PROTECTED]
Cc: zope3-users@zope.org
Sent: Friday, March 02, 2007 12:13 PM
Subject: Re: [Zope3-Users] Web Component Development with Zope 3 (2nd 
edition)




Hay Jonathan

Do you know if they ship it to Israel?



Here's a link to amazon.com's info page on shipping to Israel:

http://www.amazon.com/gp/help/customer/display.html/103-3192526-8696613?ie=UTF8nodeId=596198


hth

Jonathan 


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


Re: [Zope3-Users] Web Component Development with Zope 3 (2nd edition)

2007-03-02 Thread Weisglass Ofer

Thank you

Ofer Weisglass

On 3/2/07, Jonathan [EMAIL PROTECTED] wrote:



- Original Message -
From: Weisglass Ofer [EMAIL PROTECTED]
To: Jonathan [EMAIL PROTECTED]
Cc: zope3-users@zope.org
Sent: Friday, March 02, 2007 12:13 PM
Subject: Re: [Zope3-Users] Web Component Development with Zope 3 (2nd
edition)


 Hay Jonathan

 Do you know if they ship it to Israel?


Here's a link to amazon.com's info page on shipping to Israel:


http://www.amazon.com/gp/help/customer/display.html/103-3192526-8696613?ie=UTF8nodeId=596198


hth

Jonathan


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


[Zope3-Users] Re: Web Component Development with Zope 3 (2nd edition)

2007-03-02 Thread Philipp von Weitershausen

Weisglass Ofer wrote:

Do you know if they ship it to Israel?


You can also order directly from Springer:
http://www.springer.com/dal/home?SGWID=5-102-22-173705712-0


--
http://worldcookery.com -- Professional Zope documentation and training
Next Zope 3 training at Camp5: http://trizpug.org/boot-camp/camp5

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


Re: [Zope3-Users] Zope3 startup

2007-03-02 Thread Marius Gedminas
On Fri, Mar 02, 2007 at 12:31:22PM -0500, Giovannetti, Mark wrote:
 Thanks for confirming some of my questions!  Is there a book
 that you would recommend that explains how python deals with
 all this?

I liked Mark Pilgrim's _Dive into Python_.  I don't remember if it goes
into details about how Python modules work.

  In fact, this is how Python imports modules: it executes the 
  .py file of the module.  (It does this at most once during the 
  program's execution, unless you explicitly ask it to reload 
  modules.  Zope 3 never asks.)
 
 Great, now I think I have a good handle on what is going on.  This
 also explains why I have to restart zope when I make code changes
 (something that puzzled me very briefly when I started learning).
 
 So if I wanted to register utilities without using ZCML, I could
 place the provideUtility(...) calls in an __init__.py or directly
 within the utility's .py module.  Yes?

Yes, but only if you could make sure that your package or module was
imported during Zope 3 startup.

Grok uses a similar scheme, as far as I understand: you declare your
adapters and utilites in Python code, and then a single ZCML directive
in the grok: namespace loads your package and registers everything.

Does Grok have a website?  Google doesn't give me anything more useful
than these blog posts:

  http://faassen.n--tree.net/blog/view/weblog/2006/11/09/0
  http://faassen.n--tree.net/blog/view/weblog/2007/01/09/0
  
http://www.z3lab.org/sections/blogs/philipp-weitershausen/2007_01_09_you-thought-zope-3-wasn

Marius Gedminas
-- 
The laser etcher can accept most any image data, (think logos or screen dumps!)
and render it on a heat-sensitive surface. There's a big tunable exhaust fan,
so the thing can be dialed in to Not vaporize your laptop.
-- Stuart Kreitman


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


[Zope3-Users] Re: Zope3 startup

2007-03-02 Thread Philipp von Weitershausen

Marius Gedminas wrote:

On Fri, Mar 02, 2007 at 12:31:22PM -0500, Giovannetti, Mark wrote:

Thanks for confirming some of my questions!  Is there a book
that you would recommend that explains how python deals with
all this?


I liked Mark Pilgrim's _Dive into Python_.  I don't remember if it goes
into details about how Python modules work.

In fact, this is how Python imports modules: it executes the 
.py file of the module.  (It does this at most once during the 
program's execution, unless you explicitly ask it to reload 
modules.  Zope 3 never asks.)

Great, now I think I have a good handle on what is going on.  This
also explains why I have to restart zope when I make code changes
(something that puzzled me very briefly when I started learning).

So if I wanted to register utilities without using ZCML, I could
place the provideUtility(...) calls in an __init__.py or directly
within the utility's .py module.  Yes?


Yes, but only if you could make sure that your package or module was
imported during Zope 3 startup.

Grok uses a similar scheme, as far as I understand: you declare your
adapters and utilites in Python code, and then a single ZCML directive
in the grok: namespace loads your package and registers everything.


Grok still makes a difference between *import time* and *configuration 
time*. I would not encourage doing component setup at import time. It 
doesn't play well with tests, for example, and it's hard to override 
(you have to do imports in the right order).



Does Grok have a website?


Not yet. A prototype is at http://www.bud.ca/files/grokonepage/.


--
http://worldcookery.com -- Professional Zope documentation and training
Next Zope 3 training at Camp5: http://trizpug.org/boot-camp/camp5

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