Re: [Zope] ZEO on Windows

2005-08-24 Thread Chris Withers

michael nt milne wrote:

Hi
  Does anyone know if the 2.0.5 windows release of Plone includes ZEO? 


Ask on a Plone list.

Is 
there any configuration information on this? 


Dunno what you mean.

Also does Zope 2.8 for linux 
have ZEO as standard.


Yes.

 Finally, if you don't run ZEO does this mean that Zope can only handle one 
request at a time?


No.

Chris

--
Simplistix - Content Management, Zope & Python Consulting
   - http://www.simplistix.co.uk

___
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] Migration pains going to Zope 2.8

2005-08-24 Thread Richard Jones
On Thu, 25 Aug 2005 12:06 pm, Richard Jones wrote:
> and now everything works.

Further data-point - the version of VerboseSecurity is to blame. It's not 
2.8-compatible :(

Sorry for the noise.


Richard


pgpvvxmwsl89Y.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] Migration pains going to Zope 2.8

2005-08-24 Thread Richard Jones
On Thu, 25 Aug 2005 04:36 am, Dieter Maurer wrote:
> Does your "addValue" have a "__name__" attribute with value "addValue"?

In py2.3 (at least) functions get a __name__ automatically:

Python 2.3.5 (#2, Mar 29 2005, 15:41:06)
[GCC 3.3.5 (Debian 1:3.3.5-8ubuntu2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> def foo():
...  pass
...
>>> foo.__name__
'foo'
>>>


> If so, you may want to analyse the "FactoryDispatcher" mentioned
> above.
>
> You get it (in an interactive interpreter) via
>
> app.manage_addProduct[]
>
> In its class, you should find your contructors as
> well as permission attributes of the form "__roles__".
>
> Apparently, "addValues__roles__" is missing (for whatever reason).

The ProductContext is creating the attributes correctly on the Product's 
custom FactoryDispatcher class. The correct class is being used, and the 
*__roles__ attributes are all present and accounted for when the validate() 
is invoked. The problem appears to be that we don't even get up to checking 
those attributes. The addValues function has no __roles__ attribute, so we 
wander into __roles__ attribute checking on the container and fall about 
laughing. So I added __roles__ to addValues:

  addValues.__roles__ = ('Manager', )

and now everything works. I even removed the ModuleSecurityInfo declarations, 
since they appeared to have no effect at all. There's probably some API for 
setting that __roles__ attribute, but I'm stuffed if I can find it.


Thanks for the help Dieter,

 Richard


pgpn3xLBQmglw.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: FIXED: Re: [Zope] URL0 returns index_html not index.html

2005-08-24 Thread Mark Barratt

John Eikenberry wrote:

Mark Barratt wrote:



A text substitution covers both cases:

tal:attributes="href 
python:context.REQUEST['URL0'].replace('index_html','index.html')+'/source.html'"



Wouldn't this just result in "[path]/index.html/source.html"? Do you want
the index.html in the URL to source.html. This will work with Zope but
looks strange. Using URL1 instead of URL0 would leave the index[._]html
off the generated URL. 
 


Only if the apparent address of the 'page' is [folder]/, and that is 
what I want. But it also works if the apparent address of the 'page' is 
pagename.html - in that case URL0 returns the correct complete path and 
the text substitution doesn't come into play. In all case I want to 
return /source.html of the target page so I can edit it in Mozile (not 
that I can yet, mind you).


best

--
Mark Barratt

___
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 )


[Zope] ZTUtils TabindexIterator class

2005-08-24 Thread David Pratt
Can I contribute a small TabindexIterator class for ZTUtils.  It is not 
big, but handy for generating tabindex values in a site. The current 
Iterator class available was not meant to do this but this is.  I think 
this could be added to Iterators.py  It seems better to incorporate 
something like this in ZTUtils than making a site tool to do this.


It only provides one method next() and takes a sequence. If you want 
your tabindex to start at 500 and go no further than 599, you just give 
it range(500,600) and stops iterating. For for 0 to n  - just use 
range(n).  It could always pass after iteration stops but I think it is 
better to raise exception so you can modify your sequence, if necessary.


class TabindexIterator:
""" Tabindex iterator class """

__allow_access_to_unprotected_subobjects__ = 1

def __init__(self, seq):
self.iter = seq.__iter__()

def next(self):
try:
next = self.iter.next()
return next
except StopIteration:
raise 'Tabindex iterator exhausted.'

Regards,
David
___
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] ZEO on Windows

2005-08-24 Thread Tim Peters
[michael nt milne]
> ...
> Also does Zope 2.8 for linux have ZEO as standard.

All versions of Zope at and after 2.7 include ZEO, and regardless of
platform (Linux, Windows, Solaris, ..., doesn't matter).
___
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] Migration pains going to Zope 2.8

2005-08-24 Thread Dieter Maurer
Richard Jones wrote at 2005-8-24 16:11 +1000:
>I can't instantiate out Product, which is a bit of a hurdle :)
>
>Our Product's registration looks like this (this function is invoked from the 
>Product's __init__.py):
>
>def initialize(context):
>''' Register the CGPublisher class '''
>context.registerClass(
>CGPublisher,
>permission=Perm.ADD_CGPUBLISHERS,
>constructors = (addCGPublisherForm, addCGPublisher, addValues,
>getMode),
>icon='www/CGPublisher.gif',
>visibility='Global',
>)
>
>Unfortunately, the addCGPublisherForm template can't access the "addValues" 
>function. The specific error I get is:
>
> Error Type: Unauthorized
> Error Value: The container has no security assertions. Access to 'addValues'
>  of (App.ProductContext.__FactoryDispatcher__ object at 0xb61d30cc) denied.

Maybe, you do not honor the following requirement
(documented in "App.ProductContext.ProductContext.registerClass"):

constructors -- A list of constructor methods
  A method can me a callable object with a __name__
  attribute giving the name the method should have in the
  product, or the method may be a tuple consisting of a
  name and a callable object.  The method must be picklable.

  The first method will be used as the initial method called
  when creating an object.

Does your "addValue" have a "__name__" attribute with value "addValue"?

If so, you may want to analyse the "FactoryDispatcher" mentioned
above.

You get it (in an interactive interpreter) via

app.manage_addProduct[]

In its class, you should find your contructors as
well as permission attributes of the form "__roles__".

Apparently, "addValues__roles__" is missing (for whatever reason).

-- 
Dieter
___
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] problem with adding an external method

