Subject: Zope digest, Vol 1 #1460 - 14 msgs
From: [email-masked]
To: [email-masked]
Date: Wed, 13 Jun 2001 12:01:26 -0400
List-Id: Users of the Z Object Publishing Environment <zope.zope.org>

Send Zope mailing list submissions to
	[email-masked]

To subscribe or unsubscribe via the World Wide Web, visit
	http://lists.zope.org/mailman/listinfo/zope
or, via email, send a message with subject or body 'help' to
	[email-masked]

You can reach the person managing the list at
	[email-masked]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Zope digest..."

Today's Topics:

   1. dtml vs vim (Marco Mariani)
   2. Re: dtml vs vim (Andreas Jung)
   3. Partial string comparisons (Andy Gates)
   4. Re: Partial string comparisons (Mike Renfro)
   5. ZShellCLI and potential external method problem in Zope 2.3.2 (Jerome Alet)
   6. string module (Sebal)
   7. Hmmm ... the productWizzard (=?iso-8859-1?Q?Max_M=F8ller_Rasmussen?=)
   8. Re: Syntax. (Casey Duncan)
   9. Re: Apache & Domain User Problem (Jim Penny)
  10. Re: Getting the id of a DTML Document/Method in Python (Casey Duncan)
  11. Re: How to make a script return rendered dtml (Peter Bengtsson)
  12. Re: How to make a script return rendered dtml (Eric Balasbas)
  13. Date formatting problems (Craig Stoddart)
  14. Re: Date formatting problems (Andreas Jung)

--__--__--

Message: 1
Date: Wed, 13 Jun 2001 15:29:05 +0200
To: [email-masked]
From: Marco Mariani <[email-masked]>
Subject: [Zope] dtml vs vim

Hi there!

Anybody got hold of a VIM file to syntax highlight my dtml methods slightly
better than what I'm doing with the html syntax?

Thanks

--__--__--

Message: 2
From: "Andreas Jung" <[email-masked]>
To: "Marco Mariani" <[email-masked]>
Cc: "zope-list" <[email-masked]>
Subject: Re: [Zope] dtml vs vim
Date: Wed, 13 Jun 2001 09:43:10 -0400

At least in the latest vim-6 alpha versions there is DTML support included.

Andreas
----- Original Message -----
From: "Marco Mariani" <[email-masked]>
To: <[email-masked]>
Sent: Wednesday, June 13, 2001 9:29 AM
Subject: [Zope] dtml vs vim

> Hi there!
>
> Anybody got hold of a VIM file to syntax highlight my dtml methods
slightly
> better than what I'm doing with the html syntax?
>
> Thanks
>
> _______________________________________________
> Zope maillist  -  [email-masked]
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )

--__--__--

Message: 3
From: Andy Gates <[email-masked]>
Date: Wed, 13 Jun 2001 14:39:52 +0100
To: [email-masked]
Subject: [Zope] Partial string comparisons

This ought to be mindlessly simple: can I test for a string within 
another?

Example: Finding "<ul>" case insensitive within dtml-myvar?

Usage: On a news site, users sometimes put lists in the stories, and I 
need to sense them in order to cleanly break out of them when 
summary pages truncate the story thus:

<h1>Wow New Product!</h1>
<p>Our new product is great, it has:</p>
<ul>
<li>A titanium case</li>
<li>Rugged carry-straps</li>
<li>Elasticated ... [More]

<< code needed here to close that <ul> neatly >>

----------------------
Andy Gates, Learning and Research Technology
[email-masked] - ICQ#74362415
http://www.ilrt.bristol.ac.uk

--__--__--

Message: 4
Date: Wed, 13 Jun 2001 08:58:24 -0500
From: Mike Renfro <[email-masked]>
To: Andy Gates <[email-masked]>
Cc: [email-masked]
Subject: Re: [Zope] Partial string comparisons

On Wed, Jun 13, 2001 at 02:39:52PM +0100, Andy Gates wrote:

> This ought to be mindlessly simple: can I test for a string within 
> another?

Refer to the DTML Users Guide, Table 4.

As an example, stick this in a method:

<dtml-call "REQUEST.set('mystring','This is a test')">
<dtml-var "_.string.find(mystring,'T')"><br>
<dtml-var "_.string.find(mystring,'q')">

-- 
Mike Renfro  / R&D Engineer, Center for Manufacturing Research,
931 372-3601 / Tennessee Technological University -- [email-masked]

--__--__--

