[Zope] Re: Epoz and Tidy

2005-05-05 Thread Duncan Booth
Cyrille Bonnet wrote:

 Daniel Dekany wrote:
 BTW, anybody has found a solution for fixing HTML copy-pasted from
 Microsoft Word (mostly 2000/XP)? Lot of users has MS Word, and the
 HTML pasted from it is a CSS killer mess. I tried mxTidy but it
 didn't improved substantially the HTML. So how do you guys do it? I
 have looked after solutions for Epoz, but didn't found any. But I
 don't stick to Epoz... if there is a solution already for Kupu (is
 Kupu already recommended over Epoz anyway?). Certainly the solution
 would be an Epoz post-tidy Python script, but I didn't found any for
 Word tidying. (However, the ideal would be if the HTML is tidied
 right on the client when it pastes it in -- thus user would really
 get what it sees, i.e. the HTML wouldn't be changed when he saves it.
 That effect is really evil.)
 
 
 As Shane pointed out, there is a tidy up in Kupu. However, in my 
 experience, it is not a very good tidy up (if I remember correctly, a 
 lot of tags are still there after the tidy up).
 
Unfortunately there is a fine line between tidying up the cruft pasted from 
Word, and not stripping out things which might actually have been entered 
legitimately. I think Kupu does this pretty well (but then I'm a bit 
biased), but without any way to detect that the user is pasting from Word I 
don't see how much more could be stripped.

So far as I know the only thing which doesn't really get stripped from the 
pasted Word text are the mso classnames. These can be manually blacklisted, 
but I never got round to producing a definitive blacklist.

One of my thoughts is to provide a separate 'clean this up' button which 
would apply a more aggressive tidy-up than the one when saving. Also, I 
agree that only applying the tidy on save is bad, but there isn't a cross-
browser way to detect a paste, and applying the cleanup on a large 
document every time you cut/paste one word wouldn't be nice either.

Suggestions for improvements are most welcome.

P.S. It isn't just pasting bad HTML which is a problem: some Microsoft 
applications supply RTF on the clipboard but not HTML and it turns out that 
if you paste RTF into IE it generates seriously invalid HTML with a totally 
weird and corrupted DOM. That is another area where I think the cleanup 
code finally does a passable job but not yet a perfect one.

___
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] xemacs ftp and scripts

2005-05-05 Thread Dave Whiteley
Hello,

I am very new to zope, and I am not an experienced lisp programmer -
please accept the standard Newbie apologies. I am avoiding the use of
DHTML, as this seems to be the approved policy. Most of my work has
been using page templates, and internal and external python scripts.

I am trying to use Xemacs to develop and maintain a site that I
created via the web interface.  I have connected using the xemacs ftp
link, and can edit.  I have a couple of problems.

Firstly, my xemacs did not recognise my Script(Python) files as being
Python, and so it does not automatically switch to Python Major Mode.  

I added the standard shebang #! /usr/bin/python to the start of the
file which fixed this. However it would be nice if it were to
recognise Zope's script preamble.  Please could someone point me at a
resource to help me configure my Xemacs for this.

Secondly, I found that after I had edited a script the web interface
no longer showed the file as a python script, but as a DHTML
file. When used, I just saw the script contents. Is this related to my
adding the shebang?  I have now removed it again, but it has not fixed
the problem.

Is there any way I can switch them back (without using copy and
paste)?  How do I avoid this happening?

I am using Debian Sarge Linux, which provides Zope 2.7. 

Dave




-- 

Dave Whiteley
[EMAIL PROTECTED]
Phone +44 (0)113 343 2059
School of Electronic and Electrical Engineering
The University of Leeds. Leeds, LS2 9JT,  UK
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Re: Epoz and Tidy

2005-05-05 Thread Daniel Dekany
Thursday, May 5, 2005, 9:10:23 AM, Duncan Booth wrote:

 Cyrille Bonnet wrote:

 Daniel Dekany wrote:
[snip]
 One of my thoughts is to provide a separate 'clean this up' button which
 would apply a more aggressive tidy-up than the one when saving. Also, I
 agree that only applying the tidy on save is bad, but there isn't a cross-
 browser way to detect a paste, and applying the cleanup on a large 
 document every time you cut/paste one word wouldn't be nice either.
[snip]

