Re: [Zope] probably a simple answer..

2005-11-21 Thread Nikko Wolf

External methods can certainly use the built in Python "open" function.

However, I'd shudder at the thought of creating an "Excel" file rather
than a plain-text CSV (comma separated values) file, since the former is
(I presume) closed-source and binary, whilst the latter is simple text,
human readable and should be easy to make.  However, it sounds like this
part might already be working, so YMMV.

Also, it sounds like you're intending to have Zope/Plone generate the
file, and then placing it on a file system so that users can get at it
"from anywhere".   Keep in mind that if the data in MySQL changes, the
file system version won't (necessarily) have been updated hence
it'll be out of date with no indication to the viewer.

To solve that, presuming you're only providing file system access for
MSWindows clients, you could put a MSW-style-URL-link file on the shared
file system.  Then you would have semi-transparent access to the current
data through a file system "file" (if there is anonymous access or
authentication transparent to the user).

And if you *DO* write the file to the file system, be sure to test for
concurrent read/write conflicts on the file (and it's timing related, so
do lots of read-hits while writing, or use a write-and-rename scheme. (I
could recount a horror story of intermittently lost data at the customer
site that I never did duplicate locally).

Either way, good luck.


Kate Legere wrote:

Well, we're working on porting it over from linux but at the moment that's
my only option... I just had this impression that I'd seen something whereby
I could write to the filesystem using an external method.

Kate

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Thursday, November 17, 2005 1:06 PM

To: Kate Legere; zope@zope.org
Subject: RE: [Zope] probably a simple answer..

Well, I can suggest how I might approach it, which might be different 
than what you intend... but for what it is worth...


First, run Zope on a Windows server so you can interact with an Excel 
file as an ODBC Data Source (DSN).  You could setup a Zope/ODBC 
adaptor Product like zodbc or (better) mxODBC in Zope.  Then in 
Windows control panel, setup an ODBC DSN to the Excel file, and 
create a Zope/ODBC connection in the ZMI.  Then you might be able to 
use ZSQL methods, or Python if you perfer, perhaps using SQL or the 
Windows API, to write to the Excel spreadsheet. You might have to use 
some sort of external file storage for the Excel file, i.e. I'm not 
sure how you could store the Excel file in the ZODB and still 
interact with it and expose it through Zope, though that might be 
possible. 

Like Andreas said, you can't write to a users file system directly,  
if that's what you meant.






___
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] probably a simple answer..

2005-11-18 Thread Chris Withers

Kate Legere wrote:

Well, we're working on porting it over from linux but at the moment that's
my only option... I just had this impression that I'd seen something whereby
I could write to the filesystem using an external method.


Categorically, no web server can write to the file system on a client, 
think about what a horrific security hole that would be ;-)


Why on earth would you port anything over _from_ linux?!

cheers,

Chris

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

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

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] probably a simple answer..

2005-11-17 Thread Robert Boyd
On 11/17/05, Kate Legere <[EMAIL PROTECTED]> wrote:
>
> Well, we're working on porting it over from linux but at the moment that's
> my only option... I just had this impression that I'd seen something whereby
> I could write to the filesystem using an external method.
>
> Kate

Sure you could write to the filesystem of the server hosting Zope. I
do it with XML files, having Zope Product code open a file, parse it,
modify it, write it to the filesystem. The uid running Zope will need
write permission to wherever you want the file to go. If you want the
resulting file to appear as a downloadable file linked on a web site,
you could work with ExternalFile or similar. None of this touches on
the issue of how you create an Excel file (you hope to do this from
Linux?)

Rob
___
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] probably a simple answer..

2005-11-17 Thread Kate Legere

Well, we're working on porting it over from linux but at the moment that's
my only option... I just had this impression that I'd seen something whereby
I could write to the filesystem using an external method.

Kate

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Thursday, November 17, 2005 1:06 PM
To: Kate Legere; zope@zope.org
Subject: RE: [Zope] probably a simple answer..

Well, I can suggest how I might approach it, which might be different 
than what you intend... but for what it is worth...

