[Zope] Problem with links containing non-ascii characters in StructuredText

2005-09-29 Thread Maurits van Rees
Hi,

I have a problem getting links to function in StructuredText when they
have non-ascii characters in the title.  

- This will render as a link: "Zope website":http://zope.org/

- This will render literally: "Zöpe website":http://zope.org/

[Notice the diaeresis in the second case.]

This can of course be solved by using html entities like 'ö'.
But I have just started using utf-8 so I don't have to bother myself
with writing html entities.  There is probably a Python method that
can translate 'ö' into 'ö', but I would like the resulting html
code to be humanly readable utf-8 as well.  I wouldn't mind iso-8859-1
as that's what it basically is in my case (I'm Dutch) but utf-8 seems
the way to go.

Anyway, here is a script that illustrates the problem.  It has some
extra non-ascii characters thrown in just to show that these
characters don't give any problems outside of the links.

--
import Products.PythonScripts.standard

print """



"""

text="""
Let's link to a "Zope website":http://zope.org/.

Nó. Let's lïnk to à "Zöpe website":http://zope.org/.
"""

ppss=Products.PythonScripts.standard.structured_text
print ppss(unicode(text, 'iso-8859-1').encode('utf-8'))
# The following line has the same effect:
#print unicode(ppss(text), 'iso-8859-1').encode('utf-8')

print ""

return printed
--

Don't worry, this is not how I usually make my pages. ;-)

This results in the following html source code:

--




Let's link to a http://zope.org/";>Zope website.
Nó. Let's lïnk to à "Zöpe website":http://zope.org/.


--

That last failed link is obviously not as it should be.  Does anyone
know a solution?  I failed to find one with Google.

I wondered if it had to do with the diaeresis specifically, but the
same thing goes wrong with e.g. 'Zópe'.

BTW, I use the Debian Sarge version of Zope 2.7.

Thanks,

-- 
Maurits van Rees | http://maurits.vanrees.org/ [Dutch/Nederlands] 
Public GnuPG key:  http://maurits.vanrees.org/var/gpgkey.asc
"It can seem like you're doing just fine,
but the creep's creeping into your mind." - Neal Morse


signature.asc
Description: Digital 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] Problem with links containing non-ascii characters in StructuredText

2005-09-30 Thread Maurits van Rees
On Fri, Sep 30, 2005 at 07:53:03AM +0200, Andreas Jung wrote:
> You have to configure your locale support in etc/zope.conf properly.

Ah, that seems to be part of the mix yes.  Thanks.  I am now trying:

locale [EMAIL PROTECTED]

I am also wondering about the following two settings, that seem to be
needed as well:

rest-input-encoding utf-8
rest-output-encoding utf-8

According to 
http://www.zope.org/Wikis/DevSite/Proposals/ReStructuredTextIntegration:

Zope 2.X includes a StructuredText module that has several problems:

* undefined behaviour in i18n environments (which characters are
allowed inside StructuredText markup? Which characters count as
punctuation characters?)

So I guess I should be using REstructured text instead.  This indeed
seems to help, though I haven't got all problems ironed out yet.  In
this new format the following:


.. _Zope: http://www.zope.org/ 

I like the `Zöpe platform`__.

__ Zope_ 


gets transformed into something like:

I like the http://www.zope.org/";>Zöpe 
platform.

Some other linking methods and other encodings either don't work (Zope
doesn't start or throws an error on the page or doesn't produce a
link) or they produce a correct link but with ugly characters like
above.

Maybe I can get it to work with some more trying and guessing.  But
does anyone have a good link on how to get Zope to work correctly with
Unicode?

Thanks,

-- 
Maurits van Rees | http://maurits.vanrees.org/ [Dutch/Nederlands] 
Public GnuPG key:  http://maurits.vanrees.org/var/gpgkey.asc
"It can seem like you're doing just fine,
but the creep's creeping into your mind." - Neal Morse


signature.asc
Description: Digital 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] Problem with links containing non-ascii characters in StructuredText

2005-09-30 Thread Maurits van Rees
On Fri, Sep 30, 2005 at 12:38:04PM +0200, Andreas Jung wrote:
> StructuredText does not work with UTF8 (when you mean this by mentioning
> unicode). There is a utf-8 patch for STX but this has other problems.
> Means: Don't use STX with multi-byte encodings...instead use reST.

Okay, that's clear now, thanks.  I have got it working now:

In etc/zope.conf:

rest-input-encoding utf-8
rest-output-encoding utf-8
locale [EMAIL PROTECTED]

Hm, now it seems to function without that locale setting as well.
Maybe Zope reads the locale correctly from my system already.

Anyway, my script is now:
--
import Products.PythonScripts.standard

print """



"""
text="""
.. _Zope: http://www.zope.org/ 

I like à `Zöpe platform`__.

__ Zope_ 

"""
ppsr=Products.PythonScripts.standard.restructured_text
print "ppsr(text):"
print ppsr(text)
print ""

return printed
--

So no more switching from iso to utf with:

print ppsr(unicode(text,'iso-8859-1').encode('utf-8'))

So far as I can see this solves my problems.

Thanks for thinking with me, Andreas.

-- 
Maurits van Rees | http://maurits.vanrees.org/ [Dutch/Nederlands] 
Public GnuPG key:  http://maurits.vanrees.org/var/gpgkey.asc
"It can seem like you're doing just fine,
but the creep's creeping into your mind." - Neal Morse


signature.asc
Description: Digital 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] passing the parameters to zsql method

2005-10-27 Thread Maurits van Rees
On Thu, Oct 27, 2005 at 10:23:52AM +0200, Dario Lopez-Kästen wrote:
> Not sure if this works, but that is the general idea. This was inspired from
> 
> http://www.plope.com/Books/2_7Edition/AdvZPT.stx#2-9
> 
> section: "Form Processing"

I would suggest to give it a try with a Z Search Interface.  See the
same book, in the chapter on Relational Databases:
http://www.plope.com/Books/2_7Edition/RelationalDatabases.stx#1-11

This assists you in making two pages, at your choice as either DTML
Methods or Page Templates.  Like most people here I would suggest
going for the Page Templates.  One is a form in which you can enter
the values for your Z SQL Method.  This then passes control to the
second page, which is a report that gets its input by calling the Z
SQL Method.

The form basically is:


...


The report basically starts with:


  


Note that when your Z SQL Method only has an update or insert or
delete it will usually not return a lot of results, so the report will
be basically empty.  I would say it is nice if the user gets some
feedback, so put some related select statement after your normal
query, even if it is just: SELECT * from your_table.  This gives the
report something to present to the user as visual feedback, instead of
leaving him in the dark on whether the submission of the form actually
had any permanent results.

-- 
Maurits van Rees | http://maurits.vanrees.org/ [Dutch/Nederlands] 
Public GnuPG key:  http://maurits.vanrees.org/var/gpgkey.asc
"It can seem like you're doing just fine,
but the creep's creeping into your mind." - Neal Morse


signature.asc
Description: Digital 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] unicode problem

2005-11-30 Thread Maurits van Rees
On Wed, Nov 30, 2005 at 02:12:07PM +0100, [EMAIL PROTECTED] wrote:


> I've created a folder a put some dtml-methods, External python
> scripts and a Formulator Forms. It had worked fine till I put the
> Form's xml page the following line:
> int_bev_feldolgoz
> int_bev_feldolgoz is dtml method and at the moment only shows the
> value of REQUEST
> Having seen the result of this method I wanted to back to edit the
> content of the folder, but I couldn't continue. The following error
> message was displayed:
> Error Type: UnicodeEncodeError
> Error Value: 'latin-1' codec can't encode character u'\u0170' in position 
> 22895: ordinal not in range(256)
> 
> What shall I do? I don't want start it from scratch. All dtml-method
> with unicode characters worked smoothly. (Debian Sarge Zope2.7)

I had an issue with unicode a few weeks back and could solve it thanks
to the list, so it might help you to review this thread:

http://mail.zope.org/pipermail/zope/2005-September/161900.html

Partly that thread is about (Re)StructuredText, but don't let yourself
be thrown off by that.

You may want to check if your Python scripts do some explicit unicode
encoding, like this:

sometext = unicode(some_other_text,'iso-8859-1').encode('utf-8')

And you may have to change your Python's default encoding or have a
look at etc/zope.conf in your zope instance.

HTH,

-- 
Maurits van Rees | http://maurits.vanrees.org/ [Dutch/Nederlands] 
Public GnuPG key:  http://maurits.vanrees.org/var/gpgkey.asc
"Make no little plans; they have no magic to stir men's blood and
probably in themselves will not be realized. Make big plans."
---Daniel Hudson Burnham.


signature.asc
Description: Digital 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 )


[Zope] Re: error installing zope from source

2005-12-22 Thread Maurits van Rees
Op 2005-12-20, adeline nombre schreef <[EMAIL PROTECTED]>:
>   the problem now is that when I do "make" there is this error
> message:" does not find file /usr/lib/python2.3/config/Makefile
> . And when I look in /usr/lib/python2.3/ , there is no directory
> "config".
>   I have python2.3.
>   my OS is debian sarge.
>   Do u have an idea about what I should do?
> thank you very much

I also have Debian Sarge and I *do* have a file
/usr/lib/python2.3/config/Makefile.  I see this file belongs to the
python2.3-dev package.  So you need to install that. ('aptitude install
python2.3-dev' or similar.)

When you install Zope from source, you may want to install python from
source too.  At least that's what I see recommended often.

-- 
Maurits van Rees | http://maurits.vanrees.org/ [NL]
Work | http://zestsoftware.nl/
   GnuPG key | http://maurits.vanrees.org/var/gpgkey.asc
"Do only what only you can do." --- Edsger Wybe Dijkstra

___
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] Re: management of project

2006-03-14 Thread Maurits van Rees
On 2006-03-13, gus <[EMAIL PROTECTED]> wrote:
> Hello
> One questions
>
> Is there a program in zope for management project!!!

eXtreme Management is great:

http://plone.org/products/extreme-management-tool/

My company made it, so I may be biased. :)

-- 
Maurits van Rees | http://maurits.vanrees.org/ [NL]
Work | http://zestsoftware.nl/
   GnuPG key | http://maurits.vanrees.org/var/gpgkey.asc
"Do only what only you can do." --- Edsger Wybe Dijkstra

___
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] Re: Newbie zopectl question

2006-03-20 Thread Maurits van Rees
On 2006-03-20, JulianRead wrote:
> I have installed zope as root as setup an instance of zope using a different
> user.
>
> I am trying to setup zope so that it will start automatically when the
> server is rebooted. 
> I have created a symlink in rc.d to zopectl however this doesnt seem to
> work. 

This tries to start zope as the user root, not as that different user.
I do think you want to start it as that other user.  The following
article may help you:

http://www.debian-administration.org/articles/372

Basically, login as that user and add a crontab entry with 'crontab
-e' that contains something like this:

@reboot /home/someuser/zopeinstance/bin/zopectl start

Then test it of course. :)

-- 
Maurits van Rees | http://maurits.vanrees.org/ [NL]
Work | http://zestsoftware.nl/
   GnuPG key | http://maurits.vanrees.org/var/gpgkey.asc