Did anybody considered using other client side technologies than
JavaScript, like using a Java Applet or Flash as the editor? Maybe they
can capture paste events and such (I don't know...), also they have much
less cross-browser problems (like they work with Opera and Safari). Yes,
they can't render HTML on the same way the browser, but after all, if we
are talking about a place where users enter pure content (I mean,
structure) then maybe it is not a that big problem. I mean, the user
sees clearly that he has made a paragraph here and ha level 1 heading
there, even if he doesn't see how will it exactly look regarding the
visual design. At least (s)he will concentrate on content rather than on
visual design. Anyway, I think that HTML is not the ideal scheme for
entering content.

-- 
Best regards,
 Daniel Dekany

___
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: xemacs ftp and scripts

2005-05-05 Thread Tres Seaver
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Dave Whiteley wrote:
 On Thu, May 05, 2005 at 01:00:55PM +0200, SER.RI-TIC-Alexis Roda wrote:
 
Dave Whiteley wrote:

Hello,
Firstly, my xemacs did not recognise my Script(Python) files as being
Python, and so it does not automatically switch to Python Major Mode.  

I added the standard shebang #! /usr/bin/python to the start of the
file which fixed this. However it would be nice if it were to
recognise Zope's script preamble.  Please could someone point me at a
resource to help me configure my Xemacs for this.

xemacs probably relies on file extension to decide the mode. Just rename 
your scripts and add a .py extension (not a good idea, since . is 
meaningful for python)
 
 
 When I have created scripts in the web interface I have just accepted
 the defaults, and so I presume that the scripts are buried in the ZDB,
 rather than being actual files. Should I give them actual filenames
 when I create them?
 
 
or add something like (not tested):

# Local Variables:
# mode:python
# End:

 
 
 
 
 Thanks, magic!  That works.
 
 Now if I can fix the file type problem

You need to persuade Xemacs not to create backup files.  In standard
mode, when you go to save the file, it does something like:

  - rename the original, giving it a backup suffix

  - Writes the new file, giving it the original name

  - (maybe) delete the renamed original

That second step is where the DTMDocument is being created.

If you can't find a solution to that problem, then you could add an
ExternalMethod named 'PUT_factory', and take over control of the choice
of object type being created yourself.  See the following for hints:

  http://zwiki.org/HowToCreateZwikiPagesWithPut


Tres.
- --
===
Tres Seaver[EMAIL PROTECTED]
Zope Corporation  Zope Dealers   http://www.zope.com
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCeiSDGqWXf00rNCgRAoBrAKCOkWO+0bdGAtq0WRBUknudOtdMOwCgkQ+x
JqyZNfn1ZE75t8p0zjfG2Bo=
=LsuD
-END PGP SIGNATURE-

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


[Zope] A memory leak in Zope, PageTemplateFile and macros?

2005-05-05 Thread Marco Bizzarri
Hi all.
While debugging an application of us I suspected we had a memory leak,
so I started with the usual divide et impera approach, trying to figure
where exactly was the problem.
I therefore started removing all code from inside the main templates in
our system, so that I could figure where the problem was.
The surprise was that even if I removed all the code, still I was able
to see the memory footprint of the zope server raise as new requests
arrived.
I'm using ab from Apache project to test. I've devised a very simple
product which shows the problem, which I include.
I tested this with python 2.3.4 and Zope 2.7.6
Test string was:
ab2 -A admin:admin -n 100 http://localhost:8080/LeakPT1/start_html
Regards
Marco


LeakPT1.tar.gz
Description: application/gzip
___
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] i am completely new to zope

2005-05-05 Thread Paul Winkler
On Thu, May 05, 2005 at 09:27:41AM -0700, Lukman Salifu Nayendi wrote:
 i am a new user of zope, i really want to learn alot about it and know more 
 please help.

http://zopewiki.org/ZopeWiki
http://www.plope.com/Books/2_7Edition

-- 

Paul Winkler
http://www.slinkp.com
___
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] i am completely new to zope

2005-05-05 Thread David H




Paul Winkler wrote:

  On Thu, May 05, 2005 at 09:27:41AM -0700, Lukman Salifu Nayendi wrote:
  
  
i am a new user of zope, i really want to learn alot about it and know more please help.

  
  
