Re: [Zope-dev] ExternalEditor Windows

2002-05-22 Thread brian.r.brinegar.1

On Tue, 21 May 2002, Casey Duncan wrote:

 I totally agree. And I still intend to deliver one that runs native on
 windows, probably just using the windows scripting host.

 This version will hopefully tide people over for the time being.

 -Casey


I've started a VB Script version for the Windows Scripting Host. Right now
I'm in the proof of concept stage. I've got something that opens a file,
spawns an editor, gets the process id, and can PUT a file to Zope. (works
with SSL too)

I haven't figured out how to check if a process has exited.

I would like some suggestions on how to handle the config file, I'll
probably use the same format as the Python version, but I would also like
to take advantage of the Content-type registry Windows has.

I'll keep the list up to date on my progress.

-Brian



___
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] ExternalEditor Windows

2002-05-22 Thread Casey Duncan

On Wednesday 22 May 2002 04:19 am, Joachim Schmitz wrote:
 Hi,
 
 how do I start this, I made the changes in the browser (opera), installed 
 the latest Python-2.2.1 with tk-support. I can start zopeedit-win32.py by 
 dubbleclick, but than it terminates cause of missing arguments. But when I 
 select  zopeedit-win32.py in Opera for application/x-zope-edit, and click 
 on the pencil, I get cannot start application. When I enter 
 /path_to_python/pythonw /path_to_ZE/zopeedit-win32.py
 and click on the pencil, the sandbox is there for some moments and nothing 
 else visible happens.
 
 Can someone give me some insight ?

I'm not familiar with Opera but it sounds like you need to tell it where to 
pass the file name argument. In Netscape 4, you use %s. My advice would be to 
look at other content-types in the helper app configuration and see if there 
are any special incantations shown in them.

-Casey


___
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] ExternalEditor Windows

2002-05-22 Thread Matt Behrens

brian.r.brinegar.1 wrote:

 I've started a VB Script version for the Windows Scripting Host. Right now
 I'm in the proof of concept stage. I've got something that opens a file,
 spawns an editor, gets the process id, and can PUT a file to Zope. (works
 with SSL too)


Please pardon my Windows ignorance, but does using WSH mean that IE will 
be required to be used?



___
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] ExternalEditor Windows

2002-05-22 Thread Casey Duncan

On Wednesday 22 May 2002 09:06 am, Matt Behrens wrote:
 brian.r.brinegar.1 wrote:
 
  I've started a VB Script version for the Windows Scripting Host. Right now
  I'm in the proof of concept stage. I've got something that opens a file,
  spawns an editor, gets the process id, and can PUT a file to Zope. (works
  with SSL too)
 
 
 Please pardon my Windows ignorance, but does using WSH mean that IE will 
 be required to be used?

No, although WSH usually comes with IE. However, you can download it 
separately from MS if it is not on your system already.

-Casey


___
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] ExternalEditor Windows

2002-05-22 Thread brian.r.brinegar.1

On Wed, 22 May 2002, Behrens Matt - Grand Rapids wrote:

 brian.r.brinegar.1 wrote:

  I've started a VB Script version for the Windows Scripting Host. Right now
  I'm in the proof of concept stage. I've got something that opens a file,
  spawns an editor, gets the process id, and can PUT a file to Zope. (works
  with SSL too)

 Please pardon my Windows ignorance, but does using WSH mean that IE will
 be required to be used?


Nope, in fact I'm testing it with Netscape. :-)

-Brian





___
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] ExternalEditor Windows

2002-05-21 Thread brian.r.brinegar.1

Hello,

I'm working on porting Casey Duncans ExternalEditor helper application to
work with Windows. I've got some stuff working, but it's far from
complete. I was wondering if anyone else was working on this? I would hate
to be duplicating efforts, but I would love to help.

-Brian





___
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] ExternalEditor Windows

2002-05-21 Thread Andy McKay

On May 21, 2002 09:29 am, brian.r.brinegar.1 wrote:
 Hello,

 I'm working on porting Casey Duncans ExternalEditor helper application to
 work with Windows. I've got some stuff working, but it's far from
 complete. I was wondering if anyone else was working on this? I would hate
 to be duplicating efforts, but I would love to help.

I was thinking of doing the same thing, but if you've done most of it... 
anything I can do to help, let me know.
-- 
  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] ExternalEditor Windows

2002-05-21 Thread Casey Duncan

Gabriel Genellina [EMAIL PROTECTED] just today submitted a port 
that looks like it goes a long way toward Windows support. Attached is the 
helper app with her revisions.

Let me know if it works for you.

-Casey

On Tuesday 21 May 2002 01:08 pm, Andy McKay wrote:
 On May 21, 2002 09:29 am, brian.r.brinegar.1 wrote:
  Hello,
 
  I'm working on porting Casey Duncans ExternalEditor helper application to
  work with Windows. I've got some stuff working, but it's far from
  complete. I was wondering if anyone else was working on this? I would hate
  to be duplicating efforts, but I would love to help.
 
 I was thinking of doing the same thing, but if you've done most of it... 
 anything I can do to help, let me know.
 -- 
   Andy McKay


#!/usr/local/bin/python
##
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
# 
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED AS IS AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
# 
##

# Zope External Editor Helper Application by Casey Duncan
# Adapted for Win32 by Gabriel Genellina [EMAIL PROTECTED]

__version__ = '0.1'

import sys, os, stat
from time import sleep
from ConfigParser import ConfigParser
from httplib import HTTPConnection, HTTPSConnection


class Configuration:

def __init__(self, path):
# Create/read config file on instantiation
self.path = path
if not os.path.exists(path):
f = open(path, 'w')
f.write(default_configuration)
f.close()
self.changed = 0
self.config = ConfigParser()
self.config.readfp(open(path))


def __del__(self):
# Save changes on destruction
if self.changed:
self.save()

def save(self):
Save config options to disk
self.config.write(open(self.path, 'w'))
self.changed = 0


def set(self, section, option, value):
self.config.set(section, option, value)
self.changed = 1

def __getattr__(self, name):
# Delegate to the ConfigParser instance
return getattr(self.config, name)

def getAllOptions(self, meta_type, content_type):
Return a dict of all applicable options for the
   given meta_type and content_type

opt = {}
sep = content_type.find('/')
general_type = '%s/*' % content_type[:sep]
sections = ('general', 
'meta-type:%s' % meta_type,
'content-type:%s' % general_type,
'content-type:%s' % content_type)
for section in sections:
if self.config.has_section(section):
for option in self.config.options(section):
opt[option] = self.config.get(section, option)
return opt
 

class ExternalEditor:

saved = 1

def __init__(self, input_file):
try:
# Read the configuration file
config_path = os.path.expanduser('~/.zope-external-edit')
self.config = Configuration(config_path)

# Open the input file and read the metadata headers
in_f = open(input_file, 'rb')
metadata = {}

while 1:
line = in_f.readline()[:-1]
if not line: break
sep = line.find(':')
key = line[:sep]
val = line[sep+1:]
metadata[key] = val
self.metadata = metadata

self.options = self.config.getAllOptions(metadata['meta_type'],
   metadata.get('content_type',''))

# Write the body of the input file to a separate file
if sys.platform == 'win32':
import random
import tempfile
tempfile.mktemp() # init module
from urllib import unquote