2005-08-24 Thread Dieter Maurer
Scott Mann wrote at 2005-8-23 10:00 -0700:
> ...
>I am attempting to add the external python module "nb_fetch" Doing so returns 
>the error message:
>
>"Module /data/zope/testbed/initialzope/Extensions/nb_fetch.py, line 3, in ?
>
> ImportError: No module named nb_parse"
>
>where nb_parse is imported by nb_fetch.

Note that Zope does not use Python's normal import mechanism
to load the source file for "External Method"s.
One impact: you cannot use relative imports:

   Even if "nb_fetch.py" and "nb_parse.py" lie side by side in
   the same folder, "nb_fetch.py" cannot simple do
   an "import nb_parse" to access the other module.

> ...
>I have also made a number of attempts at adding directories to the PYTHONPATH, 
>but no success.

If "nb_parse.py" is in a folder listed in PYTHONPATH,
the "import nb_parse" should succeed.

> ...
>Also, I restart zope every time I make a change.

Change what?

If you change the source file of an "External Method" *AND*
you run your Zope in "development mode", then changes are
recognized automatically.

Chances in other Python modules (such as your "nb_parse" above)
require a Zope restart.

-- 
Dieter
___
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] ZEO on Windows

2005-08-24 Thread Dieter Maurer
michael nt milne wrote at 2005-8-24 11:52 +0100:
>  Does anyone know if the 2.0.5 windows release of Plone includes ZEO?