"Do only what only you can do." --- Edsger Wybe Dijkstra

___
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] Re: Zope 2.10.0 released

2006-10-03 Thread Maurits van Rees
Andreas Jung, on 2006-10-03:
> on behalf of Zope developer community I am pleased to announce the release=20
> of Zope 2.10.0.
>
> You can download Zope 2.10.0 from:
>
>   http://www.zope.org/Products/Zope/2.10.0/

Great, thanks!

First problem that I see, which has happened before in some Zope tar
files IIRC, is that the files in the skel dir don't have the right
permissions.  Only root can view them.  So when you make an instance
you run into an error:

[Errno 13] Permission denied: './README.txt'

-- 
Maurits van Rees | http://maurits.vanrees.org/ [NL]
Work | http://zestsoftware.nl/
   GnuPG key | http://maurits.vanrees.org/var/gpgkey.asc
"Do only what only you can do." --- Edsger Wybe Dijkstra

___
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] Re: Zope 2.10.0 released

2006-10-03 Thread Maurits van Rees
Maurits van Rees, on 2006-10-03:
> Andreas Jung, on 2006-10-03:
>> on behalf of Zope developer community I am pleased to announce the release=20
>> of Zope 2.10.0.
>>
>> You can download Zope 2.10.0 from:
>>
>>   http://www.zope.org/Products/Zope/2.10.0/
>
> Great, thanks!
>
> First problem that I see, which has happened before in some Zope tar
> files IIRC, is that the files in the skel dir don't have the right
> permissions.  Only root can view them.  So when you make an instance
> you run into an error:
>
> [Errno 13] Permission denied: './README.txt'
>

Oh, and some other files as well, like:
lib/python/Zope2/Startup/zopeschema.xml
lib/python/zope/contenttype/mime.types

Running this:

find -execdir sudo chmod a+r {} +

fixes it for me.  Now Zope starts up fine.

-- 
Maurits van Rees | http://maurits.vanrees.org/ [NL]
Work | http://zestsoftware.nl/
   GnuPG key | http://maurits.vanrees.org/var/gpgkey.asc
"Do only what only you can do." --- Edsger Wybe Dijkstra

___
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] Re: Zope 2.10.0 released

2006-10-03 Thread Maurits van Rees
Andreas Jung, on 2006-10-03:
> Feel free to file a collector issue.

Probably better, yes.  Done:

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

-- 
Maurits van Rees | http://maurits.vanrees.org/ [NL]
Work | http://zestsoftware.nl/
   GnuPG key | http://maurits.vanrees.org/var/gpgkey.asc
"Do only what only you can do." --- Edsger Wybe Dijkstra

___
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] Re: Zope 2.10.0 released

2006-10-05 Thread Maurits van Rees
Andreas Jung, on 2006-10-04:
> I fixed the tar-ball generation part of the makefile and recreated the
> 2.10.0 and 2.9.5 archives with the right permissions.

Yes, that helped.  Thank you!


A few related notes though:

Strange: when I compare the new 2.9.5 tar ball with the old one I got
a few days before, there are more differences than just some
permission changes.

Here are the tar files in my download dir:
$ ls -ltr Zope-2.*tgz # edited a bit to prevent long lines.
6977165 2006-10-02 17:41 Zope-2.9.5-final.ori.tgz
7123131 2006-10-03 09:42 Zope-2.10.0-final.ori.tgz
6984923 2006-10-04 16:27 Zope-2.9.5-final.tgz
7122626 2006-10-05 12:45 Zope-2.10.0-final.tgz

$ diff -q -r Zope-2.9.5-final.ori Zope-2.9.5-final
Files Zope-2.9.5-final.ori/lib/python/zope/configuration/config.py
  and Zope-2.9.5-final/lib/python/zope/configuration/config.py differ
Files Zope-2.9.5-final.ori/lib/python/zope/configuration/xmlconfig.py
  and Zope-2.9.5-final/lib/python/zope/configuration/xmlconfig.py differ

And some more of those lines.  These differences are not about
permissions, but real content.  So I'm not sure what happened there.


$ diff -r Zope-2.10.0-final.ori Zope-2.10.0-final

gives no output, so that means only permission changes in the new
2.10.0.  That's good.


BTW, after a ./configure, make, sudo make install I get:
$ find -user root
./lib/python/zope.proxy
./lib/python/zope.proxy/proxy.h
./build-base/python-2.4/build-lib/version.txt

So those three files (in the directory where I extracted the tar ball
to) are owned by root, which is a bit strange.  No big deal, bit if
this can be fixed, it would be nice. 


Anyway, the new tarballs work.

-- 
Maurits van Rees | http://maurits.vanrees.org/ [NL]
Work | http://zestsoftware.nl/
   GnuPG key | http://maurits.vanrees.org/var/gpgkey.asc
"Do only what only you can do." --- Edsger Wybe Dijkstra

___
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] Re: Zope 2.10.0 released

2006-10-05 Thread Maurits van Rees
Stefan H. Holek, on 2006-10-05:
> Maurits, you seem to be working as root, which is the root of all  
> evil (pun intended). Don't do that, ever. The permission issues you  
> reported also only crop up if the tarball is extracted while root.  
> Don't do that!

Actually, I don't. :)

Extract the original tar ball, do a 'find -perm 600' and you'll see
lots of files that have the wrong permissions.  The new tar is good in
that respect.  But let's look at the 'root' cause:

~/download $ tar xzf Zope-2.10.0-final.tgz # That's the current one.
~/download $ cd Zope-2.10.0-final/
~/download/Zope-2.10.0-final $ find -user root
~/download/Zope-2.10.0-final $ ./configure
(snip the usual output)
~/download/Zope-2.10.0-final $ make
(snip the usual output)
[EMAIL PROTECTED]:~/download/Zope-2.10.0-final $ make install
"/usr/bin/python" "/home/maurits/download/Zope-2.10.0-final/setup.py" \
build 
--build-base="/home/maurits/download/Zope-2.10.0-final/build-base/python-2.4" 
--build-lib="/home/maurits/download/Zope-2.10.0-final/build-base/python-2.4/build-lib"
 
--build-scripts="/home/maurits/download/Zope-2.10.0-final/build-base/python-2.4/build-scripts"
 
--build-temp="/home/maurits/download/Zope-2.10.0-final/build-base/python-2.4/build-temp"
(snip)
running build_ext
creating zope.proxy
copying zope/proxy/proxy.h -> zope.proxy
copying /home/maurits/download/Zope-2.10.0-final/lib/python/version.txt -> 
/home/maurits/download/Zope-2.10.0-final/build-base/python-2.4/build-lib
running install_lib
creating /opt/Zope-2.10
error: could not create '/opt/Zope-2.10': Permission denied
make: *** [install] Error 1

That's logical, as I don't have the permissions to install anything in
/opt as normal user.

[EMAIL PROTECTED]:~/download/Zope-2.10.0-final $ find -user root
[EMAIL PROTECTED]:~/download/Zope-2.10.0-final $ sudo make install
(snip)
Zope binaries installed successfully.
Now run '/opt/Zope-2.10/bin/mkzopeinstance.py'
[EMAIL PROTECTED]:~/download/Zope-2.10.0-final $ find -user root
./lib/python/zope.proxy
./lib/python/zope.proxy/proxy.h
./build-base/python-2.4/build-lib/version.txt

Bingo, there is your error.  Well, like I said, that's not a big deal,
but still...

-- 
Maurits van Rees | http://maurits.vanrees.org/ [NL]
Work | http://zestsoftware.nl/
   GnuPG key | http://maurits.vanrees.org/var/gpgkey.asc
"Do only what only you can do." --- Edsger Wybe Dijkstra

___
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] Tab completion in zopectl debug

2006-10-17 Thread Maurits van Rees
Hi,

I have recently learned how to add tab completion to an interactive
python session and to pdb, thanks to Tom Lazar and to Jacob at
ParTecs.  More info with links on my first blog entry in three months:

http://maurits.vanrees.org/weblog/2006/10/tab-completion.html

At the end of that entry I ask a question: Can we add tab completion
to the zopectl debugger?  Or actually more general: can we load the
~/.pythonrc.py file when the zopectl debugger is started?  In that
file, the user can arrange tab completion or anything else he wants to
have available for interactive python sessions.

It is very easy to do: just add 'import user;' to the command line in
the do_debug function of $SOFTWARE_HOME/Zope2/Startup/zopectl.py.  For
details, see that blog entry.

I don't think there are security risks (but don't take my word for
it).  If someone can put malicious python code in that rc file, than
that someone could just as easily start a python session and enter the
malicious code there.


This would just be for convenience.  Would this be enough of a
convenience to put into the Zope source code?

-- 
Maurits van Rees | http://maurits.vanrees.org/ [NL]
Work | http://zestsoftware.nl/
"Do not worry about your difficulties in computers,
 I can assure you mine are still greater."

___
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] Re: Tab completion in zopectl debug

2006-10-18 Thread Maurits van Rees
Dieter Maurer, on 2006-10-18:
> Nothing prevents you to call "execfile" at the start of your
> debug session.

Lazyness prevents me to call "execfile" at the start of my debug
session. :)

-- 
Maurits van Rees | http://maurits.vanrees.org/ [NL]
Work | http://zestsoftware.nl/
"Do not worry about your difficulties in computers,
 I can assure you mine are still greater."

___
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] Re: Tab completion in zopectl debug

2006-10-18 Thread Maurits van Rees
Chris Withers, on 2006-10-18:
> Looks good, is there any way this can be done by putting more code in 
> do_debug and not usering .pythonrc.py?

Sure.  Instead of adding 'import user' in do_debug, you can add

  print "Hello Chris, good luck with your debugging session!";

or anything else you fancy.  Adding multiline statements probably
doesn't work that well.  So 'import user' seems cleaner to me.

> In any case, this would be cool, please add a feature request + patch in 
> the collector:

I'll experiment some more and listen to other reactions, but then I'll
look into adding some lines to the collector, yes, unless someone
beats me to it.

-- 
Maurits van Rees | http://maurits.vanrees.org/ [NL]
Work | http://zestsoftware.nl/
"Do not worry about your difficulties in computers,
 I can assure you mine are still greater."

___
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] Re: Tab completion in zopectl debug

2006-10-18 Thread Maurits van Rees
Sascha Ottolski, on 2006-10-18:
>> http://maurits.vanrees.org/weblog/2006/10/tab-completion.html
>
> just a thought: you might also use ipython, which has tab-completion by 
> default: http://ipython.scipy.org/moin/About

I saw that mentioned in one of the links on my page as well; looks
promising; I'll try it out, thanks.

The following also mention ipython in the light of zope:

http://tomster.org/blog/archive/2006/10/09/ipython-as-zope-shell

http://michaelthornhill.blogspot.com/2005/09/how-to-debug-zopeplone-with-ide.html

-- 
Maurits van Rees | http://maurits.vanrees.org/ [NL]
Work | http://zestsoftware.nl/
"Do not worry about your difficulties in computers,
 I can assure you mine are still greater."

___
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] Re: error with simple python script loop

2006-11-28 Thread Maurits van Rees
Christian Steinhauer, on 2006-11-24:
> i cant use pdb on zope´s python script i think?

You can, if you put this small (two lines) program in your Products
dir:

svn://svn.zope.org/repos/main/Products.enablesettrace

Not meant for production sites.

-- 
Maurits van Rees | http://maurits.vanrees.org/ [NL]
Work | http://zestsoftware.nl/
"Do not worry about your difficulties in computers,
 I can assure you mine are still greater."

___
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] zdb (was: error with simple python script loop)

2006-11-29 Thread Maurits van Rees
Chris Withers, on 2006-11-28:
> Paul Winkler wrote:
>> I still prefer zdb, because you can actually see and step through the
>> script code.
>> http://www.simplistix.co.uk/software/zope/zdb

Do you mean you can put this in a .cpy file:

  from Products.zdb import set_trace
  set_trace()

and then you can see the script code in the debugger?

When I try that I end up in the debugger, but I don't see anything
different from the normal pdb.set_trace().  When I press 'l' I just
see [EOF] like always.  Is there a trick I am missing?

It *would* be neat! :)

> It also includes the security declarations necessary to import it from 
> untrusted code :-)

Those security declarations are actually the only thing that
svn://svn.zope.org/repos/main/Products.enablesettrace itself does.

-- 
Maurits van Rees | http://maurits.vanrees.org/ [NL]
Work | http://zestsoftware.nl/
"Do not worry about your difficulties in computers,
 I can assure you mine are still greater."

___
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] Re: zope/zeo on multiprocessor machines?

2007-01-24 Thread Maurits van Rees
cristopher pierson ewing, on 2007-01-23:
> I've been told that zope is not set up to utilize the extra processing 
> power of multiproc machines.  I have a new intel x-serve with the 
> dual-core dual-proc setup, and want to get the most I can out of zope. 
> I've read a few articles that mention running more than one zope process 
> as zeo clients sharing a single ZODB.  What isn't mentioned is any 
> additional seetup needed to ensure that each zeo client uses a separate 
> processor.  Is there any?  Or is this automagically handled?

A site we (Zest Software) made for a big customer runs on a dual-core
server, with some multithreading so it seems like there are 4
processors.  With one zeo client, only at most 25 percent of the
processing power was used.  We added a few zeo clients and saw the
processor a lot more active, probably approaching 100 % when all
clients are fully active.  A big improvement, with no additional setup
that I am aware of.  So it is automagically handled, yes.

-- 
Maurits van Rees | http://maurits.vanrees.org/ [NL]
Work | http://zestsoftware.nl/
"Do not worry about your difficulties in computers,
 I can assure you mine are still greater."

___
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] Re: Which Products Folder?

2007-01-30 Thread Maurits van Rees
Frank Drews, on 2007-01-30:
> Hi,

Hi Frank,

> I am very new to Zope, Zope is running fine, but I dont know the 
> Products-Folder to copy new Products:

I have never run Zope on a Windows computer, so do not take my answer
to be the final word on this, but I will give it a go.

> zope 2.94
> C:\Programme\CPS3.4.0-3\Zope\lib\python\Products
> C:\Programme\CPS3.4.0-3\Zope\skel\Products

I have never used CPS, but I guess the directories are used in the
same way as normal Zope.  Adding anything here would only affect CPS,
not any Zope 2.9.4 instances.

> C:\Programme\Zope-2.9.4\lib\python\Products

This is the Products dir that is used by all Zope instances; it is a
part of core Zope .  Normally only core Zope products should be here
and you should not add anything to it manually.  But adding your own
products here *would* work I guess.  Try it when everything else
fails.

> C:\Programme\Zope-2.9.4\skel\Products

When you create a new Zope instance, this is the Products directory
that gets copied to that instance.  You could put some basic products
in here that you want to have in every new Zope instance that you
create.  But: adding products here will *only* affect *new* instances,
not instances that you have already made.

> ZMI is working fine, nuxeo cps, too.
> Have I to create a new Folder somewhere, I want to add Products like 
> calzope cpsgroupware?

These products should be added to the Zope instance.  The directories
you mention above contain source code used by instances, but they are
not instances themselves.

I would expect the Zope instance to have been created in Documents and
Settings or in My Documents; but that is a guess.  You could let
Windows search for any directories with the name 'Products'.  That
should turn up some more hits.  Or create a new Zope instance (maybe
call C:\Programme\Zope-2.9.4\bin\mkinstance or something like that)
and see where the instance is created.

> I have a similar problem with the Import folder. Which one is the right, 
> just importing inside a folder of the ZMI?

It should be a folder called 'import' in the same directory as the
Products directory of your instance.  It should be automatically
created for you when you create a new instance.

> Many thanks I am really stuck and tried for more than one day

I hope this helps.  My answers are based on my experience with Zope on
Linux though; Windows may handle things differently, so sorry if I am
putting you on the wrong track.

-- 
Maurits van Rees | http://maurits.vanrees.org/ [NL]
Work | http://zestsoftware.nl/
"Do not worry about your difficulties in computers,
 I can assure you mine are still greater."

___
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] bin/zopectl start not working for Zope 2.9.7

2007-03-26 Thread Maurits van Rees
Hi,

Maybe I just need a hit with a cluebat here.  But I just downloaded
the new Zope 2.9.7 tar ball (thanks Andreas and others who worked on
that!).  When I try bin/runzope or bin/zopectl fg or debug everything
looks fine.  But bin/zopectl start does nothing.

Has anyone else seen this?

I did the usual dance of ./configure, make, (sudo) make install.  The
configure options were:

./configure --with-python=/usr/bin/python --prefix=/opt/zope/zope2.9.7

Then I made a zope instance in ~/instances/t
/opt/zope/zope2.9.7/bin/mkzopeinstance.py

Then start the zope instance:

~/instances/t $ bin/zopectl start
. daemon process started, pid=15466

Then nothing seems to happen.  No log file is being made:

