Re: Fwd: [Zope-dev] How to return downloadable content from Python Method

2001-06-08 Thread Gregor Heine

 I am compressing  files which need to be uncompressed inline 
 before download. The DTML  href=... calles a python method 
 in the product which returns the  uncompressed file data. Say 
 this file is an MSWord document, how do I return  this as a file 
 to download? Presently, the browser just tries to display the 
 binary file and makes a mess of it.
 
 Regards,
 Simon  B. 

Hi Simon,

First off, please don't send HTML mail to the list.

You will have to set the Content-Type HTTP header to do that:
REQUEST.RESPONSE.setHeader('Content-Type', content_type)
where content_type is the right MIME type of the file you return, e.g.
something like 'application/msword' in your case.
Hope  that helps.

Cheers,

Gregor.


-- 
Machen Sie Ihr Hobby zu Geld bei unserem Partner 11!
http://profiseller.de/info/index.php3?ac=OM.PS.PS003K00596T0409a

--
GMX - Die Kommunikationsplattform im Internet.
http://www.gmx.net


___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



Re: [Zope-dev] manage_debug

2001-04-30 Thread Gregor Heine

Hi Andy,

Whoops, seems like some relict from the Client/Server Product, right?!?
Actually I was planning to release a new version of that product, but unfortunately I 
have quit cdc in Frankfurt a while 
ago and I'm working for Iona Technologies in Dublin now, and now my work hasn't much 
to do with Zope any more. :(
But, one of the last things I did for cdc was some work on this product and one thing 
was working on the encryption 
part, making it optional. Yet, I have the not really finished the code but I've taken 
it with me to Dublin. So, I hope to 
be able to spend one or the the other weekend working on Client/Server Product (as 
well as on ExtFile) and 
contribute a little to the zope community (to which I still have a great affection). 
So I will definitely stay on the zope-
dev mailing list, follow the discussions and keep in contact with all you great 
Zopistas out there!

Cheers,

Gregor!

- Original Message -
From: Andy McKay [EMAIL PROTECTED]
To: Chris McDonough [EMAIL PROTECTED], [EMAIL PROTECTED]
Subject: Re: [Zope-dev] manage_debug
Date: Fri, 27 Apr 2001 12:52:14 -0700


 I removed some twofish.dll's and this solved this problem. Wierd.
 --
   Andy McKay.
 
 
 - Original Message -
 From: Chris McDonough [EMAIL PROTECTED]
 To: Andy McKay [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Sent: Friday, April 27, 2001 10:55 AM
 Subject: Re: [Zope-dev] manage_debug
 
 
  Gad, I have a rough time with that reading the version thing, sorry.
 ;-)
 
  I haven't seen this behavior.
 
 
  - Original Message -
  From: Andy McKay [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Friday, April 27, 2001 1:56 PM
  Subject: [Zope-dev] manage_debug
 
 
   Clicking on manage_debug kills Zope, honest. Anyone else seen this?
  Nothing
   printed to stderr or anything useful. Sigh.
  
   B 29501752 2001-04-27T17:50:02 GET /Control_Panel/DebugInfo/manage_main
   I 29501752 2001-04-27T17:50:02 0
  
   Windows 2K, Zope 2.3.0.
  
   Cheers.
   --
 Andy McKay.
  


___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



Re: [Zope-dev] (no subject)

2001-03-16 Thread Gregor Heine

Hi Menno,

what you get from the form is a FileUpload object, so try this:
print file.__dict__
and you will find out that it has a method called
file.read()
which returns the data of the uploaded file.

Cheers,

Gregor!


-Original Message-
From: "Menno Brandsen" [EMAIL PROTECTED] 
To: [EMAIL PROTECTED] 
Date: Fri, 16 Mar 2001 03:46:45 +0100 
Subject: [Zope-dev] (no subject) 



I have a question regarding images in a MySQL Database 

I'm trying to insert (and retrieve) images into a mysql database I use a 
standard upload form and a normal insert statement in the sql. 
The output i get is this : ZPublisher.HTTPRequest.FileUpload instance at 
86550c8 which is clearly not the correct data 

Can someone help me out with this, i need to get the data from the image in 
some sort of way, but i dont know how to do this ! 



Friendly greetings, 
Menno Brandsen 

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



[Zope-dev] Product release: ExtFile/ExtImage 1.1.0.beta1

2001-02-20 Thread Gregor Heine

ExtFile/ExtImage Product 1.1.0.beta1 has just been released.
Get it at http://www.zope.org/Members/MacGregor/ExtFile

The new Version comes with many, many internal changes and some new features

which will (hopefully) make ExtFile/ExtImage even more reliable:
- You can set a 'level of undo' which determines in wich cases the external
  file is overwritten/deleted or renamed to '.undo'.
- 'id collision bug' fixed, which caused unreferenced files in the
repository, 
  when an id of a new object already existed (thanks to Fred Yanowski).
  Instead of in the __init__ method, the file data is now passed to the
object 
  after it has been successfully added, via manage_file_upload.
- 'wrong file size bug' fixed, which caused a wrong file size and resolution
  of the image and preview, after a new file was uploaded followed by an
undo
  of this transaction. The filesize and resolution attributes have been 
  replaced by corresponding methods which determine the respective value
  directtly from the file(e.g. width(), height(), prev_size(), ...) 
- Objects can be assigned an alternative id (instead of the filename) by the

  optional 'id' field in the manage_add method of ExtFile and ExtImage.
- Uploaded preview images can be resized during upload (like the generated 
  previews).
- Images can be dynamically resized (thanks to Arno Gross): the index_html 
  method now has two additional parameters ('width' and 'height') which
cause 
  the image to be resized on the fly.
- Documentation updated.

Because the product was rewritten in big parts this release is a beta 
version which might still have some bugs. I haven't had too much time for 
testing, so please report me any bug you find. I hope I will be ableto
publish 
the next stable release within the next two or three weeks.

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



Re: [Zope-dev] 2 Zopes

2000-10-26 Thread Gregor Heine

  Hi,
  
  Can anyone tell me a way to get Zope Objects from the first
  Zope-Installation to the second.
  I need this because i have to program a Product to putting data into
  different Zope Installations from one point of the Web.
  My boss want this way because he want a central point for data input,
  where the data are of different type and therefore they have to stored
  in different locations( different Zope Installations) My idea is to use
  ZPublisher.Client, but i don't find a way to use it.
  
  thanks as
 
 if you need to copy the actual objects verbatim you might want to
 investigate exporting to zexp and using file transfer between the hosts
 and (using Client to faciltate calling into zope) importing them on the
 second server.
 

The Client/Server Product is probably doing exactly what you want.
It uses the Zope Export/Import facility to transfer whole objects from one
Zope to another. 
You find it at www.zope.org/Members/MacGregor/Client_Server
maybe you give it a try :)

Cheers, 
Gregor!

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )




RE: [Zope-dev] (no subject)

2000-10-15 Thread Gregor Heine

 I recently asked how to read in and render the contents of 
 an external file, which doesn't work anymore using 
 Zope 2.2.2 an LocalFS' xxx.read(), and You responded that
 
  The quickest solution for you would be an external method
  that gets the file, performs the "read" and returns the result.
 
 Now I use in an external method fsreadin a .py-module with
 
 import sys
 def readinfile (self, html):
 """Ralf Herolds way to read in local file objects."""
 file = open(html, "r")
 filecontent = file.read()
 file.close()
 return filecontent
 
 which is referenced in a DTML method by 
 dtml-var "fsreadin('/tmp/var/thewantedtext.html')".
 
 It works, but I almost cannot believe that this is that 
 simple - am I missing something, is security a concern?
 

It *is* that simple. The only problem is security. That way, you can read
*any* file that has read permission for the user, the zope process is
running on, e.g. everybody could use something like
http://your.host/fsreadin?html='/etc/passwd' to view your password file.
If you want to read files only from one directory, you could use:

import sys, os, string
def readinfile (self, file):
"""Ralf Herolds way to read in local file objects."""
 
file=file[max(string.rfind(id,'/'),string.rfind(id,'\\'),string.rfind(id,':'
))+1:]
path=os.path.join('/tmp','var',file)
file = open(path, "r")
filecontent = file.read()
file.close()
return filecontent

This would ensure, that only files from /tmp/var can be read.

Cheers,
Gregor!



___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )