[Zope] Adding an External Method

Paul Howell paul at smoothstone.com
Mon Mar 15 12:09:55 EST 2004


At 03:53 PM 3/15/2004 +0000, John Poltorak wrote:
>On Mon, Mar 15, 2004 at 10:20:08AM -0500, Paul Howell wrote:
> > John, your error message is doing all the suggesting as to what is
> > wrong.   Specifically, it says that it can't import GLOBALS from config
> > (meaning config.py, of course).
>
>Yes, I gather there is a problem, but the last place I would have
>expected it to find it would have been in the sample code provided.

No, the sample code is what generated this error, so it should be the FIRST 
place to expect to find it.  Even (likely) the ONLY place to find it.

>How are you expected to learn anything when the information you are
>presented with is incorrect?

John, mistakes happen.  Even when people get paid the big bucks to document 
things and to edit articles ;-)

><snip>
> > (1) Try this: Change the line so that it only imports PROJECTNAME, and not
> > GLOBALS.
>
>One wonders why it was included in the sample code...

In this case, GLOBALS is very commonly imported from config.py, especially 
in Archetypes code (you'll notice this when you read some more 
samples).  In all likelihood, GLOBALS was required in an earlier draft of 
the code for the article (perhaps to setup a skins folder properly), and 
then the code was later simplified but the import call remained 
(unfortunately).  Just a guess... many mistakes in documentation (and other 
publications) come about like that.


> > And finally, when you get the code to work properly and find what the
> > errors in the article truly be, and what it should say, document it for 
> others.
>
>Looks like you have already found this documented.

Nope, not in the sense of someone writing about the error, at least not at 
the time I wrote that message.   But also Yes, it is very clearly 
documented by reading the source code... In the words of Obi Wan Pythobi, 
"Use the Source, Luke."  In this case, do all the python tutorials you can 
too, so that you'll better follow (and thus appropriately appropriate) the 
code in other samples.

>I know Google is wonderful, but how on earth did you find that article?

There is a fine art of Googling, of course, but there are also basic 
techniques to finding your answer.  The most fundamental is to picture your 
answer, and search on the key words and phrases that would appear in your 
answer.  The second most fundamental technique is to rephrase your question 
in a fashion that someone else might have posed it, and to use those 
keywords.  In this case, I used "Technique #2" and searched Google on:

Zopemag archetypes article problem

The discussion from awkly.org was top of the list.
=Paul





More information about the Zope mailing list