body_file = unquote(self.metadata['url'][7:])
p = body_file.rfind('/')
if p0: body_file=body_file[p+1:]
ext = self.options.get('extension')
if ext and not body_file.endswith(ext):
body_file = body_file + ext
body_file_full = os.path.join(tempfile.tempdir, body_file)
ok = not os.access(body_file_full, os.F_OK)
i = 10
while (not ok) and (i0):
body_file_full = os.path.join(tempfile.tempdir, str(random.random())[2:] + '-' + 

Re: [Zope-dev] ExternalEditor Windows

2002-05-21 Thread Joachim Schmitz

Hi,

great to hear, I just wanted to write a mail to the list asking for a joint 
effort for bringing ExternalEditor to Windows. I personally cannot offer 
any help, except testing it, since I am working on linux.
I have EE installed and it works like charm, it is the solution for a 
problem, Zope has suffered from for a long time, and which gives a total 
new view to the Zope-IDE issue.

One hint thought for the Windows-helper app, it should possibly not require 
python at least not with tkinter build in. If it would run and install one 
pure windows, that would be best.




--On Dienstag, Mai 21, 2002 11:29:39 -0500 brian.r.brinegar.1 
[EMAIL PROTECTED] wrote:

 Hello,

 I'm working on porting Casey Duncans ExternalEditor helper application to
 work with Windows. I've got some stuff working, but it's far from
 complete. I was wondering if anyone else was working on this? I would hate
 to be duplicating efforts, but I would love to help.

 -Brian





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



Mit freundlichen Grüßen  Joachim Schmitz

AixtraWare Ingenieurbüro für Internetanwendungen
Hüsgenstr. 33a, D-52457 Aldenhoven
Telefon: +49-2464-8851, FAX: +49-2464-905163

Key fingerprint = DA10 CC82 62F8 1DBB 39A1  1EDC 725B 3317 A8D7 C3A6
Keyserver: http://www.keyserver.net/en/


___
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] ExternalEditor Windows

2002-05-21 Thread Casey Duncan

On Tuesday 21 May 2002 01:39 pm, Joachim Schmitz wrote:
 Hi,
 
 great to hear, I just wanted to write a mail to the list asking for a joint 
 effort for bringing ExternalEditor to Windows. I personally cannot offer 
 any help, except testing it, since I am working on linux.
 I have EE installed and it works like charm, it is the solution for a 
 problem, Zope has suffered from for a long time, and which gives a total 
 new view to the Zope-IDE issue.
 
 One hint thought for the Windows-helper app, it should possibly not require 
 python at least not with tkinter build in. If it would run and install one 
 pure windows, that would be best.

I totally agree. And I still intend to deliver one that runs native on 
windows, probably just using the windows scripting host. 

This version will hopefully tide people over for the time being. 

I also am thinking along the same lines with this being a new way to approach 
an IDE. from the bottom up if you will, built as smaller pieces working 
together with the web rather than trying to write it in one broad stroke 
(which has always failed thus far).

-Casey


___
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] ExternalEditor Windows

2002-05-21 Thread Joachim Schmitz



--On Dienstag, Mai 21, 2002 14:00:59 -0400 Casey Duncan [EMAIL PROTECTED] 
wrote:

 On Tuesday 21 May 2002 01:39 pm, Joachim Schmitz wrote:
 Hi,

 great to hear, I just wanted to write a mail to the list asking for a
 joint  effort for bringing ExternalEditor to Windows. I personally
 cannot offer  any help, except testing it, since I am working on linux.
 I have EE installed and it works like charm, it is the solution for a
 problem, Zope has suffered from for a long time, and which gives a total
 new view to the Zope-IDE issue.

 One hint thought for the Windows-helper app, it should possibly not
 require  python at least not with tkinter build in. If it would run and
 install one  pure windows, that would be best.

 I totally agree. And I still intend to deliver one that runs native on
 windows, probably just using the windows scripting host.

 This version will hopefully tide people over for the time being.

 I also am thinking along the same lines with this being a new way to
 approach  an IDE. from the bottom up if you will, built as smaller pieces
 working  together with the web rather than trying to write it in one
 broad stroke  (which has always failed thus far).

you exactly express my ideas ;-)



Mit freundlichen Grüßen  Joachim Schmitz

AixtraWare Ingenieurbüro für Internetanwendungen
Hüsgenstr. 33a, D-52457 Aldenhoven
Telefon: +49-2464-8851, FAX: +49-2464-905163

Key fingerprint = DA10 CC82 62F8 1DBB 39A1  1EDC 725B 3317 A8D7 C3A6
Keyserver: http://www.keyserver.net/en/


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