Do you have installed it?

Then see whether the "Zope" part contains the folder "ZEO"
(usually in "lib/python"). If it does, then it contains "ZEO".

>Also does Zope 2.8 for linux 
>have ZEO as standard.

Yes, I think so. Again: install and check whether the "ZEO" part is
there.

> Finally, if you don't run ZEO does this mean that Zope can only handle one 
>request at a time?

No.

It only does mean that a single process can access your ZODB data.

A standard Zope process has 4 worker threads that can execute requests
in parallel.

Note, however, that even when you run on a multi-processor maschine,
the various Python threads may not be able to truely run
in parallel (a single process allows only a single thread to execute
Python code; other threads may wait on something external or execute
non Python (e.g. C) code, but they cannot execute Python code
truely in parallel).

-- 
Dieter
___
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] AssertionError after update to Zope 2.8.1

2005-08-24 Thread Tim Peters
[Ricardo Newbery]
> Oh so close...
>
> Migrated from Zope 2.7.2 to 2.8.1
> Updated all the Catalog instances according to the instructions.
> Fixed a few outdated products.
> 
> Then just for kicks, I tried to update the Python scripts by visiting
> the /manage_addProduct/PythonScripts/recompile url.  After about a
> minute, it threw up an error page.  This is what shows up in the
> log...
>
>
> 2005-08-21T01:56:45 ERROR txn.170046464 Error in abort() on manager 
> 
> Traceback (most recent call last):
>   File "/Zope-2.8/lib/python/transaction/_transaction.py", line 456, in 
> _cleanup
>   File "/Zope-2.8/lib/python/ZODB/Connection.py", line 348, in abort
>   File "/Zope-2.8/lib/python/ZODB/Connection.py", line 360, in _abort
> AssertionError
> --
> 2005-08-21T01:56:45 ERROR Zope.SiteErrorLog
> http://someurl.com/manage_addProduct/PythonScripts/recompile
> Traceback (most recent call last):
>   File "/Zope-2.8/lib/python/ZPublisher/Publish.py", line 119, in publish
>   File "/Zope-2.8/lib/python/Zope2/App/startup.py", line 215, in commit
>   File "/Zope-2.8/lib/python/transaction/_manager.py", line 84, in commit
>   File "/Zope-2.8/lib/python/transaction/_transaction.py", line 381, in commit
>   File "/Zope-2.8/lib/python/transaction/_transaction.py", line 379, in commit
>   File "/Zope-2.8/lib/python/transaction/_transaction.py", line 424, in 
> _commitResources
>   File "/Zope-2.8/lib/python/ZODB/Connection.py", line 462, in commit
>   File "/Zope-2.8/lib/python/ZODB/Connection.py", line 483, in _commit
> AssertionError
>
> ...

Note that someone else (I think) opened a Collector issue against what
appears to be a very similar problem:

http://www.zope.org/Collectors/Zope/1874

As I noted there, it would be helpful if someone who sees this problem
added some prints at the point of the failing assert, so we could at
least learn the type/class of the object without an oid.
___
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] manage_afterAdd quirks

2005-08-24 Thread John Eikenberry
Philip J?genstedt wrote:

> It seems I need one of three things:
> 
> 1. A better way to add images and a template altogether.
> 2. A hook which is only called once, when the object is first created.
> 3. A method to check if the objects exist in the newly added item
> directly, not aquired.