Message: 5
Date: Wed, 13 Jun 2001 16:14:11 +0200 (MET DST)
From: Jerome Alet <[email-masked]>
To: [email-masked]
Subject: [Zope] ZShellCLI and potential external method problem in Zope 2.3.2

Hi,

I've tried to run Andy McKay's ZShellCLI, and all I can say is: 

	It's Very Nice ! (tm)

However before running it successfully I encountered a problem, because he
had modified my ZShell external method to add a parameter to it and Zope
seemed to be unable to detect this modification even when restarting it
(tried several times). 

In fact I just replaced my zshell.py file with his one and restarted Zope,
but this didn't work because I always received 'too many parameters'
errors.

I had to delete the ZShell external method from the ZMI, then recreate it
and it worked fine then.

is it normal ?
 
Is it a known Zope (2.3.2) problem ?

thanks in advance.

Jerome Alet - [email-masked] - http://cortex.unice.fr/~jerome
Fac de Medecine de Nice        http://wwwmed.unice.fr 
Tel: (+33) 4 93 37 76 30     Fax: (+33) 4 93 53 15 15
28 Avenue de Valombrose - 06107 NICE Cedex 2 - FRANCE

--__--__--

Message: 6
Date: Wed, 13 Jun 2001 07:47:13 -0700 (PDT)
From: Sebal <[email-masked]>
To: [email-masked]
Subject: [Zope] string module

I have a method what from a "MULTIPART FORM" put a file named 'myFile.pdf'
in a directory.
And after i want the methood to create a Zclass instance[PDFclass] whith
id=myFile.

I tried  with split, join, and translate method of string module, and I
can't get a valid id with split and join ; and with translate if 'myFile' is
'mypdf' (so the file is 'mypdf.pdf') I'll get 'my' as id for my PDFclass
instance.

thanx for a tip

    ()                      	
   /  \                         
  | <> |                  	
  (____)   zazen rules ...sbaline

_______________________________________________________
Send a cool gift with your E-Card
http://www.bluemountain.com/giftcenter/

--__--__--

Message: 7
From: Max Møller Rasmussen <[email-masked]>
To: "[email-masked]'" <[email-masked]>
Date: Wed, 13 Jun 2001 16:57:12 +0200
Subject: [Zope] Hmmm ... the productWizzard

This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_000_01C0F419.20C40190
Content-Type: text/plain;
	charset="iso-8859-1"

Since there is several that has asked for a copy of the product wizzard, I
mail a zip file to the list. I hope it is ok. it's about 10K.

regards Max M

------_=_NextPart_000_01C0F419.20C40190
Content-Type: application/octet-stream;
	name="mxm_productWizzard_02.zip"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
	filename="mxm_productWizzard_02.zip"

------_=_NextPart_000_01C0F419.20C40190--

--__--__--

Message: 8
Date: Wed, 13 Jun 2001 09:08:12 -0600
From: Casey Duncan <[email-masked]>
Organization: Kaivo, Inc. (www.kaivo.com)
To: "Jason C. Leach" <[email-masked]>
CC: [email-masked]
Subject: Re: [Zope] Syntax.

"Jason C. Leach" wrote:
> 
> hi,
> 
> I just learnt a craxy bit of syntax today. It was how to get the last
> modified date out of an object. I would never have found that if it was
> not for this list.
> 
> There must exist some type of documentation that details this stuff.  Does
> anyone know what it is?
> 
> Thanks,
> j.
> 
> ......................
> ..... Jason C. Leach
> ..
> 

Try the Zope quick reference at:

http://www.zope.org/Members/ZQR

-- 
| Casey Duncan
| Kaivo, Inc.
| [email-masked]
`------------------>

--__--__--

Message: 9
Date: Wed, 13 Jun 2001 11:16:17 -0400
From: Jim Penny <[email-masked]>
To: Craig Stoddart <[email-masked]>, [email-masked]
Subject: Re: [Zope] Apache & Domain User Problem

On Wed, Jun 13, 2001 at 10:16:00AM -0000, Craig Stoddart wrote:
> We are trying to add a new user into our acl_users folder which includes a
> domain criteria to prevent people from logging into Zope from outwith our
> network.
> 
> As we are using Apache, all traffic to our site comes through Apache and
> therefore all access seems to come through the same IP address. This is making
> it impossible for us to restrict access to a specific domain.
> 
> Has anyone else had this problem, and if so, did they manage to get round it?

OK, this is essentially the problem I asked about a couple of days ago.
This will work:

DocumentRoot /var/www
RewriteEngine On   
RewriteLog "/var/log/apache-ssl/rewrite_log"
RewriteLogLevel 0
ProxyRequests on
<Directory /var/www/dynamic>
    RewriteEngine On
    RewriteRule ^/var/www/dynamic/(.*) http://localhost:8080/$1?REMOTE_ADDR=%{RE
MOTE_ADDR} [QSA,P]
</Directory>

(Possibly with some adjustment).

Caveats/Comments:

1)  Be sure to test with RewriteLogLevel at least 1, you have to see
what the Rule is doing to you addresses and may need to adjust
accordingly.  I found that my setup on my test and production machine
was subtly different;  on one machine I needed ^/var/www/dynamic/(.*)
as my pattern, on the other it was only ^(.*).

2) You may, need to create an empty directory /var/www/dynamic (as above).

3)  This is suitable for a mixed static/dynamic site.  Change the Rule
to suit your site's policy.  This rule uses Zope to serve the dynamic
folder and apache to server anything else;  you might want to have Zope
server anything with a few exceptions.

4)  I am running apache-ssl in front.  Works fine.

5)  QSA does the right thing.  If there is already a query string, the
'?' will be automagically converted to '&'.

6)  You will now have two REMOTE_ADDR objects available, one in environ
and one in QUERY_STRING.  You have to be sure to fetch the one form the
QUERY_STRING.

7)  It might be easier to use 
 RewriteRule ^/var/www/dynamic/(.*) http://localhost:8080/$1?TRUE_REMOTE_ADDR=%{REMOTE_ADDR} [QSA,P]

Jim Penny
> -------------------------------------------------
> Craig Stoddart
> IT Software Development Officer
> 
> Dundee City Council
> IT Division
> Northern College
> Technical Block
> Gardyne Road
> Dundee DD5 1NY
> 
> Phone:  01382 438170
> Fax:    01382 438002
> E-mail: [email-masked]
> -------------------------------------------------
> 
> 
> 
> _______________________________________________
> Zope maillist  -  [email-masked]
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
> 

--__--__--

Message: 10
Date: Wed, 13 Jun 2001 09:17:45 -0600
From: Casey Duncan <[email-masked]>
Organization: Kaivo, Inc. (www.kaivo.com)
To: Andreas Pauley <[email-masked]>
CC: Zope <[email-masked]>
Subject: Re: [Zope] Getting the id of a DTML Document/Method in Python

Andreas Pauley wrote:
> 
> Hi all,
> 
> I'm trying to write an external method that will loop through all my
> DTML Documents, and return only objects that match a certain criteria
> (based on its id).
> 
> Instead of the id, my External Method returns:
> [<Python Method object at 83df298>, <Python Method object at 86e9ba8>]
> 
[snip]
> 
> I've tested a few objectValues, and as far as I can tell it is only DTML
> Documents and DTML Methods that does not return the id correctly.
> 
> How can I get to the id of a DTML Document/Method when looping through
> the objectValues() ?
> 
[snip]

try using the getId() method of the object instead of accessing the id
attribute directly. Sometimes id is just a value other times it is a
method.

-- 
| Casey Duncan
| Kaivo, Inc.
| [email-masked]
`------------------>

--__--__--

Message: 11
From: "Peter Bengtsson" <[email-masked]>
To: "Tim Hicks" <[email-masked]>
Cc: <[email-masked]>
Subject: Re: [Zope] How to make a script return rendered dtml
Date: Wed, 13 Jun 2001 16:59:52 +0200

Try this:

(!! be careful with excessive recurssion !!)

print context.index_html(context,ERQUEST)

----- Original Message -----
From: "Tim Hicks" <[email-masked]>
To: <[email-masked]>
Sent: Wednesday, June 13, 2001 3:39 PM
Subject: [Zope] How to make a script return rendered dtml

> I have a ZClass (testclass) which subclasses DTMLDocument, and within this
> zclass, I have a script (python) called index_html.  Obviously, this
script
> is called each time an instance of testclass is requested.  Based on the
> presence of a query string, I want to either return the document_src
> (although with a few modifications), or simply return the rendered
> instance... by this, I mean have all the dtml tags that are in the
instance
> evaluated.  So, my question is, how do I make Zope evaluate the dtml tags?
>
> Here is what I have so far in my script:
>
> ------------
> if context.REQUEST.QUERY_STRING == 'editor':
>     print context.raw
> else:
>     print context
>
> return printed
> ------------
>
> The 'else' statement simply gives me things like,
>
> &lt;dtml-var standard_html_header&gt;
>
> I also tried 'else: render(context)', which was simply a guess on my part,
> but I get a Zope error as follows:
>
> Error Type: AttributeError
> Error Value: validate
>
> Can anyone enlighten me?
>
> Cheers
>
> tim
>
>
> _______________________________________________
> Zope maillist  -  [email-masked]
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )

--__--__--

Message: 12
Date: Wed, 13 Jun 2001 11:33:33 -0400 (EDT)
From: Eric Balasbas <[email-masked]>
To: Tim Hicks <[email-masked]>
cc: <[email-masked]>
Subject: Re: [Zope] How to make a script return rendered dtml

I'm not sure if this is the best way to do it, but if you want to render a
DTML method or DTML document inside a Python script, use the syntax:

someDTMLMethod(_.None, _)

Eric Balasbas
Senior Developer
[email-masked]

http://www.virtosi.com/
Virtosi Ltd.
Design -- Branding -- Zope

On Wed, 13 Jun 2001, Tim Hicks wrote:

> I have a ZClass (testclass) which subclasses DTMLDocument, and within this
> zclass, I have a script (python) called index_html.  Obviously, this script
> is called each time an instance of testclass is requested.  Based on the
> presence of a query string, I want to either return the document_src
> (although with a few modifications), or simply return the rendered
> instance... by this, I mean have all the dtml tags that are in the instance
> evaluated.  So, my question is, how do I make Zope evaluate the dtml tags?
>
> Here is what I have so far in my script:
>
> ------------
> if context.REQUEST.QUERY_STRING == 'editor':
>     print context.raw
> else:
>     print context
>
> return printed
> ------------
>
> The 'else' statement simply gives me things like,
>
> &lt;dtml-var standard_html_header&gt;
>
> I also tried 'else: render(context)', which was simply a guess on my part,
> but I get a Zope error as follows:
>
> Error Type: AttributeError
> Error Value: validate
>
> Can anyone enlighten me?
>
> Cheers
>
> tim
>
>
> _______________________________________________
> Zope maillist  -  [email-masked]
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
>

--__--__--

Message: 13
To: [email-masked]
From: "Craig Stoddart" <[email-masked]>
Date:  13 Jun 2001 16:23:00 -0000
Subject: [Zope] Date formatting problems

I am trying to format the dates in my Squishdot site so that they don't app=
ear
in American format.

However, the following code: <dtml-var date=5Fcreated fmt=3D"%d/%m/%Y - %H:=
%M">
results in an error message saying

Error Type: TypeError
Error Value: illegal argument type for built-in operation

Does anyone have any idea what I am doing wrong=3F
-------------------------------------------------
Craig Stoddart
IT Software Development Officer

Dundee City Council
IT Division
Northern College
Technical Block
Gardyne Road
Dundee DD5 1NY

Phone:  01382 438170
Fax:    01382 438002
E-mail: [email-masked]
-------------------------------------------------

--__--__--

Message: 14
From: "Andreas Jung" <[email-masked]>
To: <[email-masked]>,
	"Craig Stoddart" <[email-masked]>
Subject: Re: [Zope] Date formatting problems
Date: Wed, 13 Jun 2001 11:50:22 -0400

<untested>

 <dtml-var "date_created.strftime('%d/%m/%Y - %H:%M')">
</untested>

Andreas
----- Original Message -----
From: "Craig Stoddart" <[email-masked]>
To: <[email-masked]>
Sent: Wednesday, June 13, 2001 12:23 PM
Subject: [Zope] Date formatting problems

I am trying to format the dates in my Squishdot site so that they don't
appear
in American format.

However, the following code: <dtml-var date_created fmt="%d/%m/%Y - %H:%M">
results in an error message saying

Error Type: TypeError
Error Value: illegal argument type for built-in operation

Does anyone have any idea what I am doing wrong?
-------------------------------------------------
Craig Stoddart
IT Software Development Officer

Dundee City Council
IT Division
Northern College
Technical Block
Gardyne Road
Dundee DD5 1NY

Phone:  01382 438170
Fax:    01382 438002
E-mail: [email-masked]
-------------------------------------------------

_______________________________________________
Zope maillist  -  [email-masked]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )

--__--__--

_______________________________________________
Zope maillist  -  [email-masked]

End of Zope Digest