First, run Zope on a Windows server so you can interact with an Excel 
file as an ODBC Data Source (DSN).  You could setup a Zope/ODBC 
adaptor Product like zodbc or (better) mxODBC in Zope.  Then in 
Windows control panel, setup an ODBC DSN to the Excel file, and 
create a Zope/ODBC connection in the ZMI.  Then you might be able to 
use ZSQL methods, or Python if you perfer, perhaps using SQL or the 
Windows API, to write to the Excel spreadsheet. You might have to use 
some sort of external file storage for the Excel file, i.e. I'm not 
sure how you could store the Excel file in the ZODB and still 
interact with it and expose it through Zope, though that might be 
possible. 

Like Andreas said, you can't write to a users file system directly,  
if that's what you meant.


-- 
Harlow Pinson
Indepth Learning
Email: [EMAIL PROTECTED]
Phone: 505 994-2135
Fax: 505 994-3603


___
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] probably a simple answer..

2005-11-17 Thread hpinson
Well, I can suggest how I might approach it, which might be different 
than what you intend... but for what it is worth...

First, run Zope on a Windows server so you can interact with an Excel 
file as an ODBC Data Source (DSN).  You could setup a Zope/ODBC 
adaptor Product like zodbc or (better) mxODBC in Zope.  Then in 
Windows control panel, setup an ODBC DSN to the Excel file, and 
create a Zope/ODBC connection in the ZMI.  Then you might be able to 
use ZSQL methods, or Python if you perfer, perhaps using SQL or the 
Windows API, to write to the Excel spreadsheet. You might have to use 
some sort of external file storage for the Excel file, i.e. I'm not 
sure how you could store the Excel file in the ZODB and still 
interact with it and expose it through Zope, though that might be 
possible. 

Like Andreas said, you can't write to a users file system directly,  
if that's what you meant.


-- 
Harlow Pinson
Indepth Learning
Email: [EMAIL PROTECTED]
Phone: 505 994-2135
Fax: 505 994-3603

___
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] probably a simple answer..

2005-11-17 Thread Kate Legere
Not really.. Ideally, I'd like the script just to save the file to a
pre-selected path. Then anyone can open it from there.

Kate

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of
[EMAIL PROTECTED]
Sent: Thursday, November 17, 2005 12:14 PM
To: zope@zope.org
Subject: Re: [Zope] probably a simple answer..

I'm thinking Kate means that she is writing to an Excel file on a 
Zope/Windows server, acting as a simple database, perhaps via ODBC. 

Kate can you clarify what you are trying to do? Thanks.


-- 
Harlow Pinson
Indepth Learning
Email: [EMAIL PROTECTED]
Phone: 505 994-2135
Fax: 505 994-3603

___
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] probably a simple answer..

2005-11-17 Thread hpinson
I'm thinking Kate means that she is writing to an Excel file on a 
Zope/Windows server, acting as a simple database, perhaps via ODBC. 

Kate can you clarify what you are trying to do? Thanks.


-- 
Harlow Pinson
Indepth Learning
Email: [EMAIL PROTECTED]
Phone: 505 994-2135
Fax: 505 994-3603

___
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] probably a simple answer...

2005-11-17 Thread Andreas Jung



--On 17. November 2005 10:51:32 -0500 Kate Legere <[EMAIL PROTECTED]> wrote:


So this probably has a simple answer but if someone could direct me it
would save lots of time ...

I have a python script that gets called from a dtml method and returns the
information requested from a mySql database and opens it as an excel file.
I'd like it also to save the file (it can safely overwrite the existing
file) ... how do I do this?


What means you would like to save the file? As soon as the file is on the 
client side there is *nothing* you can do from the Zope side.


-aj




---the python script has

request = container.REQUEST
RESPONSE =  request.RESPONSE

table_example = <-- html table formatting tags and python code to get the
info from the database -->

RESPONSE.setHeader("Content-type","application/vnd.ms-excel")
RESPONSE.setHeader("Content-disposition","attachment;filename=statsSpread
she et.xls")


return table_example

-

Kate

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






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