http://zopewiki.org/ZopeWiki
http://www.plope.com/Books/2_7Edition

  

Also, get some good Zope books. I liked "The Zope Bible". The "Book
of Zope" is very good also. If you are new to python - get "Python,
the essential reference" by Beasley. 

Also *google* is your friend. Try to find answers w/it before posting
questions to the zope lists - because so many questions have been asked
and answered.





___
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] HTML post processing in Zope

2005-05-05 Thread Dieter Maurer
Cyrille Bonnet wrote at 2005-5-5 14:58 +1200:
I am trying to perform a post-processing on all HTTP responses, before 
they get sent to the browsers. I am using Zope 2.7.3 nad Plone 2.0.5.

I had a look at the ZServer class: it seems to be the right place, but I 
don't understand all the code there and I am afraid to break something :-(

I think ZPublisher.HTTPResponse.HTTPResponse is the better
place for tidying up.

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


Re: [Zope] Re: xemacs ftp and scripts

2005-05-05 Thread Dieter Maurer
Tres Seaver wrote at 2005-5-5 09:49 -0400:
 ...
 Now if I can fix the file type problem

You need to persuade Xemacs not to create backup files.  In standard
mode, when you go to save the file, it does something like:

  - rename the original, giving it a backup suffix

  - Writes the new file, giving it the original name

  - (maybe) delete the renamed original

That second step is where the DTMDocument is being created.

If you can't find a solution to that problem

I use the efs XEmacs package for FTP access.
This package can be told not to create
backup files by customizing efs-make-backup-files.

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


[Zope] Re: i am completely new to zope

2005-05-05 Thread Simon Michael
It would be interesting to really mine the list archives for the wealth 
of answers in there, and present them in an organized fashion. At least 
the last year's archive, say.

But, I think it would take an army of slaves^H^H^H^H^H^Hvolunteers akin 
to the builders of the pyramids, java developers, etc. Am I wrong ?

___
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] Re: i am completely new to zope

2005-05-05 Thread Paul Winkler
On Thu, May 05, 2005 at 01:33:45PM -0700, Simon Michael wrote:
 It would be interesting to really mine the list archives for the wealth 
 of answers in there, and present them in an organized fashion. At least 
 the last year's archive, say.
 
 But, I think it would take an army of slaves^H^H^H^H^H^Hvolunteers akin 
 to the builders of the pyramids, java developers, etc. Am I wrong ?

I dunno... if you don't mind it happening in a disorganized,
haphazard fashion, zopewiki.org is the perfect place for this IMO.
The bar for contributing there is really low.  If you want a more
organized effort, good luck ;-)

-- 

Paul Winkler
http://www.slinkp.com
___
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: Epoz and Tidy

2005-05-05 Thread Cyrille Bonnet
I agree with you, Duncan, the tidy up can not be much more aggressive by 
default. And Kupu probably does the best possible job there.

Now, the button Clean this up is a good idea, I think. Did you get 
started on this? I am happy to help if you do develop that feature.

Also, another option for users that need to convert a lot of Word 
documents is, of course, WebDAV + PortalTransform.

Cheers
Cyrille
Duncan Booth wrote:
Cyrille Bonnet wrote:

Daniel Dekany wrote:
BTW, anybody has found a solution for fixing HTML copy-pasted from
Microsoft Word (mostly 2000/XP)? Lot of users has MS Word, and the
HTML pasted from it is a CSS killer mess. I tried mxTidy but it
didn't improved substantially the HTML. So how do you guys do it? I
have looked after solutions for Epoz, but didn't found any. But I
don't stick to Epoz... if there is a solution already for Kupu (is
Kupu already recommended over Epoz anyway?). Certainly the solution
would be an Epoz post-tidy Python script, but I didn't found any for
Word tidying. (However, the ideal would be if the HTML is tidied
right on the client when it pastes it in -- thus user would really
get what it sees, i.e. the HTML wouldn't be changed when he saves it.
That effect is really evil.)

As Shane pointed out, there is a tidy up in Kupu. However, in my 
experience, it is not a very good tidy up (if I remember correctly, a 
lot of tags are still there after the tidy up).

Unfortunately there is a fine line between tidying up the cruft pasted from 
Word, and not stripping out things which might actually have been entered 
legitimately. I think Kupu does this pretty well (but then I'm a bit 
biased), but without any way to detect that the user is pasting from Word I 
don't see how much more could be stripped.

