A function like a FTP Object
Hi all I would like to create a product with a function called struct.xml I would like if I could access it via FTP because I would like editor integration I open the file via FTP and I save it via FTP and PUT_factory mechamism Can I make struct.xml accesible via a FTP file? Thanks!!! -- Mis Cosas http://blogs.sistes.net/Garito/
Sure you can. Any object/method that is in Zope becomes available via FTP. Some example code:: class MyProduct(Folder): def struct_xml(self): return "<tag>1</tag>" def PUT(self, REQUEST, RESPONSE): if not REQUEST.get('BODY'): get_transaction.abort() RESPONSE.setStatus(405) else: body = REQUEST.get('BODY') self._save_struct_body(body) RESPONSE.setStatus(204) return RESPONSE setattr(MyProduct, 'struct.xml', MyProduct.struct_xml) On 7/3/05, Garito <garito@sistes.net> wrote:
Hi all I would like to create a product with a function called struct.xml
I would like if I could access it via FTP because I would like editor integration
I open the file via FTP and I save it via FTP and PUT_factory mechamism
Can I make struct.xml accesible via a FTP file?
Thanks!!!
-- Mis Cosas http://blogs.sistes.net/Garito/
_______________________________________________ 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 )
-- Peter Bengtsson, work www.fry-it.com home www.peterbe.com hobby www.issuetrackerproduct.com
Peter Bengtsson escribió:
Sure you can. Any object/method that is in Zope becomes available via FTP. Some example code::
class MyProduct(Folder): def struct_xml(self): return "<tag>1</tag>" def PUT(self, REQUEST, RESPONSE): if not REQUEST.get('BODY'): get_transaction.abort() RESPONSE.setStatus(405) else: body = REQUEST.get('BODY') self._save_struct_body(body) RESPONSE.setStatus(204) return RESPONSE
setattr(MyProduct, 'struct.xml', MyProduct.struct_xml)
On 7/3/05, Garito <garito@sistes.net> wrote:
Hi all I would like to create a product with a function called struct.xml
I would like if I could access it via FTP because I would like editor integration
I open the file via FTP and I save it via FTP and PUT_factory mechamism
Can I make struct.xml accesible via a FTP file?
Thanks!!!
-- Mis Cosas http://blogs.sistes.net/Garito/
_______________________________________________ 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 )
Hi! does this work on a folder? The struct.xml function is on a folder object and I would like struct.xml as an object contained by the folder one Thanks! -- Mis Cosas http://blogs.sistes.net/Garito/
Hi! does this work on a folder?
Sure it does. Did you understand any of my code? I subclassed it on the folder class.
The struct.xml function is on a folder object and I would like struct.xml as an object contained by the folder one
This is completely outside the zope management interface. Perhaps it is possible to override the PUT() function inside Zope but I doubt it. Look into writing your own python product.
Thanks!
-- Mis Cosas http://blogs.sistes.net/Garito/
_______________________________________________ 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 )
-- Peter Bengtsson, work www.fry-it.com home www.peterbe.com hobby www.issuetrackerproduct.com
Peter Bengtsson escribió:
Hi! does this work on a folder?
Sure it does. Did you understand any of my code? I subclassed it on the folder class.
The struct.xml function is on a folder object and I would like struct.xml as an object contained by the folder one
This is completely outside the zope management interface. Perhaps it is possible to override the PUT() function inside Zope but I doubt it. Look into writing your own python product.
Thanks!
-- Mis Cosas http://blogs.sistes.net/Garito/
_______________________________________________ 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 )
Yes, I think I understand your code but correct me if I get wrong: this code converts your folder in a file on the FTP server But what I need is to see the method like a file on the folder not the folder itself Did your code works like I need? THANKS!!! -- Mis Cosas http://blogs.sistes.net/Garito/
On 7/6/05, Garito <garito@sistes.net> wrote:
Peter Bengtsson escribió:
Hi! does this work on a folder?
Sure it does. Did you understand any of my code? I subclassed it on the folder class.
The struct.xml function is on a folder object and I would like struct.xml as an object contained by the folder one
This is completely outside the zope management interface. Perhaps it is possible to override the PUT() function inside Zope but I doubt it. Look into writing your own python product.
Thanks!
-- Mis Cosas http://blogs.sistes.net/Garito/
Yes, I think I understand your code but correct me if I get wrong: this code converts your folder in a file on the FTP server
But what I need is to see the method like a file on the folder not the folder itself
Did your code works like I need?
This is getting confusing. I can't have a file (seen when listing a folder) that is clever enough to do PUT() calls on itself. My code showed how to put a PUT() function on a folder (Folder-based). That means that if you do a PUT request onto the Folder, (eg. uploading a file) it get's picked up by that method.
THANKS!!!
-- Mis Cosas http://blogs.sistes.net/Garito/
_______________________________________________ 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 )
-- Peter Bengtsson, work www.fry-it.com home www.peterbe.com hobby www.issuetrackerproduct.com
participants (2)
-
Garito -
Peter Bengtsson