[Zope] ZCTextIndex and word position
Hi, I am using a ZCTextIndex to index and search text files. I use a search form to retrieve the objects that match a search. I would like to know if it is possible to retrieve more details about the search, in particular the line numbers (or the word position in the file) where a match has been found in a particular file? Thanks, Eric ___ 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] PUT_factory and File object?
Hi, I am trying to upload text files as File objects instead of DTML documents to avoid HTML escaping. What is the type of the File object in Zope ? The example in the Zope book are ZopePageTemplate and PythonScript objects,, but I just want a File object. This does not work: def PUT_factory( self, name, typ, body ): if typ.startswith('text'): ob = File(name, body) return ob Which is the correct syntax? Where can I find the list of available objects in Zope and their attributes? Thank you, Eric ___ 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] PUT_factory and File object?
Eric Fernandez wrote: Hi, I am trying to upload text files as File objects instead of DTML documents to avoid HTML escaping. What is the type of the File object in Zope ? The example in the Zope book are ZopePageTemplate and PythonScript objects,, but I just want a File object. This does not work: def PUT_factory( self, name, typ, body ): if typ.startswith('text'): ob = File(name, body) return ob Which is the correct syntax? Where can I find the list of available objects in Zope and their attributes? Thank you, Eric ___ 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 ) I found this syntax which seems to work correctly for text files: from OFS.Image import File def PUT_factory( self, name, typ, body ): if typ.startswith('text'): ob = File(name, '', body, content_type=typ) return ob However, I cannot upload jpg files anymore... What am I doing wrong there? Eric ___ 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] PUT_factory and File object?
Stefan H. Holek wrote: On 10. Aug 2006, at 13:52, Eric Fernandez wrote: def PUT_factory( self, name, typ, body ): ob = None if typ.startswith('text'): ob = File(name, '', body, content_type=typ) return ob However, I cannot upload jpg files anymore... What am I doing wrong there? Stefan -- Anything that, in happening, causes something else to happen, causes something else to happen. --Douglas Adams So I guess http://www.plope.com/Books/2_7Edition/ExternalTools.stx#2-18 needs to be corrected? Eric ___ 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] uploading text file by FTP: encoding problem?
Hi, I have a problem when I upload an ASCII text file into a zope2 folder. I have a plain-text file with double quotes and line breaks. However, once uploaded, double quotes become quot and line breaks become \n. Even if I change the property into text/plain or text/xml, I get the same problem. Only if I create a file using the manager, then copy my text into it, that I keep the original formatting. Do I do something wrong? How to preserve the original encoding? Thanks. Eric ___ 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] Reading and parsing a text file object
Roberto Benitez wrote: The following worked for me: with a file object containing the following text: line one of test file line two of test file line three of test file I was table to parse lines w/ following code: file=%s % context.textfile num=1 for line in file.split(\n): print LINE %s IS: %s % (num,line) num+=1 return printed result was as follows: LINE 1 IS: line one of test file LINE 2 IS: line two of test file LINE 3 IS: line three of test file Thanks a lot, that is very useful. Although I wonder why there is no more direct method to do this, this works well. Cheers, Eric ___ 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] Reading and parsing a text file object
[EMAIL PROTECTED] wrote: Roberto Benitez wrote: file=%s % context.textfile Huh? Isn't that just a weird and probably inefficient way of writing file=str(context.textfile)? Sso I was mistaken when I said \n were removed... I can indeed split by '\n' the result of str(context.textfile) Eric ___ 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 )