As Peter mentioned, use aq_base. There are 2 ways to use it. One as an
object attribute (self.aq_base) or using the aq_base() function as imported
from Acquisition. The latter method won't cause an attribute error if you
already are working with the non-acquisition object (in that case it will
simply return the object. For what you are doing I recommend one of these
methods.

To get more control over when manage_afterAdd runs some code, you can set
some flags using the copy hooks. Before running manage_afterAdd when
copying/moving/renaming ObjectManager calls the method _notifyOfCopyTo() on
the object being copied/moved/renamed. It passes one argument (op) giving
some context to the call. It is set to 1 for moves and renames, and set to
0 for copies. 

So you can use this to set a flag on your object to modify
manage_afterAdd's behaviour in these circumstances. Eg.

class Container(ObjectManager):

def _notifyOfCopyTo(self,op):
# use a _v_ volitile attribute here to avoid persistence
self._v_copy_flag = op

def manage_afterAdd(self, item, container):
if hasattr(self,'_v_copy_flag'):
if self._v_copy_flag == 0:
# stuff you want done when copying
...
if self._v_copy_flag == 1:
# stuff you want done when moving/renaming
...
# clear the flag
delattr(self,'_v_copy_flag')
else:
# stuff you want done only on initial install
...
# stuff you want done no matter what.
.,.

Of course you can simplify this if you don't care if its been moved,
renamed or copied. Just wanted to show the different possibilities.

-- 

John Eikenberry [EMAIL PROTECTED]
__
"A society that will trade a little liberty for a little order
 will deserve neither and lose both."
  --B. Franklin
___
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: FIXED: Re: [Zope] URL0 returns index_html not index.html

2005-08-24 Thread John Eikenberry
Mark Barratt wrote:

> Well, no, because some of the objects I want to append /source.html to 
> are not called index.html (but that *is* how we did it for another site 
> and it works as you say).
> 
> A text substitution covers both cases:
> 
> tal:attributes="href 
> python:context.REQUEST['URL0'].replace('index_html','index.html')+'/source.html'"

Wouldn't this just result in "[path]/index.html/source.html"? Do you want
the index.html in the URL to source.html. This will work with Zope but
looks strange. Using URL1 instead of URL0 would leave the index[._]html
off the generated URL. 
 
> >If you were working with zope projects there are other tricks you could
> >pull, but it doesn't sound like you are doing this.
> 
> I don't understand this: is a 'zope project' different from my project 
> using zope?

Opps. I meant a 'zope product', ie. a python based product.
 

-- 

John Eikenberry [EMAIL PROTECTED]
__
"A society that will trade a little liberty for a little order
 will deserve neither and lose both."
  --B. Franklin
___
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] Zope 2.8.1 on Mac OS X tiger Server

2005-08-24 Thread Andrew Langmead


On Aug 23, 2005, at 6:24 AM, Garito wrote:

I try sudo /System/Library/StartupItems/Zope/Zope start but nothing  
happend (nor on console)


but if I launch /var/zope/sistes/bin/zopectl start it works perfectly

I try to comment the if and fi lines but don't work




I just want to make sure I point out to you, that little of this has  
to do with Zope itself, and most of the audience of this list knows  
little or cares little about the peculiarities of the MacOSX/Darwin  
init environment.



One piece of information that I now realize that I forgot to put in  
the previous message was that if you have the section "if [ "$ 
{ZOPESERVER=-NO-}" = "-YES-" ]; then" in your startup script, then  
you probably have to put a line in your /etc/hostconfig that says   
ZOPESERVER=-YES-. The bundles in /System/Library/StartupItems and / 
Library/StartupItems tell the machine how to start services and in  
what order, but the /etc/hostconfig file specifies which services are  
desired for a particular machine.


If you want to diagnose the shell script in /Library/StartupItems/ 
Zope/Zope, you might want to try to run it with the bourne shell's  
trace option, specified by the "-x" parameter.


sh -x /Library/StartupItems/Zope/Zope start


___
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 )


[Zope] ZEO on Windows

2005-08-24 Thread michael nt milne
Hi
 
 
Does anyone know if the 2.0.5 windows release of Plone includes ZEO? Is there any configuration information on this? Also does Zope 2.8 for linux have ZEO as standard.
 
Finally, if you don't run ZEO does this mean that Zope can only handle one request at a time?
 
Thanks
___
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 )