Re : [Zope3-Users] Zope and UTF-8 accentuated characters
Thanks Marius. My data is stored in a MySQL database (charset utf-8), which I access through sqlos. My string data are stored in a unicodeCol (a sqlos object which manages unicode data). The browser's page charset is UTF-8, so I gess there lies the problem. I generate pages through ajax via the jsonserver package. My request passes the request to the server, which generates HTML with pages templates and sends back the HTML, wich is used to update the page (via innerHTML). The fact is this problem is a bit random, sometimes the accents are well displayed, sometimes not. It also seems that there is a slight behaviour difference between linux (debian 3.1) and windows. Stéphane - Message d'origine De : Marius Gedminas [EMAIL PROTECTED] À : zope3-users@zope.org Envoyé le : Samedi, 26 Août 2006, 2h58mn 48s Objet : Re: [Zope3-Users] Zope and UTF-8 accentuated characters On Sat, Aug 26, 2006 at 02:34:55PM +0200, Stéphane Brault wrote: I have a lot of unicode data with accentuated characters. The trouble is that it is sometimes displayed the right way (in combo boxes, lists,.. ) and sometimes not, especially in text inputs. I use Unicode data in my Zope 3 applications extensively, and usually there are no problems. The input data is saved correctly but not displayed correctly (é is saved the following the utf-8 format and displayed as é, which corresponds the utf-8 encoding). It is customary to store Unicode data in Python's unicode strings rather than in UTF-8 encoded 8-bit strings. Can you check what your web browser thinks about the page's charset? If it selects ISO-8859-1, then your data is presented correctly, but the server did not specify the correct Content-Type header. If the browser thinks the page is in UTF-8, then the server mishandled the data. Zope 3 automatically converts Unicode to UTF-8 and adds 'charset=UTF-8' to the Content-Type header when a view returns a Unicode string. This is the recommended way of handling Unicode data in Zope 3, and this is what happens by default if your views render page templates. I tried defining my templates' charset as utf-8, but that generates lots of errors. Has anyone an idea on how to solve this problem. You have not told us enough to diagnose the problem. Can you reproduce it with a shortest possible test case? Marius Gedminas -- Woe unto them that rise up early in the morning -- Isaiah 5:11 ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Re: [Zope3-dev] z3c - be or not to be
On 27.08.2006, at 18:53, Dieter Maurer wrote: Roger Ineichen wrote at 2006-8-25 18:27 +0200: ... The reason why; We really have no time to do this in the next couple of month. And the option sombody else doing it is also *NO* option because we have allready productive projects build on this libraries and have no time to migrate them for nothing. Yes renaming the z3c namspace whould technicaly possible, but for me(us) it's just a waist of time right now. Could be that I will change my mind in the future but not in the next couple of months. I have no opinion on namespaces (especially, whether or not z3c should be renamed). But technically, it would be extremely easy: If nothing else would change than the top level name, then a single module alias (e.g. sys.modules['z3c'] = zorg) would suffice to let all existing software work as before. yes, but this hack have to be applied on all running instances we have some z3c packages running on the other side all the externals of all our projects need to be updated and this is really a waste of time as long there are no releases of those packages, currently only the initial developers of the z3c packages are actively working on those packages, i would say let us talk about this issue in a few month again -- Dieter ___ Zope3-dev mailing list Zope3-dev@zope.org Unsub: http://mail.zope.org/mailman/options/zope3-dev/zope- mailinglist%40mopa.at ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re : [Zope3-Users] Why Zope3
I'm not a zope 3 expert, mainly a user. I use zope 3 for my company project and I'm fairly happy with it. I don't use the ZODB (the object database coming with zope) but mysql through the sqlos package (which allows to use the SQLObject ORM), there is also a package which allows the use of SQLAlchemy, zalchemy, but I haven't used it so I can't comment on it, but with one of these using Oracle shouldn't be a problem. I must say I don't really use zope 3 the 'traditionnal' way, and it's a tribute to the zope 3 developpers that I could go my way fairly easily. In my opinion zope's learning curve might be steaper than other frameworks', but the its well worth the initial pain, due to the sheer power of zope and the ease of extensions through the use of components. Once the core concepts are mastered, zope is easy to use and, in my opinion powerful and versatile. As I said, I'm no expert, but I hope that helps. Stéphane - Message d'origine De : Robert Hicks [EMAIL PROTECTED] À : zope3-users@zope.org Envoyé le : Lundi, 28 Août 2006, 3h32mn 56s Objet : [Zope3-Users] Why Zope3 I am looking into the Python arena for some in-house web work. I see Turbogears, Django and Zope3 mentioned the most. I am interested in knowing what Zope3 brings to the table and how well it plays with Oracle (9i). Any thoughts would be greatly appreciated. :Robert ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Re: Why Zope3
Philipp von Weitershausen wrote: Behrang Dadsetan wrote: Hi Philipp, Your reply made me discover the fact that http://svn.zope.org contains so many third-party packages. Is there any page that gives a minimal description to each of these packages? Like an overview maybe even in the same format than http://svn.zope.org http://svn.zope.org/ but instead of the last comment checked-in, a two-liner describing the package? Unfortunately not, but there are plans to build such a site. For now, perhaps [1] can give you more pointers. Zope 3 has a really good culture of low-level documentation, too. Each of these packages has a README.txt or similar .txt file that is a working (hopefully) DocTest and background documentation on how it is to be used. To see the big picture of Zope 3, though, look at Philipp's website http://worldcookery.com, which has a few Appetizers to get you going. I can highly recommend his book as well. Martin ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Re: Performance
David Johnson wrote: Okay. I think I figured it out. It seems that images and large objects are the main culprit. We have very few images, mainly just icons for the content types and tabs. I discovered this by using lynx and with IE disabling images. So the new question is: how do I speed up image downloading? I'm guessing this has something to do with the ZODB? Only if your images are in the ZODB... ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Re: how to know if a principal has the right permissions
Lorenzo Gil Sanchez wrote: El dom, 27-08-2006 a las 23:53 +0200, Philipp von Weitershausen escribió: zope.security.canAccess zope.security.canWrite Nice, I didn't know about those and I ended writing my own solution: def canAdd(self): interaction = ZopeSecurityPolicy() interaction.add(Participation(self.request.principal)) Ack. Just get the current interaction with zope.security.management.getInteraction(). With this code you're hard-wiring yourself to the security policy in zope.app.securitypolicy. return interaction.checkPermission(zope.ManageContent, self.context) I'm trying to know if the user can add an item to a container. I don't know how to do that with zope.security.canWrite. I tried with zope.security.canWrite(self.context, '__data') since my container inherits from SampleContainer and the '__data' attribute is a dictionariy like objet where the children are stored. I get a ForbiddenAttribute exception with that code. Right. Because you're not supposed to poke at __data. The two underscores should scare you off! By the way, this is a rule of thumb: Whenever you get ForbiddenAttribute errors, you're doing something wrong. Either: 1. you're missing security declarations 2. you're accessing something that purposely has no security declarations because you're not supposed to access it. Most of the times when newbies hit ForbiddenAttribute, it's #1. In your case it's #2. If you would take advantage of interfaces and look at IContainer, you would see that contianers are like mappings (=dictionaries). Therefore, in order to add something in the container, you need to be able to access the __setitem__ method. Check for that and you'll be all set. Philipp ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Re: how to know if a principal has the right permissions
Lorenzo Gil Sanchez wrote: Right. Because you're not supposed to poke at __data. The two underscores should scare you off! By the way, this is a rule of thumb: Whenever you get ForbiddenAttribute errors, you're doing something wrong. Either: 1. you're missing security declarations 2. you're accessing something that purposely has no security declarations because you're not supposed to access it. Most of the times when newbies hit ForbiddenAttribute, it's #1. In your case it's #2. If you would take advantage of interfaces and look at IContainer, you would see that contianers are like mappings (=dictionaries). Therefore, in order to add something in the container, you need to be able to access the __setitem__ method. Check for that and you'll be all set. Sorry, my fault: I forgot to mention that I *did try* zope.security.canWrite(obj, '__setitem__') before and it always returns False, no matter if I try with the right user. Why canWrite? You're not trying to *set* __setitem__! You should be checking for canAccess(container, '__setitem__'). People who want to add stuff to a container want to *call* container.__setitem__(...). I suggest you read up on the Python mapping API. That's why I started to poke with '__data' which I know was going to be a hack. By the way, by your rule of thumb I should not play with '__setitem__' neiter (e.g. it has four underscores). You did not understand my rule of thumb. Read the rule of thumb again and check whether it contains any mentionings of underscores. It doesn't. It's about ForbiddenAttribute errors, not underscores. And if you'd know your Python, you'd know __setitem__ is a standard mapping API method. Philipp ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Re: how to know if a principal has the right permissions
El lun, 28-08-2006 a las 20:49 +0200, Philipp von Weitershausen escribió: Lorenzo Gil Sanchez wrote: Right. Because you're not supposed to poke at __data. The two underscores should scare you off! By the way, this is a rule of thumb: Whenever you get ForbiddenAttribute errors, you're doing something wrong. Either: 1. you're missing security declarations 2. you're accessing something that purposely has no security declarations because you're not supposed to access it. Most of the times when newbies hit ForbiddenAttribute, it's #1. In your case it's #2. If you would take advantage of interfaces and look at IContainer, you would see that contianers are like mappings (=dictionaries). Therefore, in order to add something in the container, you need to be able to access the __setitem__ method. Check for that and you'll be all set. Sorry, my fault: I forgot to mention that I *did try* zope.security.canWrite(obj, '__setitem__') before and it always returns False, no matter if I try with the right user. Why canWrite? You're not trying to *set* __setitem__! You should be checking for canAccess(container, '__setitem__'). People who want to add stuff to a container want to *call* container.__setitem__(...). I suggest you read up on the Python mapping API. Oh! that was a stupid error indeed :( Using canAccess now just does the opposite: it always returns True. I guess that's because when I register my container in the ZCML file I'm using zope.Public for the whole interface. I should split my interface in two interfaces, one for read-only attributes and one for write attributes, like the IContainer does. So instead of inheriting my INewsFolder interface from IContainer I inherit from IReadContainer and I explicit say in the configure.zcml that it also implements IWriteContainer. That way I can specify different permission for read and write attributes. Thanks a lot for your answers Philipp Lorenzo ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Re: how to know if a principal has the right permissions
Lorenzo Gil Sanchez wrote: El lun, 28-08-2006 a las 20:49 +0200, Philipp von Weitershausen escribió: Lorenzo Gil Sanchez wrote: Right. Because you're not supposed to poke at __data. The two underscores should scare you off! By the way, this is a rule of thumb: Whenever you get ForbiddenAttribute errors, you're doing something wrong. Either: 1. you're missing security declarations 2. you're accessing something that purposely has no security declarations because you're not supposed to access it. Most of the times when newbies hit ForbiddenAttribute, it's #1. In your case it's #2. If you would take advantage of interfaces and look at IContainer, you would see that contianers are like mappings (=dictionaries). Therefore, in order to add something in the container, you need to be able to access the __setitem__ method. Check for that and you'll be all set. Sorry, my fault: I forgot to mention that I *did try* zope.security.canWrite(obj, '__setitem__') before and it always returns False, no matter if I try with the right user. Why canWrite? You're not trying to *set* __setitem__! You should be checking for canAccess(container, '__setitem__'). People who want to add stuff to a container want to *call* container.__setitem__(...). I suggest you read up on the Python mapping API. Oh! that was a stupid error indeed :( Using canAccess now just does the opposite: it always returns True. I guess that's because when I register my container in the ZCML file I'm using zope.Public for the whole interface. I should split my interface in two interfaces, one for read-only attributes and one for write attributes, like the IContainer does. So instead of inheriting my INewsFolder interface from IContainer I inherit from IReadContainer and I explicit say in the configure.zcml that it also implements IWriteContainer. That way I can specify different permission for read and write attributes. Or, you leave INewsFolder as it is and only use IReadContainer and IWriteContainer in the ZCML declarations. That's what I would do. If you have my book, check the Containers chapter, it's done like this there. Philipp ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Re: Performance
David Johnson wrote: Okay. I think I figured it out. It seems that images and large objects are the main culprit. We have very few images, mainly just icons for the content types and tabs. I discovered this by using lynx and with IE disabling images. So the new question is: how do I speed up image downloading? I'm guessing this has something to do with the ZODB? Hi David, Here's some 'benchmarks' for you to compare against. I accessed images both as resources and content objects. Though there was some difference b/w them it wasn't by any order of magnitude I used a recent Zope3 version from svn.zope.org. From the results it looks like data bandwidth may be a factor to consider. Also my benchmark client is written in python using twisted and it also adds it's own (significant) overhead. I also ran some tests against Zope instances and ZEO (results not included), which didn't turn up any weird result. object=neptune.jpg size=3.39MB 1/ Accessed as resource, content is served from the file system.. Requests:20 Errors: 0 Async level: 8 kBytes rcvd: 71097.0 Total time: 4.08 sec Req rate:4.9 req/sec Data rate: 17416.7 kB/sec Get ave: 0.204 sec #Req #Err Get(ave) (min) (max)kB/s URL 20 0 1.458 0.855 1.695 2438.4 http://localhost:8082/@@/neptune.jpg 2/ Accessed as a Image content (ZODB) object with a Zope/ZODB instance.. Requests:20 Errors: 0 Async level: 8 kBytes rcvd: 71097.0 Total time: 4.09 sec Req rate:4.9 req/sec Data rate: 17397.5 kB/sec Get ave: 0.204 sec #Req #Err Get(ave) (min) (max)kB/s URL 20 0 1.462 0.867 1.685 2431.2 http://localhost:8082/content/neptune.jpg object=sts.jpg size=371kB 3/ Smaller image accessed as resource object Requests:100 Errors: 0 Async level: 8 kBytes rcvd: 37996.2 Total time: 1.08 sec Req rate:92.8 req/sec Data rate: 35274.5 kB/sec Get ave: 0.011 sec #Req #Err Get(ave) (min) (max)kB/s URL 100 0 0.085 0.035 0.109 4456.0 http://localhost:8082/@@/sts.jpg 4/ Smaller image accessed as content object Requests:100 Errors: 0 Async level: 8 kBytes rcvd: 37996.2 Total time: 1.41 sec Req rate:70.7 req/sec Data rate: 26870.1 kB/sec Get ave: 0.014 sec #Req #Err Get(ave) (min) (max)kB/s URL 100 0 0.112 0.042 0.156 3381.7 http://localhost:8082/content/sts.jpg ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users