Re: [Zope] Unable create photo object using dtml and python
i just took up zope and still experimenting with it. What is a file upload object..? Can you show me an example?
Date: Thu, 13 Mar 2003 17:19:29 +0100 From: "Stefan H. Holek" <stefan@epy.co.at> To: LIM TIENAIK <lim_tien_aik@hotmail.com> cc: zope@zope.org Subject: Re: [Zope] Unable create photo object using dtml and python
The file parameter you pass to manage_addPhoto must be a FileUpload object=20 not simply a filename.
Stefan
--On Donnerstag, 13. M=E4rz 2003 15:59 +0000 LIM TIENAIK=20 <lim_tien_aik@hotmail.com> wrote:
I would like to ask for a little help with the photo and photo folder product. I have installed it on zope, but adding photo dont seems to
work
with either dtml or python. The syntax i used to add a photo is <dtml-call "manage_addProduct['Photo'].manage_addPhoto(name,title, file)"> and the syntax i used in python is context.manage_addProduct['Photo'].manage_addPhoto(name,title,file). Those 2 ways dont work and the error message from zope i receive is Error Type: AttributeError Error Value: read Traceback (innermost last): File C:\Program Files\skyheavens\lib\python\ZPublisher\Publish.py, line 150, in publish_module File C:\Program Files\skyheavens\lib\python\ZPublisher\Publish.py, line 114, in publish File C:\Program Files\skyheavens\lib\python\Zope\__init__.py, line 158, in zpublisher_exception_hook (Object: skyheavens) File C:\Program Files\skyheavens\lib\python\ZPublisher\Publish.py, line 98, in publish File C:\Program Files\skyheavens\lib\python\ZPublisher\mapply.py, line 88, in mapply (Object: addPhotoScript) File C:\Program Files\skyheavens\lib\python\ZPublisher\Publish.py, line 39, in call_object (Object: addPhotoScript) File C:\Program Files\skyheavens\lib\python\Shared\DC\Scripts\Bindings.py, line 252, in __call__ (Object: addPhotoScript) File C:\Program Files\skyheavens\lib\python\Shared\DC\Scripts\Bindings.py, line 283, in _bindAndExec (Object: addPhotoScript) File C:\Program Files\skyheavens\lib\python\Products\PythonScripts\PythonScript.py, line 291, in _exec (Object: addPhotoScript) (Info: ({'script': <PythonScript instance at 01849B40>, 'context': <Folder instance at 01783810>, 'container': <Folder instance at 01783810>, 'traverse_subpath': []}, ('picuture', 'a new picture', 'C:\\WINDOWS\\Desktop\\shirt-design\\cover2.jpg'), {}, None)) File Script (Python), line 1, in addPhotoScript File C:\Program Files\skyheavens\lib\python\Products\Photo\Photo.py, line 654, in manage_addPhoto AttributeError: (see above)
I hope that someone can help me with this. Thanks
_________________________________________________________________ Are you in love? Find a date on MSN Personals http://match.msn.com.my/
_______________________________________________ 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 )
-- Those who write software only for pay should go hurt some other field. /Erik Naggum/
--__--__--
Message: 18 Date: Thu, 13 Mar 2003 10:24:27 -0600 From: "Michael R. Schwab" <Michael.Schwab-mail.zope.org@icantbelieveididthat.com> To: Chris Withers <chrisw@nipltd.com> CC: sean.upton@uniontrib.com, zope@zope.org Subject: Re: [Zope] Zope product security question
Chris Withers wrote:
Michael R. Schwab wrote:
The issue that I'm facing seems to be Zope's security model. The ZDG's security guide has even specified that object properties that are basic Python types cannot have their permissions set via the usual security.declarePublic() call (this includes 'id', 'meta_type', 'title').
This is true.
Yoru options are:
1. setDefaultAccess('deny') and then provide setter and accessor methdos for the attributes in question.
2. I believe setDefaultAccess can be passed a list or function that determines whether an attribute is accessible. You'd have to do some research on this.
Ok, to implement via option #2:
Set the following security declarations:
__roles__ = () security = ClassSecurityInfo() security.setDefaultAccess( {'id':1, 'meta_type':1, 'title':1} )
This allows public access to the 'id', 'meta_type', and 'title', but disallows access to all other properties such as 'ctime'. Alternatively, you can also specify an inaccessible property with 'ctime':0 in the security.setDefaultAccess() call.
Its a bit of a hoop jumping lesson, but it works. Thanks Chris!
I don't want to specify security.setDefaultAccess( 'allow' ) as this would allow access to mutable types within my product from scripts and defeats the purpose of setting a strict default security policy.
Be careful. OFS.SimpleItem.SimpleItem does this anyway, so you'll have to ensure you specifically set the policy in your product.
cheers,
Chris
--__--__--
Message: 19 From: "Michael Havard" <nhavar@hotmail.com> To: zope@zope.org Subject: Re: [Zope] can zope port to java/dotnet? Date: Thu, 13 Mar 2003 16:43:24 +0000
Maybe we're looking at this from the wrong direction. Maybe the best way to leverage those skills and toolsets is in the area of interoperation instead of porting the whole shebang from trendy platform to trendy platform.
For example lets say on my team I have 1 python, 6 java, and 2 .net people. I could use the python guy to create a product that communicated with a larger product created by the 6 java developers that used some other component created by the .net people.
These languages don't have to be used to the exclusion of all else. I see this same thing happen in Java based web development. None of the java programmers want to know anything at all about HTML/CSS/Javascript/XML/XSLT. They want to focus on Java generating it all for them and it ending up perfectly on the other side - sans designer. They see no value whatsoever in learning or much less coding any script, html, or css. It's all about JSP, STRUTS, whathaveyou(which of course has to be learned, but that seems to be out of their realm of understanding).
I fear that Java programmers of today are going to be the COBOL programmers of tommorrow. They'll be 55 years old extolling the virtues of the virtual machine and JIT well after something else has become popular. They'll be locked into a decreasing job market because they refused to go outside of their box and learn anything new. They'll end up like Powerbuilder programmers ;).
From: Dylan Reinhardt <zope@dylanreinhardt.com> To: Chen Fu <novalet@yahoo.com.cn>,zope@zope.org Subject: Re: [Zope] can zope port to java/dotnet? Date: Wed, 12 Mar 2003 20:45:47 -0800
At 07:15 PM 3/12/2003, =?gb2312?q?Chen=20Fu?= wrote:
I like zope for its pure OO framework. is it the only work among the CMSs take this design? If it is true, why not any other clone in java, c# or cpp?
If people who programmed in c# or java cared about using good tools, they'd have switched over to Python by now. :-)
I agree Python is a good language, but it faces many challenges also like relative slow speed
Python code won't execute as fast as assembler, but you'll finish your project a lot faster and have an easier time maintaining it.
, short of programmer(compare with java cpp)
Python is today poised where Linux was about 6-7 years ago... most people have barely heard of it and only a few have found out first-hand how utterly it eclipses just about everything other choice in a wide range of applications. Six years ago was a great time to be building your credentials as a Linux guru... now is a great time to be investing your time in Python.
and short of elite programming environment (like MS visual studio).
There are overpriced IDEs for Python too. :-) Anyway, 90% of the problems solved by IDEs just aren't problems in Python. Turn on syntax highlighting in Vim and you've got pretty much all the environment you could possibly need.
Some articles explain why the zope can't port from CPython to JPython. But how about a rebuild in pure java/cpp/c#? is it possible and deserved?
A more important question is why you'd bother. Why waste important development time achieving barely any more performance than you might have gotten out of a memory upgrade? Besides, who want to recompile every time you upgrade a product?
Evaluating Python (or Zope) for its speed of execution is asking the wrong set of questions about this kind of software. Performance matters *some*, but not nearly as much as development cost, maintenance cost, and time to market. If you work in an environment where software gets validated or audited, you just can't beat Python for its clarity. When push comes to shove, it's usually a lot easier to get more hardware than more hours of good programming talent.
If you want to improve Zope's performance, you can start by delegating more. Proxy aggressively. Serve all static content (especially images) out of Apache. Do more load balancing. Upgrade to ZEO. Once you look at the big picture, there are very few situations where tweaking low-level code is the most efficient way to conceive of improving performance. Just because Zope *can* serve as an all-in-one tool doesn't mean that's the best way to use it.
There are situations where writing the smallest, fastest thing possible is critical... most web apps just aren't in that domain. If you're having performance problems in a web app, your time is almost always better spent tweaking the graphics than just about anything else.
My $.02,
Dylan
_______________________________________________ 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 )
_________________________________________________________________ MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*. http://join.msn.com/?page=features/virus
--__--__--
Message: 20 Subject: Re: [Zope] Struggle to call a Zclass object from another web object From: pieter claassen <pieter@openauth.co.uk> Reply-To: pieter@openauth.co.uk To: Dylan Reinhardt <zope@dylanreinhardt.com> Cc: zope@zope.org Organization: OpenAuth Limited Date: 13 Mar 2003 16:43:56 +0000
Ok, point taken, but...
The folder that I placed my product (remember we are talking ZClass product here) in does have a standard_html_header and footer. So this looks like some kind of bug and the object traversal is not working. All I want to do is include the result of the __call__ in a html page so that I can __call__ a number of objects (just by including them as <dtml-var>) and return their results in one page.
This works fine for any native zope object (folder, file etc.) but for my custom Zclass based product, it fails.
Another pointer is that when I do this <dtml-var newster>
I get the following rendition in my web page
<NewsManager at newster>
I have worked around the problem by calling the Object URL in an inline frame, but that is a little lame.
Here is my ZClass's index_html
<dtml-in "objectValues('Message')">
<dtml-unless expire> <table width="606" border="1" cellspacing="2"> <tr><td> <h1><dtml-var title></h1> </td></tr> <tr><td> <h2><dtml-var summary></h2> </td></tr> <tr><td> <p><dtml-var body> </td></tr> </table> </dtml-unless>
</dtml-in>
And this is the error that I get when I call it as follows: <dtml-with newster> <dtml-var expr="newster.index_html()"> </dtml-with>
Error traceback Traceback (innermost last): Module ZPublisher.Publish, line 98, in publish Module ZPublisher.mapply, line 88, in mapply Module ZPublisher.Publish, line 39, in call_object Module OFS.DTMLMethod, line 126, in __call__ Module DocumentTemplate.DT_String, line 474, in __call__ Module DocumentTemplate.DT_With, line 76, in render Module DocumentTemplate.DT_Util, line 201, in eval - __traceback_info__: newster Module <string>, line 2, in f Module OFS.DTMLMethod, line 119, in __call__ Module DocumentTemplate.DT_String, line 474, in __call__ Module DocumentTemplate.DT_In, line 628, in renderwob Module DocumentTemplate.DT_Util, line 201, in eval - __traceback_info__: objectValues Module <string>, line 2, in f NameError: global name 'objectValues' is not defined
Thanks, Pieter
On Thu, 2003-03-13 at 15:18, Dylan Reinhardt wrote:
The problem is you're having is not the problem you think you're having. :-)
You're getting an error for standard_html_header. Zope hasn't gotten to parse the expression you're fiddling with yet, so don't be surprised if what you're doing continues to produce errors.
Tracebacks are a very good thing to get in the habit of reading. Typically the most important information is contained in the last couple steps, though in Zope, it's sometimes the case that the real error is five or six steps in.
In this case your error is right on the last line: Module DocumentTemplate.DT_String, line 474, in __call__ KeyError: standard_html_header
When objects get rendered, the __call__ method is typically used on them. Everything to the left of that is unlikely to be useful to you until you get to the point where you're modifying source code. Looking to the right of __call__, a KeyError usually pops up when an object name can not be resolved by Zope. This error is telling you that Zope was unable to find the standard_html_header object.
So make sure there is a standard_html_header in your root folder that you have permissions to view it. That should fix the problem... or at least, it will get you along to the next one. :-)
HTH,
Dylan
At 02:09 AM 3/13/2003, pieter claassen wrote:
Hello,
I guess I still don't get Zope completely.
I wrote a news manager Zclass that works well. Normally I get to the object by calling the newster/index_html method (the default behaviour).
I want to integrate it into my website and in my root directory I have the following objects:
index_html (dhtml object) menu (dhtml object) top (dhtml object) news (Zclass object)
I want to do use my index_html to do pull all these objects together on a single page like:
<dtml-var standard_html_header> <dtml-var top> <table border="0" cellspacing="0" cellpadding="0"> <tr> <td> <dtml-var menu> </td> <td><dtml-var news></td> </tr> </table> <dtml-var standard_html_footer>
But, clearly calling <dtml-vat news> just doesn't call the index_html method on the news object and include the result.
I have tried things like <dtml-var expr="news.index_html()"> and that get an error that
Traceback (innermost last):
* Module ZPublisher.Publish, line 98, in publish * Module ZPublisher.mapply, line 88, in mapply * Module ZPublisher.Publish, line 39, in call_object * Module OFS.DTMLMethod, line 126, in __call__ * Module DocumentTemplate.DT_String, line 474, in __call__ * Module DocumentTemplate.DT_Util, line 201, in eval __traceback_info__: newster * Module <string>, line 2, in f * Module OFS.DTMLMethod, line 119, in __call__ * Module DocumentTemplate.DT_String, line 474, in __call__ KeyError: standard_html_header
Somebody out there must have solved this problem? Any help is appreciated.
Thanks, Pieter
_______________________________________________ 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 ) --
Pieter Claassen pieter@openauth.co.uk http://www.openauth.co.uk
OpenAuth Tel: 01344 390530 DDI: 01344 390630/390631 Fax number: 01344 390700 Mobile: 0776 665 6924
Highview House Charles Square Bracknell Berkshire RG12 1DF
TERMS AND CONDITIONS (i)The information contained in this email and attachments is only intended for the addressed recipient(s) and may not be distributed or viewed by any other party without the explicit consent of the sender. If you have received this message by accident, please contact Pieter Claassen (pieter@openauth.co.uk) and destroy any electronic or physical copies of the information contained in it, immediately. (ii)This email is not certified to be virus free and OpenAuth accepts no liability for losses arising from you receiving this email. (iii)Any digital signatures (if present) used to authenticate this email, only serves to allow you to verify the originating email address of the sender and should not be relied upon to prove identity or base financial transactions on, unless the Certificate Practice Statement that the signature references, explicitly states differently. (iv)This email may be subjected to further terms and conditions as published on the company website at http://www.openauth.co.uk. If you need to rely on the information contained in this email in any way, then you should read those terms and conditions to understand how much you can trust the information in this email. (v)OpenAuth retains the copyright on any relevant material that is included in this email.
--__--__--
Message: 21 From: pieter claassen <pieter@openauth.co.uk> Reply-To: pieter@openauth.co.uk To: zope@zope.org Organization: OpenAuth Limited Date: 13 Mar 2003 16:51:38 +0000 Subject: [Zope] Product (ZClass) distribution rights management
Apologies for the repeat post but I have not had an answer on this one.
1. Is there any way to override the permissions built into ZCLass product distribution framework so that I can create recover the development code that I thought I could modify, but it turned out that I don't have the rights to repackage the code?
2. Where does the modifications to the Zclass based product gets stored (it is certainly not stored in the /lib/python/Products/productx as I have zipped that up and moved it over to my new machines and it was the original version without any of my modifications)
This problem might turn out to be a serious issue and very damaging for Zclass based products.
Thanks, Pieter
--__--__--
Message: 22 To: "Michael Havard" <nhavar@hotmail.com> Cc: zope@zope.org Subject: Re: [Zope] can zope port to java/dotnet? From: William Goedicke <goedicke@goedsole.com> Date: 13 Mar 2003 11:56:49 -0500
Dear Y'all -
At 07:15 PM 3/12/2003, =?gb2312?q?Chen=20Fu?= wrote:
I like zope for its pure OO framework. is it the only work among the CMSs take this design? If it is true, why not any other clone in java, c# or cpp?
I agree Python is a good language, but it faces many challenges also like relative slow speed
Of course, you must be suggesting Python is slow relative to c#, cpp. Python like a decent abacus is blindingly fast compared to java.
Yours - Billy
============================================================ William Goedicke goedicke@goedsole.com http://www.goedsole.com:8080 ============================================================
Lest we forget:
When you think something nice about someone you're with, tell them about it.
- William Goedicke
--__--__--
_______________________________________________ Zope maillist - Zope@zope.org
End of Zope Digest
_________________________________________________________________ Download ringtones, logos and picture messages from MSN Malaysia http://www.msn.com.my/mobile/ringtones/default.asp
LIM TIENAIK wrote at 2003-3-14 01:16 +0000:
i just took up zope and still experimenting with it. What is a file upload object..? Can you show me an example?
It's about 2 meter tall and 1 meter large :-) You find its definition in "ZPublisher.HTTPRequest.FileUpload". You get an instance, when you sent a file to Zope (via a form, e.g.). You will find more information in the Zope Book... Dieter
participants (2)
-
Dieter Maurer -
LIM TIENAIK