~/instances/t $ tail -f /home/maurits/instances/t/log/event.log
tail: cannot open `/home/maurits/instances/t/log/event.log' for reading: No 
such file or directory
tail: no files remaining

There is one process running:

$ pgrep -lf zope
15465 /usr/bin/python /opt/zope/zope2.9.7/lib/python/zdaemon/zdrun.py -S 
/opt/zope/zope2.9.7/lib/python/Zope2/Startup/zopeschema.xml -b 10 -d -s 
/home/maurits/instances/t/var/zopectlsock -x 0,2 -z /home/maurits/instances/t 
/home/maurits/instances/t/bin/runzope

and after a while that stops.

bin/zopectl fg meanwhile starts up zope just fine.


An alternative is to run 'make inplace' and 'make instance'  instead
of 'make install'.

Okay, so I removed the instance, unpacked a clean tar ball and did
configure, make, make inplace, make instance.  Again, bin/zopectl
start does not work, and foreground works fine.


I also just downloaded 2.8.9.  Let's first check if that might have
the same problem.  Ah, it at least has another problem:

$ /opt/zope/zope2.8.9/bin/mkzopeinstance.py 
...
[Errno 13] Permission denied: './README.txt'

and indeed:

$ ls -l /opt/zope/zope2.8.9/skel/README.txt 
-rw--- 1 root root 481 2007-03-25 11:33 /opt/zope/zope2.8.9/skel/README.txt

Ah, and when fixing this with a chmod some more errors like that creep up.

So after installing 2.8.9 as root or with sudo, mkzopeinstance does
not work.  This has happened to me with other Zope versions as well.
At least I remember reporting this earlier; and seeing it solved
fortunately. :)  It would seem the root source has not been
found/fixed though. :(

Any chance of fixing this?  Need any help Andrea?

-- 
Maurits van Rees | http://maurits.vanrees.org/ [NL]
Work | http://zestsoftware.nl/
"Do not worry about your difficulties in computers,
 I can assure you mine are still greater."

___
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] Re: bin/zopectl start not working for Zope 2.9.7

2007-03-26 Thread Maurits van Rees
Maurits van Rees, on 2007-03-26:
> So after installing 2.8.9 as root or with sudo, mkzopeinstance does
> not work.  This has happened to me with other Zope versions as well.
> At least I remember reporting this earlier; and seeing it solved
> fortunately. :)  It would seem the root source has not been
> found/fixed though. :(

Ah, it looks fixed on the 2.9 branch, but not 2.8.  In the sdist_tgz
target of the makefile the 2.9 branch has these two extra lines, which
I think need to be added to the 2.8 branch too:

   ${FIND} . -type f -exec chmod a+r {} \; 
   ${FIND} . -type d -exec chmod a+rx {} \; 


Meanwhile, this 2.8.9 has the same problem that I reported for 2.9.7:
bin/zopectl start does not work, though 'fg' does work.

-- 
Maurits van Rees | http://maurits.vanrees.org/ [NL]
Work | http://zestsoftware.nl/
"Do not worry about your difficulties in computers,
 I can assure you mine are still greater."

___
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] Re: bin/zopectl start not working for Zope 2.9.7

2007-03-26 Thread Maurits van Rees
Maurits van Rees, on 2007-03-26:
> Maurits van Rees, on 2007-03-26:
> Meanwhile, this 2.8.9 has the same problem that I reported for 2.9.7:
> bin/zopectl start does not work, though 'fg' does work.

And Zope 2.10.3 has this problem too for bin/zopectl start.

I just tried unpacking and making zope 2.10.2 and it goes fine there,
so this does not look like a sudden mishap on my system.

-- 
Maurits van Rees | http://maurits.vanrees.org/ [NL]
Work | http://zestsoftware.nl/
"Do not worry about your difficulties in computers,
 I can assure you mine are still greater."

___
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] [Solved] Re: bin/zopectl start not working for Zope 2.9.7

2007-03-26 Thread Maurits van Rees
Marking thread as solved, as that is exactly what Andreas has done.
See his reply in the thread
"Zope 2.8.9, Zope 2.9.7, Zope 2.10.3 released".

Andreas Jung, on 2007-03-26:
> Unfortunately I must confirm this issue :-(
> But I have no idea what's going on here :(

Apparently you found it after all. :)  Thanks.

-- 
Maurits van Rees | http://maurits.vanrees.org/ [NL]
Work | http://zestsoftware.nl/
"Do not worry about your difficulties in computers,
 I can assure you mine are still greater."

___
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] Re: Zope 2.8.9, Zope 2.9.7, Zope 2.10.3 released

2007-03-26 Thread Maurits van Rees
Andreas Jung, on 2007-03-26:
> I uploaded corrected versions of the Zope 2.9.7 and 2.10.3 tar-balls.
> The tar-balls released yesterday contained a bug that caused
> a startup failure when using "zopectl start".

Great, thank you!  I tested the new tar balls and they work fine now.

Any chance of doing this for 2.8.9 as well, as this has the same bug?

-- 
Maurits van Rees | http://maurits.vanrees.org/ [NL]
Work | http://zestsoftware.nl/
"Do not worry about your difficulties in computers,
 I can assure you mine are still greater."

___
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] Zope unusable on my Virtual Private Server

2007-04-23 Thread Maurits van Rees
Hi,

I recently got a virtual private server on server4you.nl.  All looked
fine, until I started trying to get Zope to run on it.

It is a Debian Sarge server.  I want Zope 2.9 on it, but even the zope
2.7 that this Debian version has official Debian packages for is
giving problems.  After starting up and trying to access it (from the
same box with lynx):

2007-04-23T22:37:58 ERROR(200) ZServer Server Error: thread.error, can't start 
new thread
: file: /usr/lib/zope2.7/lib/python/ZServer/PubCore/ZRendezvous.py line: 44

Zope is started as root here, with effective-user zope in the
etc/zope.conf.

Setting the stack size for root helps

# ulimit -a
core file size(blocks, -c) 0
data seg size (kbytes, -d) unlimited
file size (blocks, -f) unlimited
max locked memory (kbytes, -l) unlimited
max memory size   (kbytes, -m) unlimited
open files(-n) 1024
pipe size  (512 bytes, -p) 8
stack size(kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes(-u) unlimited
virtual memory(kbytes, -v) unlimited
# ulimit -s unlimited


Then when I startup Zope it seems I can actually browse the site okay
with lynx.  So there might be possibilities after all.

Trying with a Zope 2.9.4 or 2.9.7 (compiled with python 2.4.1) gives
me no luck.  Even while starting it with root and using that unlimited
stack size I get thread errors like above or others errors like below:

  File "/opt/zope/zope2.9.7/lib/python/AccessControl/Implementation.py", line 
98, in ?
setImplementation("C")
  File "/opt/zope/zope2.9.7/lib/python/AccessControl/Implementation.py", line 
51, in setImplementation
from AccessControl import ImplC as impl
  File "/opt/zope/zope2.9.7/lib/python/AccessControl/ImplC.py", line 30, in ?
from ImplPython import RestrictedDTML, SecurityManager, ZopeSecurityPolicy
ImportError: No module named ImplPython

[that module really is there]

or:

  File "/usr/lib/python2.4/logging/__init__.py", line 29, in ?
import sys, os, types, time, string, cStringIO
ImportError: /usr/lib/python2.4/lib-dynload/time.so: failed to map segment from 
shared object: Cannot allocate memory

And when it does run, a 'bin/zopectl stop' sometimes is enough to
throw those errors again.

The most basic commands can cause memory allocation errors when zope
is running:

# free
bash: fork: Cannot allocate memory

When nothing is running, I get the idea that there should be more than
enough memory to start zope nicely.

$ free
 total   used   free sharedbuffers cached
Mem:262144  83952 178192  0  0  0
-/+ buffers/cache:  83952 178192
Swap:0  0  0

And with one zope running, about 117 MB is used, so there should be
plenty left.  But apparently not.  Or some other part of the OS is at
its max.

doc/PLATFORMS in the zope tarball has some remarks about thread
errors, advising to configure python with a higher THREAD_STACK_SIZE.
But that is for BSD or AIX.  My OS is Debian Linux, but maybe the OS
of the computer that hosts this virtual server runs BSD or AIX.  Could
that help then?

Compiling python on such a system is difficult of course.  With the
normal gcc it is impossible.  With distcc, using my home computer as
the compile machin, I came further, but it failed somewhere.  The
problem there might be that my home computer runs a more recent
Ubuntu, not Debian Sarge.


Well, in the end I am left with the feeling that this server might not
be good enough for Zope.  I have not yet asked the sys admins for
help, but I do not really know what to ask them, except for my money
back.

Is there anything else I can try?

-- 
Maurits van Rees | http://maurits.vanrees.org/ [NL]
Work | http://zestsoftware.nl/
"Do not worry about your difficulties in computers,
 I can assure you mine are still greater."

___
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] Conditional import of annotations for Zope 2.9 and 2.10: how?

2007-05-14 Thread Maurits van Rees
Hi,

In Zope 2.9 (or 3.2) the annotations module is in
zope.app.annotations.  In Zope 2.10 (or 3.3) it is in
zope.annotations.

In a product for zope 2.9 I used to do this in zcml:

  

and this in code:

from zope.app.annotation.interfaces import IAnnotations
from zope.app.annotation.interfaces import IAttributeAnnotatable

This of course gives problems in zope 2.10/3.3.

The code part is easily fixable to run in all versions:

try:
from zope.app.annotation.interfaces import IAnnotations
from zope.app.annotation.interfaces import IAttributeAnnotatable
except:
# Zope 2.10+/3.3+ have a different location for annotations
from zope.annotation.interfaces import IAnnotations
from zope.annotation.interfaces import IAttributeAnnotatable

But how should I fix up the zcml?  With the zcml above, zope 2.10 does
not start.  With this:

  

zope 2.9 does not start.  That is to be expected.  zcml:condition to
the rescue:

  
  
  
  

Zope 2.9 is fine with this.  And the tests for my product that make
use of annotations pass.  But now zope 2.10 cannot start:

zope.configuration.xmlconfig.ZopeXMLConfigurationError: File 
"/home/maurits/instances/plone3/etc/site.zcml", line 15.2-15.23
ZopeXMLConfigurationError: File 
"/home/maurits/instances/plone3/Products/eXtremeManagement/configure.zcml", 
line 7.2-7.31
ZopeXMLConfigurationError: File 
"/home/maurits/instances/plone3/Products/eXtremeManagement/actual/configure.zcml",
 line 6.2-7.43
IOError: [Errno 2] No such file or directory: 
'/opt/zope/zope2.10.3/lib/python/zope/app/annotation/configure.zcml'


So I change the code so both zopes can start:

  
  
  
  

Now zope 2.10 looks fine.  Its tests fail but that is due to other
reasons.  Within a zopectl debug session I can adapt to IAnnotations.
But now the tests in 2.9 fail because adapting does not work:

TypeError: ('Could not adapt', ,
 )


So: neither the conditions 'have' nor 'installed' work for both zopes.

What other options are there to do this in zcml?

Or should I take my loss and translate the
zope/(app/)annotations/configure.zcml file (which only registers one
adapter) into python code?

-- 
Maurits van Rees | http://maurits.vanrees.org/ [NL]
Work | http://zestsoftware.nl/
"Do not worry about your difficulties in computers,
 I can assure you mine are still greater."

___
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] Re: Conditional import of annotations for Zope 2.9 and 2.10: how?

2007-05-14 Thread Maurits van Rees
Raphael Ritz, on 2007-05-14:
> More a workaround than a solution but have you tried
> doing it the "new way" (Zope-2.10) and introducing
> backwards compatibility via a module alias to make
> zope.annotations also available as zope.app.annotations?

Ah, that might work yes.

Hm, I had problems getting it to work, and I think I have it the other
way around than what you said.  The python code and the zcml only use
zope.annotation now and I make sure that in 2.9 zope.app.annotation is
available under the module name zope.annotation.

And I need to do the same for zope.(app.)annotation.interfaces,
otherwise problems still remain.  So I now have the following in my
__init__.py:

try:
import zope.annotation
except ImportError:
# BBB for Zope 2.9
import zope.app.annotation
import zope.app.annotation.interfaces
import sys
sys.modules['zope.annotation'] = zope.app.annotation
sys.modules['zope.annotation.interfaces'] = zope.app.annotation.interfaces


Then it works.  Thanks!

If someone knows a better way to do this with some condition in zcml
(not the ones that failed for me in the original message) then that
would still be appreciated.


BTW, for the python code a conditional import is not even really
necessary: in zope 2.10 (or 3.3) you simply get a DeprecationWarning
that zope.app.annotation will be removed in ope 3.5.  But there is no
such deprecation for the zcml file: it has simply been removed.

Hm: for this reason it would be nice to still have the original zcml
file in there.  Then including that zcml would still work though you
get a DeprecationWarning.  Actually, that zcml file should then look
like this:

  http://namespaces.zope.org/zope";>



  

That would work for me too: I just tried it.  Should I propose this on
the zope 3 dev list?  I do not currently read that list btw.

-- 
Maurits van Rees | http://maurits.vanrees.org/ [NL]
Work | http://zestsoftware.nl/
"Do not worry about your difficulties in computers,
 I can assure you mine are still greater."

___
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] Re: Conditional import of annotations for Zope 2.9 and 2.10: how?

2007-05-17 Thread Maurits van Rees
Maurits van Rees, on 2007-05-14:
> Hm: for this reason it would be nice to still have the original zcml
> file in there.  Then including that zcml would still work though you
> get a DeprecationWarning.  Actually, that zcml file should then look
> like this:
>
> xmlns="http://namespaces.zope.org/zope";>
>
> 
>
>  
>
> That would work for me too: I just tried it.  Should I propose this on
> the zope 3 dev list?  I do not currently read that list btw.

I just reported it here:

https://bugs.launchpad.net/zope3/+bug/115243

-- 
Maurits van Rees | http://maurits.vanrees.org/ [NL]
Work | http://zestsoftware.nl/
"Do not worry about your difficulties in computers,
 I can assure you mine are still greater."

___
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] Re: Function reindexObject()

2007-05-30 Thread Maurits van Rees
julian, on 2007-05-30:
>>> I want rebuil all product in zope2.9 in the same directory as zope 2.7.
>>> I have the same structure for zope 2.7 and zope 2.9.
>> But where is the problem? What are 'products' for you and what do you
>> mean by rebuild? Where are folders like /SITES/plone_mySite/? Is this
>> filesystem path or path in your ZODB? What are your scripts? External
>> methods?
>
> In fact my scripts are external methods. For me a product is a document, 
> a file and my own product (a product is made with a schema.py...). The 
> folder /SITES/plone_mySite/ is in my ZMI (http://zope.mop.com:75473/manage).
> My problem is I want add the product in my new ZMI(zope2.9) in the same 
> directory as old ZMI (zope2.7). At this time all products are added in 
> /SITES/plone_mySite/...
>
> I hope it's more comprehensible.

Well, at least I do not know what this would have to do with the
subject of your post: reindexObject.

But anyway, it sounds like your imported content is ending up in
folder A and you want it in folder B instead.  Then the easiest seems
to do one of the following manually in the ZMI:

- rename folder A to folder B

or

- create folder B and move the imported contents of folder A into
  folder B


But I think I misunderstand you, sorry.

-- 
Maurits van Rees | http://maurits.vanrees.org/ [NL]
Work | http://zestsoftware.nl/
"Do not worry about your difficulties in computers,
 I can assure you mine are still greater."

___
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] Re: review_state

2007-06-01 Thread Maurits van Rees
julian, on 2007-06-01:
> from Products.CMFCore.utils import getToolByName
> from Products.CMFCore.permissions import ManagePortal
>
> query = {'portal_type' : 'Document',
>  }
>
> for prestataire in self.portal_catalog.searchResults(query):
>presta_obj = prestataire.getObject()
>wflow = getToolByName(presta_obj, "portal_workflow", None)
>if wflow is not None:
> review_state = wflow.getInfoFor(presta_obj, "review_state")
> -
>
> So review_state = published or visible...
>
> My problem is resolve :)

Great!

Some notes that may still help:

- I would expect review_state to be in the catalog as well, so instead
  of using getObject first you could do:

  review_state = prestataire.review_state

- Should you then also want the title or name of the state:

  review_state_title = wflow.getTitleForStateOnType(
 review_state, 'Document')

-- 
Maurits van Rees | http://maurits.vanrees.org/ [NL]
Work | http://zestsoftware.nl/
"Do not worry about your difficulties in computers,
 I can assure you mine are still greater."

___
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] Re: How to execute code at startup?

2007-06-12 Thread Maurits van Rees
Matthew X. Economou, on 2007-06-12:
> I have a very simple script that copies my production Zope instance to
> a fresh test instance.  I have some Python code that I need to execute
> when the test instance starts for the first time (it only needs to
> execute once, but it won't hurt Zope if it executes every time the
> test instance starts.  I usually execute this code interactively, from
> the Zope debugger:
>
> app.restrictedTraverse("/irtnog/portal_cache_settings").setCacheConfig
> ('zope')
>
> Is there any way to execute this code (or something similar)
> automatically?  I guess the alternative is that I could script the
> process of entering the Zope debugger and running the above using
> Expect or something.

The first approach that spring to mind is hackish.

In your script that copies your production instance, add a line that
copies an extra product to the Products directory.  That product
should probably be named 'ZZZHack' so that it gets loaded only at the
very end after all other products have been loaded.

Then you add a line like the above in the __init__.py of that product.


Second, probably better, approach that comes to mind: forget about
that Product.  After you copied the instance, call:

  bin/zopectl run setcache.py

where setcache.py only contains that line above I think.  Maybe add
"import transaction; transaction.commit()" after that.


-- 
Maurits van Rees | http://maurits.vanrees.org/ [NL]
Work | http://zestsoftware.nl/
"Do not worry about your difficulties in computers,
 I can assure you mine are still greater."

___
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] Re: 2.9.7 build fails: 'build/lib/linux-i686-2/5/pytz/zoneinfo/Antarctica' does not exist

2007-06-13 Thread Maurits van Rees
Mikko Ohtamaa, on 2007-06-13:
> I am trying to build Zope 2.9.7 on Ubuntu Feisty Fawn 7.04. I am
> probably enjoying some sort of configuration error. Though I have
> installed python-tz package, the installer barks about missing
> 'Antarctica'. I haven't seen this error with previous Zope builds.
>
> [EMAIL PROTECTED]:~/Zope-2.9.7-final$ make
> "/usr/bin/python2.4" "/home/moo/Zope-2.9.7-final/setup.py" \
> build
> --build-base="/home/moo/Zope-2.9.7-final/build-base/python-2.4"
> --build-lib="/home/moo/Zope-2.9.7-final/build-base/python-2.4/build-lib"
> --build-scripts="/home/moo/Zope-2.9.7-final/build-base/python-2.4/build-scripts"
> --build-temp="/home/moo/Zope-2.9.7-final/build-base/python-2.4/build-temp"
> running build
> running build_py
> error: package directory
> 'build/lib/linux-i686-2/5/pytz/zoneinfo/Antarctica' does not exist
> make: *** [build] Error 1
>
> Any ideas?

Antarctica has melted due to global warming.

I could not resist. :)

It worked fine last time I tried it on my Ubuntu Feisty.  You ran
"./configure --with-python=python2.4", right?  Yes, it looks like you
did.

Do you have the python2.4-dev package installed?

-- 
Maurits van Rees | http://maurits.vanrees.org/ [NL]
Work | http://zestsoftware.nl/
"Do not worry about your difficulties in computers,
 I can assure you mine are still greater."

___
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] Re: zope stopped working suddenly

2007-06-13 Thread Maurits van Rees
Mohammed Tlais, on 2007-06-13:
> Greetings
> First , I am glad to join you at this list. I installed Zope on Fedora Core
> 6, and started to learn how to use it. for a few days i was able to access
> the management interface (ZMI) through http://127.0.0.1:8080 after starting
> zope through .../zopectl start. but as a sudden I found myself unable to
> enter to the ZMI anymore. The browser displays  an error as if zope is not
> started at all.
> I am a newbie in both Linux and Zope, so please can anyone pass me some tips
> on how to check what is causing the problem and how to solve it?

Two options:

1. Look for errors in the log/event.log file of your zope instance.

2. Start Zope with bin/zopectl fg

That last one will start zope in the foreground, which will let you
see any warnings and errors that it runs into when starting up.

-- 
Maurits van Rees | http://maurits.vanrees.org/ [NL]
Work | http://zestsoftware.nl/
"Do not worry about your difficulties in computers,
 I can assure you mine are still greater."

___
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] Re: 2.9.7 build fails: 'build/lib/linux-i686-2/5/pytz/zoneinfo/Antarctica' does not exist

2007-06-13 Thread Maurits van Rees
Mikko Ohtamaa, on 2007-06-13:
>>> error: package directory
>>> 'build/lib/linux-i686-2/5/pytz/zoneinfo/Antarctica' does not exist
>>> make: *** [build] Error 1
>
> Solved it.
>
> You must run python setup.py install as root and *do not* run  make,
> configure, etc. before as a normal user.

Ehm... you should not run "python setup.py install" at all!

The usual way to install zope from a tar ball is:

./configure
# or ./configure --with-python=python2.4 --prefix=directory-of-your-choice
make
sudo make install

-- 
Maurits van Rees | http://maurits.vanrees.org/ [NL]
Work | http://zestsoftware.nl/
"Do not worry about your difficulties in computers,
 I can assure you mine are still greater."

___
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] Packing the Data.fs with wget fails since 2.9.7

2007-06-14 Thread Maurits van Rees
Hi,

This blog entry shows how to use wget to pack the zope database, which
you can then put in a cronjob to call each day or week:

http://blogs.translucentcode.org/mick/2004/03/10/using_wget_to_pack_zope/

It is just one line:

wget -q http://username:[EMAIL 
PROTECTED]:8080/Control_Panel/Database/manage_pack?days:float=0

But as a comment on that blog shows: this does not work anymore.  Zope
now requires that you visit that form using POST, which is not what
wget is doing automatically.  So you get an error in your event.log
like this:

2007-06-13T18:43:41 ERROR Zope.SiteErrorLog 
http://localhost:9080/Control_Panel/Database/manage_pack
Traceback (innermost last):
  Module ZPublisher.Publish, line 115, in publish
  Module ZPublisher.mapply, line 88, in mapply
  Module ZPublisher.Publish, line 41, in call_object
  Module , line 3, in _facade
  Module AccessControl.requestmethod, line 52, in _curried
Forbidden: Request must be POST

I have tried adding POST data to the wget call.  Then you get this and
other variations:

wget -q --post-data='days:float=1&submit=Pack' \
http://user:[EMAIL PROTECTED]:8080/Control_Panel/Database/manage_pack

But that gives other errors:

Unauthorized: Your user account does not have the required permission.
Access to 'title_or_id' of (DatabaseChooser at
/Control_Panel/Database) denied. Your user account, Anonymous User,
exists at (unknown). Access requires one of the following roles:
['Manager']. Your roles in this context are ['Anonymous'].

For zeo I could use the bin/zeopack.py from the zope software home,
but not for non-zeo zope servers.

Does anybody know a solution?

-- 
Maurits van Rees | http://maurits.vanrees.org/ [NL]
Work | http://zestsoftware.nl/
"Do not worry about your difficulties in computers,
 I can assure you mine are still greater."

___
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] Re: a warning message before performing an action

2007-06-14 Thread Maurits van Rees
Alan, on 2007-06-14:
> Dears,
>
> I have a web page with some buttons ( action (by calling a python script). However, some actions (like
> 'delete' a picture for example) I would like to warn user before
> performing it. I recall from php how to pop up a window (or a drop
> down in Mac OSX) with a warning message prompting a 'Yes' or 'No'
> confirmation and I was wondering how would I do it with Zope, with an
> example if possible.

In CMFPlone the 'delete' action leads to the delete_confirmation page
template.  This asks the user if he is sure that he wants to delete
the item.  Maybe you can borrow some code from that?

See:

http://dev.plone.org/plone/browser/CMFPlone/branches/2.5/skins/plone_forms/delete_confirmation.cpt

though for some reason nothing is currently visible there.

-- 
Maurits van Rees | http://maurits.vanrees.org/ [NL]
Work | http://zestsoftware.nl/
"Do not worry about your difficulties in computers,
 I can assure you mine are still greater."

___
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] Re: Packing the Data.fs with wget fails since 2.9.7

2007-06-15 Thread Maurits van Rees
Andreas Jung, on 2007-06-14:
> Write a PythonScript within the ZMI that calls the pack operation.
> Then call *this* script through wget.

I have found an alternative with urllib2.  I added it to
instancemanager.  For those interested, see this changeset:

http://dev.plone.org/collective/changeset/43815

Basically it is this:

import urllib2
import base64
# Create a request
req = urllib2.Request(url="http://localhost:8080/Control_Panel/
  Database/manage_pack?days:float=7")
# Add an authorization header 
auth = base64.encodestring("user:password") 
req.add_header('Authorization', "Basic %s" % auth) 
# Use POST instead of GET: needed at least in Zope 2.9.7  
req.add_data('POST')
info = urllib2.urlopen(req)

-- 
Maurits van Rees | http://maurits.vanrees.org/ [NL]
Work | http://zestsoftware.nl/
"Do not worry about your difficulties in computers,
 I can assure you mine are still greater."

___
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] Re: Zope 2.10.4 Upgrade

2007-07-12 Thread Maurits van Rees
David Ayres, on 2007-07-12:
> I recently upgraded from Zope 2.10.0 to 2.10.4. However, the Zope instance
> still reflects 2.10.0 in the control panel. 
>  
> I installed Zope 2.10.4. Then, in my instance, I changed the variables in
> 'zopectl' and 'zope.conf' to reflect the new 2.10.4 version and restarted.
> Did I miss a step?

You can run a mkzopeinstance over an existing instance and those
things will be upgraded.  Not completely sure what happens to any
modifications to the zope.conf file.

-- 
Maurits van Rees | http://maurits.vanrees.org/ [NL]
Work | http://zestsoftware.nl/
"Do not worry about your difficulties in computers,
 I can assure you mine are still greater."

___
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] Re: html2pdf

2007-07-12 Thread Maurits van Rees
Garry Saddington, on 2007-07-12:
> I am trying to use html2pdf and htmldoc to generate pdfs on the fly. I can 
> get 
> it to work perfectly if I set all view permissions for anonymous. However, 
> this is not suitable for a member only site. Can anyone point me in the right 
> direction for such use?
>
>   I am using:
> (Zope 2.9.0, python 2.4.2, win32) and  latest version of html2pdf.

I would simply say: set the view permissions to Member and not to
Anonymous.  Then report back here with any errors you get.

-- 
Maurits van Rees | http://maurits.vanrees.org/ [NL]
Work | http://zestsoftware.nl/
"Do not worry about your difficulties in computers,
 I can assure you mine are still greater."

___
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] Re: Installation trouble

2007-07-31 Thread Maurits van Rees
Aaron Korostyshevsky, on 2007-07-31:
> I am trying to install Zope on my PC and the installation tells me that I 
> need to have Python 2.4 installed.  I have just installed Python 2.5.1 and 
> I still get the same message.  Do I need to downgrade Python or is there 
> another problem?

No Zope version currently works with python 2.5.  Or at least it is
not supported.  You can always force zope to use 2.5 by doing
"./configure --with-python=python2.5" but you will probably run into
problems.

But usually it is no problem to install more than one python on the
same machine.  If 2.5 and 2.4 are installed side by side, the
./configure of Zope will choose the 2.4 one.

So: keep 2.5 if you want, but also install 2.4.

-- 
Maurits van Rees | http://maurits.vanrees.org/ [NL]
Work | http://zestsoftware.nl/
"Do not worry about your difficulties in computers,
 I can assure you mine are still greater."

___
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] Re: Trouble migrating from Zope 2.5.x to Zope 2.9.x

2007-08-09 Thread Maurits van Rees
Doug Morse, on 2007-08-09:
> Hello Fellow Zopers,
>
> I'm trying to migrate an older Zope installation (2.5.x) to Zope 2.9 and I'm
> having some trouble.  I can mount the old ZODB in the new installation -- it
> shows up under the database control panel with the correct size (4.4M) --
> but it appears to be empty.  By "empty", I mean there are no folders or
> objects present when I view the mount point using the ZMI, and I get
> "Resource Not Found" errors when trying to view object I know to be there.
> I'm not getting any error messages within the ZMI or in the events.log file
> regarding problems with the older Data.fs file or mounting it.

A 4.4 MB Data.fs *is* rather empty.  That is only marginally bigger
than the size you get when you start with a fresh zope instance.  Are
you sure the objects you expect are actually there when you start a
2.5 Zope with this database?

> I'm wondering if there's some sort of "upgrading" of the ZODB file I need to
> perform?  Any help with this would be MOST appreciated, as I'm not turning
> up anything in the docs, with google, or any other means I can think of, and
> I need to get this site migrated.

Not sure, but you might need to first upgrade to 2.6, then 2.7, then
2.8, then 2.9.  At least I would not be surprised if that is the case.

> Just for completeness: The only thing different about the new Zope
> installation is that the old Data.fs file is being mounted within Zope under
> a subdirectory (e.g., "/sitename") instead of the root directory (i.e.,
> "/"). There's a new ZODB mounted at the root directory, and several other
> new ZODBs mounted in other subdirectories for new sites -- they all
> work fine but also were created using Zope 2.9, not Zope 2.5.

I would first migrate the 2.5 database to 2.9 in a separate zope
instance with only this database, not any others.  After that you can
try mounting that migrated database together with the others.  This is
just a guess though: I have never tried anything like this.

-- 
Maurits van Rees | http://maurits.vanrees.org/ [NL]
Work | http://zestsoftware.nl/
"Do not worry about your difficulties in computers,
 I can assure you mine are still greater."

___
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] Re: Help with DateTime.earliestTime()

2007-08-27 Thread Maurits van Rees
Eric, on 2007-08-26:
> To work around this, I've modified the addition so that instead of adding 1 
> day, it adds 1.5 days.  This extra half a day is removed by the 
> theDateTime.earliestTime() call but is enough to overcome the DST addition 
> problem. Ugly hack.

I had the same problem once in the eXtremeManagement Plone product.
For a monthly overview I needed to do something for every day of the
month.  I worked around it with the code below.

day = 1
date = DateTime(2007, 10, 1) # 1 October 2007
while True:
# skipped some lines irrelevant to the DateTime problem
day += 1
try:
date = DateTime(self.year, self.month, day)
except:
break

Hm, that should probably be "except DateTime.DateTime.DateError" but
there is not really anything else that can go wrong here.

-- 
Maurits van Rees | http://maurits.vanrees.org/ [NL]
Work | http://zestsoftware.nl/
"Do not worry about your difficulties in computers,
 I can assure you mine are still greater."

___
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] Re: Help with DateTime.earliestTime()

2007-08-28 Thread Maurits van Rees
J Cameron Cooper, on 2007-08-27:
> Maurits van Rees wrote:
>> Hm, that should probably be "except DateTime.DateTime.DateError" but
>> there is not really anything else that can go wrong here.
>
> A ConflictError can go wrong here, which is an additional and important 
> reason not to have a bare except. There are good reasons without that, 
> as well.

Well, you are right of course.  I fixed it.  Thanks for keeping me
sharp. :)

-- 
Maurits van Rees | http://maurits.vanrees.org/ [NL]
Work | http://zestsoftware.nl/
"Do not worry about your difficulties in computers,
 I can assure you mine are still greater."

___
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] Re: repozo.py problems

2007-11-07 Thread Maurits van Rees
Jim Dibb, on 2007-11-07:
> I'm going to dig up something that's really troubling me today, and a
> "Martin Koekenberg" in the past.
>
> Martin first posted the following about repozo.py.
> Traceback (most recent call last):
>   File "C:\Program Files\Plone 3\Zope\bin\repozo.py", line 76, in 
> from ZODB.FileStorage import FileStorage
> ImportError: No module named ZODB.FileStorage

I must say I saw this error today as well on a Linux server.  But when
I ran the same repozo command again two seconds later it *did* work.
Very strange.  Apparently you are less lucky. :-/

No idea for how to solve this, sorry.

-- 
Maurits van Rees | http://maurits.vanrees.org/ [NL]
Work | http://zestsoftware.nl/
"Do not worry about your difficulties in computers,
 I can assure you mine are still greater."

___
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] Portal catalog not always finding my content type

2007-11-28 Thread Maurits van Rees
Hi,

In some test code I add a custom content type called School.  Then I
check if it has been added to the portal catalog.  And I call a
function in a PAS plugin that searches for a School within the catalog
and does something with that.  This all works.  Tests pass.  I am
happy.

But in practice it somehow does not work.  In the portal_catalog
within the ZMI I can clearly see that a School is present in the
catalog.  But the code in my PAS plugin does not find it.  And in a
zopectl debug session I also cannot find it.

Here is some code I use.  Product is another custom content type.

  cat = getToolByName(self, 'portal_catalog')
  assert(len(cat()) > 5)
  assert(len(cat(portal_type='Product')) > 5)
  assert(len(cat(portal_type='School')) > 0)

The first two assertions pass, so the catalog seems to be functioning
properly.  The last assertion fails.

Can anyone think of a reason why this could happen?  Should I add some
more parameters to the catalog call?  Should I use searchResults
instead, or queryCatalog?


This is on Plone 3.0 btw, with Zope 2.10.5.  CMFPlone overwrites the
default CatalogTool from zope, so I thought about asking on a plone
list instead.  But since it *does* go correct in the tests I thought
it was probably not something Plone specific.  Feel free to direct me
to a different list though. :)

Thanks,

-- 
Maurits van Rees | http://maurits.vanrees.org/ [NL]
Work | http://zestsoftware.nl/
"Do not worry about your difficulties in computers,
 I can assure you mine are still greater."

___
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] Re: Portal catalog not always finding my content type

2007-11-29 Thread Maurits van Rees
Tres Seaver, on 2007-11-29:
> One of the overrides in the CMF catalog tool (and inherited in the Plone
> version, AFAIK) is filtering out content which the user wouldn't be
> permitted to view if she did find it.  Are you sure that your School
> object is in an appropriate workflow state for the user to find?

D'oh!  That sounds entirely plausible.  I should have thought of that.
Trying it now.  Yes, that's it. :)

> You should be able to look at the content of the catalog (on its
> "Catalog" tab) and find your School object.  Look at the content of the
> 'allowedRolesAndUsers' index for that object:  does it say something
> like '("Manager",)"?

Yes, Manager and some other roles.  I published the item and now
Anonymous is in that list.  And that makes my PAS plugin work.  Phew!

Thanks!

-- 
Maurits van Rees | http://maurits.vanrees.org/ [NL]
Work | http://zestsoftware.nl/
"Do not worry about your difficulties in computers,
 I can assure you mine are still greater."

___
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] NamedTemplate.__call__ not returning anything

2008-01-13 Thread Maurits van Rees
Hi,

I have some code where I try to get a named template and render it and
if it fails I render a default template instead.  But this fails,
presumably because the __call__ method of NamedTemplate does not
return anything.  From zope/formlib/namedtemplate.py (Zope 2.10):

class NamedTemplate(object):

def __init__(self, name):
self.__name__ = name

def __get__(self, instance, type=None):
if instance is None:
return self
return component.getAdapter(instance, INamedTemplate, self.__name__)

def __call__(self, instance, *args, **kw):
self.__get__(instance)(*args, **kw)

I seems strange to me that __call__ does not actually return
anything.  Is it just me?

Now, I have some other code where NamedTemplate is working just fine,
so there is probably nothing wrong with this __call__ method.  So can
anybody tell me what is wrong with my following code then?

class Renderer(base.Renderer):
default_template = ViewPageTemplateFile('vocabularyportlet.pt')

def render(self):
"""Render a named template or the default template.
"""
template = NamedTemplate("test.vocabulary")
try:
output = template(self)
except ComponentLookupError:
output = None
# Even if the component lookup works, output can be None.
if output is None:
output = self.default_template()
return output

The line "output = template(self)" fails with a ComponentLookupError
unless a named template with the name test.vocabulary exists.  But
when that template is found, output is still None.

In case you want to see the entire code, this is in a Plone portlet
that I am developing:
http://svn.plone.org/svn/collective/collective.portlet.vocabulary/trunk/collective/portlet/vocabulary
 

And actually, the tests that I added pass when I change the
NamedTemplate.__call__ method to return the value that it just got.

So should that method be changed or is there a different way to do this?

Thanks,

-- 
Maurits van Rees | http://maurits.vanrees.org/
Work | http://zestsoftware.nl/
"This is your day, don't let them take it away." [Barlow Girl]

___
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] Re: NamedTemplate.__call__ not returning anything

2008-01-14 Thread Maurits van Rees
Dieter Maurer, on 2008-01-14:
> Maurits van Rees wrote at 2008-1-13 23:32 +:
>>I have some code where I try to get a named template and render it and
>>if it fails I render a default template instead.  But this fails,
>>presumably because the __call__ method of NamedTemplate does not
>>return anything.  From zope/formlib/namedtemplate.py (Zope 2.10):
>>
>>class NamedTemplate(object):
>>
>>def __init__(self, name):
>>self.__name__ = name
>>
>>def __get__(self, instance, type=None):
>>if instance is None:
>>return self
>>return component.getAdapter(instance, INamedTemplate, self.__name__)
>>
>>def __call__(self, instance, *args, **kw):
>>self.__get__(instance)(*args, **kw)
>>
>>I seems strange to me that __call__ does not actually return
>>anything.  Is it just me?
>
> It returns only if you use "return" (otherwise, it returns "None").
>
> Thus, try "return self.__get__()".

I know. :) I think you misunderstood me there.  This class is from
core Zope (zope.formlib.namedtemplate).  So to refrase my question:
why does this call method not do "return self.__get()"?  Looks
like a bug to me, but this line has been there since 2005 and named
templates do seem to work fine, so I am confused.

-- 
Maurits van Rees | http://maurits.vanrees.org/
Work | http://zestsoftware.nl/
"This is your day, don't let them take it away." [Barlow Girl]

___
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] Re: NamedTemplate.__call__ not returning anything

2008-01-14 Thread Maurits van Rees
Maurits van Rees, on 2008-01-14:
> Dieter Maurer, on 2008-01-14:
>> Maurits van Rees wrote at 2008-1-13 23:32 +:
>>>I have some code where I try to get a named template and render it and
>>>if it fails I render a default template instead.  But this fails,
>>>presumably because the __call__ method of NamedTemplate does not
>>>return anything.  From zope/formlib/namedtemplate.py (Zope 2.10):
>>>
>>>class NamedTemplate(object):
>>>
>>>def __init__(self, name):
>>>self.__name__ = name
>>>
>>>def __get__(self, instance, type=None):
>>>if instance is None:
>>>return self
>>>return component.getAdapter(instance, INamedTemplate, self.__name__)
>>>
>>>def __call__(self, instance, *args, **kw):
>>>self.__get__(instance)(*args, **kw)
>>>
>>>I seems strange to me that __call__ does not actually return
>>>anything.  Is it just me?
>>
>> It returns only if you use "return" (otherwise, it returns "None").
>>
>> Thus, try "return self.__get__()".
>
> I know. :) I think you misunderstood me there.  This class is from
> core Zope (zope.formlib.namedtemplate).  So to refrase my question:
> why does this call method not do "return self.__get()"?  Looks
> like a bug to me, but this line has been there since 2005 and named
> templates do seem to work fine, so I am confused.

Actually, when I remove that __call__ method from namedtemplate.py,
the zope.formlib tests still pass (and in fact all 5868 tests from
bin/test.py pass).  Tested on the Zope 2.10 branch.

So I would say: either the call method should be fixed by making it
return the value it has just calculated, or it should be removed.


When I remove the call method, my own code sill throws an error, a
different one now:

AttributeError: NamedTemplateImplementation instance has no __call__ method

For a minute I thought I could work around that by directly using the
only line from the above class that I really need:

template = getAdapter(self, INamedTemplate, 'myname')

But that still throws the same AttributeError.

I must be doing something strange...

-- 
Maurits van Rees | http://maurits.vanrees.org/
Work | http://zestsoftware.nl/
"This is your day, don't let them take it away." [Barlow Girl]

___
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] Re: suddenly confused

2008-01-18 Thread Maurits van Rees
Jim Washington, on 2008-01-19:
> David Bear wrote:
>> I'm doing my first zeo setup, and suddenly I'm not sure about my
>> products directory. Do I put all products in a products directory of
>> the zeo server or in each zope instance?
>>
>>   
> IIRC, Products go in each zope instance.  The zeo instance gets the ZODB.

Correct.

And there is nothing wrong with using the same Products directory for
all zope instances (well, you would call them zeo clients really).

So: make the Products directory of the second instance a symbolic link
to the first one.  Or edit the zope.conf file of the second one and
point to the Products dir of the first one in the products directive.

-- 
Maurits van Rees | http://maurits.vanrees.org/
Work | http://zestsoftware.nl/
"This is your day, don't let them take it away." [Barlow Girl]

___
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] Re: [buildout] bootstrap and develop

2008-01-29 Thread Maurits van Rees
Janko Hauser, on 2008-01-27:
> Hello, I'm using the infrae.subversion recipe to collect various  
> Products and packages from our subversion. The main goal here is, to  
> not use svn:externals. But the buildout directive "develop=src/..."  
> seems to have the requirement, that the packages are already present  
> if bootstrap.py is called. So it is not possible to place packages  
> there with buildout and get them picked up.
>
> 1. Is this correct? I searched and found others have the same problem.

I see the same problem.

> 2. What would be alternatives or how can this be changed?

You can use the z3c.recipe.egg:editable recipe.  I briefly tried that,
but it did not work for our (Zest Software) internal password
protected subversion repository, where we keep the code for our
clients.  The recipe tries to easy_install a package but it fails as
it cannot use our repository without a password.

In all other cases it should work though.  I thought there was another
problem that I saw with it.  Ah yes, it throws errors when buildout is
used in non-newest or in offline mode.  I suspect this can be fixed,
but I never reported it.  Feel free to do so.

Anyway, the following worked last time I tried it:

=
[xm-development] 
recipe = z3c.recipe.egg:editable 
find-links =  
https://svn.plone.org/svn/collective/xm.booking/trunk#egg=xm.booking-dev 
https://svn.plone.org/svn/collective/xm.theme/trunk#egg=xm.theme-dev 
 
eggs = 
 xm.booking 
 xm.theme 
build-directory = src 
develop = true 
=

And then of course mention this section in buildout[parts] and add
{xm-development}:eggs to [instance]eggs and perhaps [instance]zcml or
wherever else you need them.

-- 
Maurits van Rees | http://maurits.vanrees.org/
Work | http://zestsoftware.nl/
"This is your day, don't let them take it away." [Barlow Girl]

___
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] Re: Installing TextIndexNG3 in ZopeTestCase (long story short)

2008-02-04 Thread Maurits van Rees
Peter Bengtsson, on 2008-02-04:
> Now in Design2Mest/test I copied the above lines and wrote a few basic 
> tests and now it no longer works!!! TextIndexNG3 complains (again) about 
> some parsers not being available. What happened was kind of that none of 
> the zcml files of TextIndexNG3 were read or parsed at all.
> The solution to the problem was to rearrange the order of...:
> ZopeTestCase.installProduct('Five')
> ZopeTestCase.installProduct('TextIndexNG3')
> ...to this...:
> ZopeTestCase.installProduct('TextIndexNG3')
> ZopeTestCase.installProduct('Five')
> ...and then it worked.

You may want to try completely removing that line with
installProduct('Five').  If I understand this blog post correctly you
should not need it: 

http://bfhammer.blogspot.com/2006/08/i-break-tests-because-i-care.html

-- 
Maurits van Rees | http://maurits.vanrees.org/
Work | http://zestsoftware.nl/
"This is your day, don't let them take it away." [Barlow Girl]

___
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] Re: zope starts in foreground but not normaly

2008-03-11 Thread Maurits van Rees
robert rottermann, on 2008-03-11:
> Hi there,
>
> after a software upgrade (system and zope/plone) we have a strange problem.
> we have an old site that runs under plone 2.1
> Zope-2.8.9-final
> python 2.3.5
>
> when I start it in the foreground with bin/zopectl fg everything works fine.
> if I however start it with bin/zopectl start

This is a problem with Zope 2.8.9.  It was fixed in the shortly after
released 2.8.9.1.  See the top of this file:

http://www.zope.org/Products/Zope/2.8.9.1/CHANGES.txt

-- 
Maurits van Rees | http://maurits.vanrees.org/
Work | http://zestsoftware.nl/
"This is your day, don't let them take it away." [Barlow Girl]

___
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] Re: zip files corrupted with IE when opened, fine when downloaded

2008-03-19 Thread Maurits van Rees
robert rottermann, on 2008-03-17:
> Hi there,
> we have a problem with an intranet that runs using plone 2.5.3
>
> when users using IE want to open a zip file from the intranet by using
> the "open" option from the download dialog they get winzip complaining
> that the file is corrupted.
> if they select "save" from the same dialog they can open the zip archive
> without problem.
>
> does anyone know a solution for this or give me an idea where to look
> for one?

The INSTALL.txt of CMFPlone says this about WinZip:

* Unpacking the Plone archive with WinZip will not work: WinZip will truncate
  filenames without warning you. 7-Zip is a good open source alternative for
  Windows that you can use instead: http://www.7-zip.org

That does not look like the same error you are getting, so the other
answers are probably better, but still using 7-zip might solve this.

My 2 cents.

-- 
Maurits van Rees | http://maurits.vanrees.org/
Work | http://zestsoftware.nl/
"This is your day, don't let them take it away." [Barlow Girl]

___
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] Re: I would like to join your group; my membership is pending approval

2008-03-25 Thread Maurits van Rees
Herr Jan Ulrich Hasecke, on 2008-03-25:
> Am 25.03.2008 um 10:07 schrieb Jan Ulrich Hasecke:
>> Hi there!
>>
>
> Ups sorry. This was a more or less automatic mail from linkedin.  
> There is a zope community group and if you contact the group owner  
> the mail goes to this list. I think this is not intended. Perhaps  
> someone can change this in linkedin.
>
> Soory again
> juh

I had the same, though no mail ended up here as far as I saw.

-- 
Maurits van Rees | http://maurits.vanrees.org/
Work | http://zestsoftware.nl/
"This is your day, don't let them take it away." [Barlow Girl]

___
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] Re: i18n/L10n support in zope2

2008-04-09 Thread Maurits van Rees
harshad behere, on 2008-04-09:
> Dear list members,
>
> I am newbie/begineer in area of zope2 + i18n/L10n so please excuse me if 
> this topic has already been discussed on the list, in that case can some 
> one please point me to the past discussions/threads.
>
> After reading some basics about i18n+zope2, I have tried following - 
> (zope version - Zope 2.9.7-final, python 2.4.4, win32
> and Placeless Translation Service - 1.3.7)
>
> Created simple page template -
>
>
>
> Reload this catalog
>
>
>

I would expect either:

  i18n:translate=""

so that the string behind it ends up in the .pot file (and you don't
repeat yourself needlessly; also think what would happen when you
change one string but forget to change the other).

Or:

  i18n:translate="reload_this_catalog" 

or some other unique message id.

But the above code should work.

Well, using PlacelessTranslationService as i18n:domain is strange.
You should use the name of your own product/package.

> Modified language preferences for browsers - (Mozilla Firefox 2.0.0.4 
> and MS-IE 7.0.5730.11) to set German [de] as primary langage.
>
> When I viewed above page in firfox got the corresponing german 
> translation (Diesen Katalog neu einlesen) as specified in related .po 
> file.  But with MS-IE, no luck, gives same string - Reload this catalog
>
> So is it browser specific/dependable ?

It should not.  Do you have a way to check which browser headers are
sent by IE and firefox and if they differ in the language preference?

> Another thing I tried is adding attribute i18n:target="cs", but it seems 
> to have no effect, firefox gives german translation as per language 
> settings as MS-IE gives same string - Reload this catalog
>
> Does it means that attribute target is not supported ? Is there any 
> list/documentation about supported i18n attributes ?

I have never seen that attribute.  From the top of my head, these i18n
attributes are used in zope: translate, domain, name and attributes.

> Also I was not able to find references/examples for DTML, does DTML 
> supports i18n/L10n ?

No.  At least, I do not think so, and this grep in a buildout did not
return any relevant results:

grep i18n $(find . -name '*dtml')

-- 
Maurits van Rees | http://maurits.vanrees.org/
Work | http://zestsoftware.nl/
"This is your day, don't let them take it away." [Barlow Girl]

___
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] Re: i18n/L10n support in zope2

2008-04-10 Thread Maurits van Rees
harshad behere, on 2008-04-10:
> Maurits,
>
> Thanks for the reply and suggestions.
>
> I tried i18n:translate="", it works fine.
>
> But if I change domain (e.g i18n:domain="mydomain") it doesn't work. Is 
> domain attribute is related to the domain specified in .po file, coz the 
> example .po file which comes with PlacelessTranslationService has domain 
> as 'PlacelessTranslationService' and if I used same it works fine.

Yes, the two should be the same.  But if you use this domain and other
people use it too because it is the standard example then you can get
conflicting translations.

> Actually I used i18n:target after reading - 
> http://wiki.zope.org/zope3/ZPTInternationalizationExamples. I do 
> understand that these are zope3 examples, but just thought of giving 
> try. While searching further I found - 
> https://bugs.launchpad.net/zope2/+bug/142771 which gives hint that 
> i18n:target not supported at least for Zope 2.9.7-final, python 2.4.4, win32

I have never seen it used anywhere.  My i18n experience is with Zope
2.9 and 2.10 though, not pure Zope 3, so maybe it works fine there.

> I will try to check for incoming browser headers, but does zope provides 
> any inbuilt method to do so ?

In Firefox you can use the livehttpheaders extension to check those.
I don't know if there is something similar to IE.

In zope this information should be visible somewhere in the request
object.  To display the complete request in a page template for
inspection you can probably do this:

  

or simply this

  



-- 
Maurits van Rees | http://maurits.vanrees.org/
Work | http://zestsoftware.nl/
"This is your day, don't let them take it away." [Barlow Girl]

___
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] Re: i18n/L10n support in zope2

2008-04-10 Thread Maurits van Rees
harshad behere, on 2008-04-10:
> I also found workaound for MSIE behaviour, include heading call 
> "X-Is-Fallback-For: ?\n" in your .po file. For e.g - 
> "X-Is-Fallback-For: de-de\n".

Ah yes, that is the correct solution here indeed.

> After making change  and updating sample page template - (English as 
> primary language for both browsers)
>
>
>
> English -
>
> Reload this catalog
>
>
> German -
>
> Reload this catalog
>
>
> Czech -
>
> Reload this catalog
>
>
>
>

Huh? You now state languages in the i18n domain.  Don't you mean to
make this three times the same domain and then perhaps add the
i18n:target en/de/cs?

-- 
Maurits van Rees | http://maurits.vanrees.org/
Work | http://zestsoftware.nl/
"This is your day, don't let them take it away." [Barlow Girl]

___
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] Script (Python) insecure ?

2008-08-12 Thread Maurits van Rees
Andreas Jung, on 2008-08-12:
>>> After rough test: it seems to work for Zope trunk, 2.10 and 2.11
>>> but has a failure for Zope 2.8.
>>
>> I forgot to mention that the hotfix also seems to work for Zope 2.9.
>> (third-party confirmations are highly appreciated).
>
> Update: the hotfix although works for Zope 2.8 (tested with
> a running Zope instance - however the testrunner does not seem
> to import Hotfix though the included tests under 2.8 aren't
> found/executed).

In Zope 2.8, when I place the Hotfix in the Products dir of the
instance, the two tests pass when I run the tests like this:

  bin/zopectl test --dir=Products/Hotfix_20080812/

That's with: http://www.zope.org/advisories/Hotfix_20080812_0.1.tar.gz

I tested on Zope 2.8, 2.9, 2.10, 2.11.  All with python 2.4.  Without
the hotfix "raise SystemExit" crashed Zope.  I could not confirm the
other problem; that just gave me a LookupError.  With the hotfix in
the Products dir of the instance, the crash did not occur and the
tests passed.

Marvelous!  Thanks Andreas!

-- 
Maurits van Rees | http://maurits.vanrees.org/
Work | http://zestsoftware.nl/
"This is your day, don't let them take it away." [Barlow Girl]

___
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] Script (Python) insecure ?

2008-08-12 Thread Maurits van Rees
Maurits van Rees, on 2008-08-12:
> That's with: http://www.zope.org/advisories/Hotfix_20080812_0.1.tar.gz

Oh, that tarball contains a .svn directory...


I took the liberty of committing a change to the text of the raised
ValueError to make it a proper sentence.  Old:

  SystemExit can not raised with a PythonScript

new:

  SystemExit can not be raised within a PythonScript


-- 
Maurits van Rees | http://maurits.vanrees.org/
Work | http://zestsoftware.nl/
"This is your day, don't let them take it away." [Barlow Girl]

___
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] Overriding DateTime

2009-03-26 Thread Maurits van Rees
Tim Knapp, on 2009-03-26:
> On Wed, 2009-03-25 at 21:20 +0100, Dieter Maurer wrote:
>> Tim Knapp wrote at 2009-3-23 18:21 +1300:
>> >I would like to override the DateTime.DateTime class within my
>> >functional tests. I have tried mocking (via mocker) and injecting the
>> >subclassed DateTime class into sys.modules (results in a
>> >TraversalError). The fartherest I've gotten is to set DateTime.DateTime
>> >= MySubclassedDateTime in my tests.py, which does work for the code
>> >'within' the package(s) I'm testing but all the Zope core code (i.e. the
>> >instance created within PloneTestCase) is still referencing the global
>> >DateTime module. Has anyone successfully done this?
>> 
>> "import DateTime; DateTime=" should be able
>> to replace the "DateTime" class -- sometimes.
>> 
>> 
>> Be aware, however, that this replacing takes effect only after
>> your assignment. Modules that already have imported the "DateTime"
>> class will not be affected.
>
> Thanks, yeah that was what I thought. I tried to do it in the _setup
> method of PloneTestCase, which theoretically gets called before the
> instance is runup but maybe not. Didn't seem to affect the Zope instance
> itself anyway.

A few years ago at Zest Software we needed a patch (for Archetypes I
think) and hit the same problem that our product was too late in the
startup process to have enough influence.  So we put the patch in a
product called (Products.)AAAPatch; affectionately called triple A
patch. :-) Due to the three A-s at the beginning it was virtually
guaranteed to be the first product to load.

-- 
Maurits van Rees | http://maurits.vanrees.org/
Work | http://zestsoftware.nl/
"This is your day, don't let them take it away." [Barlow Girl]

___
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] repoze.bfg 1.0 released

2009-07-07 Thread Maurits van Rees
Chris McDonough, on 2009-07-06:
> Summary
> ---
>
> The first major release of the BFG web framework (aka "repoze.bfg"),
> version 1.0, is available.  See http://bfg.repoze.org/ for general
> information about repoze.bfg.

Great news!  Thanks to all contributors!

> Quick installation:
>
>easy_install -i http://dist.repoze.org/bfg/current repoze.bfg

That is not working:

 $ easy_install -i http://dist.repoze.org/bfg/current repoze.bfg
 Searching for repoze.bfg
 Reading http://dist.repoze.org/bfg/current/repoze.bfg/
 Couldn't find index page for 'repoze.bfg' (maybe misspelled?)
 Scanning index of all packages (this may take a while)
 Reading http://dist.repoze.org/bfg/current/
 No local packages or download links found for repoze.bfg
 error: Could not find suitable distribution for Requirement.parse('repoze.bfg')

You need the -f option, for find-links:

 $ easy_install -f http://dist.repoze.org/bfg/current repoze.bfg
 Searching for repoze.bfg
 Reading http://dist.repoze.org/bfg/current
 Best match: repoze.bfg 1.0
 ...


-- 
Maurits van Rees | http://maurits.vanrees.org/
Work | http://zestsoftware.nl/
"This is your day, don't let them take it away." [Barlow Girl]

___
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] repoze.bfg 1.0 released

2009-07-07 Thread Maurits van Rees
Maurits van Rees, on 2009-07-07:
>> Quick installation:
>>
>>easy_install -i http://dist.repoze.org/bfg/current repoze.bfg

Ah, as mentioned on a different mailing list, it should be this:

easy_install -i http://dist.repoze.org/bfg/current/simple repoze.bfg

-- 
Maurits van Rees | http://maurits.vanrees.org/
Work | http://zestsoftware.nl/
"This is your day, don't let them take it away." [Barlow Girl]

___
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] Disabling "Expand macros when editing"

2009-09-04 Thread Maurits van Rees
Damon Butler, on 2009-09-03:
> Hi,
>
> We just recently upgraded from various installations of Zope 2.7/2.9 to 
> Zope 2.10. The page template feature "Expand macros when editing" is 
> causing us major headaches. It is checked on by default, and as a 
> result, the instant we wish to view the source code of any ZPT, it has 
> been mangled into "expanded" form before we have a chance to do anything 
> to it.
>
> THIS IS BAD!
>
> How can we turn this feature off globally? Right now, it is flatly 
> impossible for us to edit most of our ZPTs because the instant we even 
> look at them they are mangled. We can't even uncheck the option without 
> saving the mangled version.
>
> It's Catch-22 of the worst sort. Please help!

I created a fresh Zope 2.10.9 instance.  This option is not checked by
default.  But when you check it and save the form it remains checked
for that template.

Try appending ?expand:int=0 to the url.  That does the trick for me.

-- 
Maurits van Rees | http://maurits.vanrees.org/
Work | http://zestsoftware.nl/
"This is your day, don't let them take it away." [Barlow Girl]

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


Re: [Zope] Disabling "Expand macros when editing"

2009-09-04 Thread Maurits van Rees
Andreas Jung, on 2009-09-04:
> On 04.09.09 16:37, Damon Butler wrote:
>> Thanks for the reply, Maurits. However, your URL trick makes absolutely 
>> no difference whatsoever. The ZPT code has already been "expanded" even 
>> when we avoid the ZMI and access the ZPT by putting the URL to the ZPT 
>> object -- with your query parameter -- into our browser.
>>
>> We are currently using Zope 2.10.6. Has this problem been fixed with 
>> Zope 2.10.9?

Hm, my trick works in 2.10.9, but I see that in Zope 2.10.6 it has no
effect, like you say.  And using expand macros in 2.10.6 indeed has
deadly results...

>> I simply cannot believe that there is NO WAY to turn this option off. 
>> How silly is it that it appears to be literally impossible to view the 
>> original source code for a ZPT?!
>
> Bugs that are not reported in the bugtracker can not be fixed :-)

Looks like this *was* reported earlier and already fixed in Zope
2.10.7.  :-)  The changelog says:

Launchpad #262313: respect the Expand macros when editing flag when
editing a page template through the ZMI

So Daymon: please switch to 2.10.7 or later.

-- 
Maurits van Rees | http://maurits.vanrees.org/
Work | http://zestsoftware.nl/
"This is your day, don't let them take it away." [Barlow Girl]

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


Re: [Zope] Change admin's password

2009-12-31 Thread Maurits van Rees
Lennart Regebro, on 2009-12-30:
> On Wed, Dec 30, 2009 at 19:45, iarly selbir | ski0s  wrote:
>> A bit I forgot mentions, my Zope is using relstorage to store all data on
>> MySQL
>
> Good. Then the answer I gave you from the start still is the correct one.

Yes, 'bin/instance adduser joe secret' should work fine, whether you
use zodb or relstorage.

Do note that you cannot use this to *change* a password of an existing
user.  If joe already exists, this command will do nothing and quit
silently.

With a bit of hacking you may be able to change that.  Look at the
do_adduser method in Zope2/Startup/zopectl.py

-- 
Maurits van Rees | http://maurits.vanrees.org/
Work | http://zestsoftware.nl/
"This is your day, don't let them take it away." [Barlow Girl]

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