Now, if you're uploading files to Zope, rather than the file system, it's a little different, in that you have to get the data from an object, and you'll probably have to split it by newline yourself.

John Poltorak wrote:

This is the way I had been thinking of setting it up, but can't find an example of opening and reading such an object.

Here's a "Script (Python)" and a ZPT that does what I think you want. Notes:
  - I called the script "parse_file" so if you rename/relocate it
    fix the line in the ZPT to correspond.
  - I used a "File" in the same folder named "urls" hence I used
  - the CLONE thing is a bit confusing, but I needed it for my uses.


---------------- CUT HERE ------------------------
## Script (Python) "parse_file"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=file, sepr='', clone=False
# Returns a list of the lines of FILE; if SEPR if given the lines
# are split into lists.

# Get the "file" as a single string
filetext = str( file )

# Start with nothing:
alist  = []

# Throw away CR (if any) then split at the NLs:
for line in filetext.replace('\r','').split('\n'):
    if line == "":
    # Handle one-element-per-line differently:
    if sepr and sepr in line:
    elif clone and sepr:

return alist
---------------- CUT HERE ------------------------
    <title tal:content="template/title">The title</title>

    <h2><span tal:replace="here/title_or_id">content title or id</span>
        <span tal:condition="template/title"
tal:replace="template/title">optional template title</span></h2>

   This is Page Template <em tal:content="template/id">template id</em>.
    <form name="aForm" method=GET action="/blah/blah">
     <select name="url">
      <tal:block repeat="opt opts">
        <option value="optval"
tal:attributes="value python:opt[0]">
              Option Text</option>
      <input type=submit>
---------------------- CUT HERE ------------------------,Google,Yahoo!
---------------------- CUT HERE ------------------------
Zope maillist  -
**   No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to