So far as I know the only thing which doesn't really get stripped from the 
pasted Word text are the mso classnames. These can be manually blacklisted, 
but I never got round to producing a definitive blacklist.

One of my thoughts is to provide a separate 'clean this up' button which 
would apply a more aggressive tidy-up than the one when saving. Also, I 
agree that only applying the tidy on save is bad, but there isn't a cross-
browser way to detect a paste, and applying the cleanup on a large 
document every time you cut/paste one word wouldn't be nice either.

Suggestions for improvements are most welcome.
P.S. It isn't just pasting bad HTML which is a problem: some Microsoft 
applications supply RTF on the clipboard but not HTML and it turns out that 
if you paste RTF into IE it generates seriously invalid HTML with a totally 
weird and corrupted DOM. That is another area where I think the cleanup 
code finally does a passable job but not yet a perfect one.

___
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 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] i am completely new to zope

2005-05-05 Thread J Cameron Cooper
Lukman Salifu Nayendi wrote:
i am a new user of zope, i really want to learn alot about it and know 
more please help.
Well, first, how about you look at the page that shows up when you 
install Zope. I believe it points to the quick-start and some examples.

You'll also find online help in your ZMI. Look for the Help! link in 
the upper-right.

Then look here:
http://www.zope.org/Documentation/
And once you're looking for specific solutions, try:
http://zopelabs.com
If you have specific questions, this list may help.
		--jcc
___
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: HTML post processing in Zope

2005-05-05 Thread Cyrille Bonnet
Thanks for all your answers,
I usually use Apache to change HTTP headers. But here, I need to 
post-process the HTML.

The reason is that the NZ Government Webguidelines require HTML 4.01 :-( 
and I'd like to keep Plone content and templates XHTML compliant.

One way to do that is obviously to post-process the HTML with a language 
that is good at regular expressions (Perl?).

But I thought it could be neat if the post-processing could be done in 
Zope itself.

Anyway, I am looking at ZPublisher.HTTPResponse.HTTPResponse and it 
looks like the right place.

Thanks for your help!
Cyrille
Dieter Maurer wrote:
Cyrille Bonnet wrote at 2005-5-5 14:58 +1200:
I am trying to perform a post-processing on all HTTP responses, before 
they get sent to the browsers. I am using Zope 2.7.3 nad Plone 2.0.5.

I had a look at the ZServer class: it seems to be the right place, but I 
don't understand all the code there and I am afraid to break something :-(

I think ZPublisher.HTTPResponse.HTTPResponse is the better
place for tidying up.
___
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] Re: HTML post processing in Zope

2005-05-05 Thread Phillip Hutchings
On 06/05/05, Cyrille Bonnet [EMAIL PROTECTED] wrote:
 Thanks for all your answers,
 
 I usually use Apache to change HTTP headers. But here, I need to
 post-process the HTML.
 
 The reason is that the NZ Government Webguidelines require HTML 4.01 :-(
 and I'd like to keep Plone content and templates XHTML compliant.

 One way to do that is obviously to post-process the HTML with a language
 that is good at regular expressions (Perl?).
 
 But I thought it could be neat if the post-processing could be done in
 Zope itself.
 
 Anyway, I am looking at ZPublisher.HTTPResponse.HTTPResponse and it
 looks like the right place.
 
 Thanks for your help!


Yes, it's irritating isn't it? I've worked on an NZ government site
before, but in PHP.

You can use Apache to parse the HTML, mod_python allows you to use
PythonOutputFilters, where you can use a regexp to clean up the HTML.
I'd personally think that using Apache would be faster, but I may be
wrong.

-- 
Phillip Hutchings
http://www.sitharus.com/
[EMAIL PROTECTED] / [EMAIL PROTECTED]
___
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 am completely new to zope

2005-05-05 Thread Simon Michael
Paul Winkler wrote:
I dunno... if you don't mind it happening in a disorganized,
haphazard fashion, zopewiki.org is the perfect place for this IMO.
You'd hear no argument from me.. I think it would need to be a little 
bit organized though.. without some rough standard for presentation, 
some visible measure of progress, volunteer instructions etc. it seems 
an overwhelming task.

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