zope

Zope: cannot access REQUEST under property decorator

一世执手 提交于 2019-12-19 03:14:09
问题 I'm trying to use the property decorator in a Class. While it works well per se, I can't use any code that has to access the REQUEST . class SomeClass(): #Zope magic code _properties=({'id':'someValue', 'type':'ustring', 'mode':'r'},) def get_someValue(self): return self.REQUEST @property def someValue(self): return self.REQUEST Although calling get_someValue gets me the desired result, trying to access someValue raises an AttributeError . What's the logic behind this behaviour? Is there a

create an instance of one class from another class

不羁的心 提交于 2019-12-13 23:12:27
问题 I created browserView class named as "bdrMenuView" . It should be like "class bdrMenuView(BrowserView):" . and the class contains the method named as "createPictMenu" . The whole class should be class bdrMenuView(BrowserView): def createPictMenu(self): Now i have written one more class named as LogoViewlet . It should be like "class LogoViewlet(ViewletBase):" . and the class contains the method named as "update" . The whole class should be class LogoViewlet(ViewletBase): def update(self): Now

dynamicly fill table using zpt and ajax as update

谁说我不能喝 提交于 2019-12-13 19:17:12
问题 I'm creating a webproject in pyramid where I'd like to update a table every few secondes. I already decided to use ajax, but I'm stuck on something. On the client side I'm using the following code: function update() { var variable = 'variable '; $.ajax({ type: "POST", url: "/diagnose_voorstel_get_data/${DosierID}", dataType: "text", data: variable , success: function (msg) { alert(JSON.stringify(msg)); }, error: function(){ alert(msg + 'error'); } }); } Pyramid side: @view_config(route_name=

Zope 2: How to properly “browser:page” to make a page available everywhere?

耗尽温柔 提交于 2019-12-13 02:57:27
问题 Let's assume I have a sample application with following classes: ## ## impelementation/SampleApp.py ## class SampleApp: # inherits from required classes """ """ implements(ISampleApp) # ... index_html = PageTemplateFile('templates/index.pt') ## ## implementation/SampleAppUser.py ## class SampleAppUser: # inherits from required classes """ """ implements(ISampleAppUser) # ... index_html = PageTemplateFile('templates/user_index.pt') manage_addSampleAppUserForm = PageTemplateFile('manage

Custom font doesn't work in IE8 in Zope/Plone

☆樱花仙子☆ 提交于 2019-12-12 15:14:23
问题 I'm making a Web Portal using Zope/Plone4 CMS. Well, I used @font-face to declare the typography for headings. The code and font are from Font-squirrel. I made the website in local machine (without install the font in my PC) and everything works fine. But in Plone, IE8 doesn't render the font at all. ONLY IE8, when IE7 and IE9 renders perfectly (?) I made a test using Google Fonts. Everything works fine, all browsers. I think it's possible that the error come from read/write permissions or

Zope.Schema/Plone - How can I set the value of a Datetime field in an updateWidget function?

本小妞迷上赌 提交于 2019-12-12 09:58:19
问题 On a plone site I am working on, I have a form that is used to edit records of objects stored mapped to a table in the backend database. In the interface class, one of the fields is a schema.Datetime field. class ICalibration(Interface): """Interface class for calibration records """ ... Last_Calibration = schema.Datetime(title=u"Last Calibration" description=u"date of last calibration", ) ... In my updateWidgets function, in the edit form, I try to set the value of the widget, class

Python: Obtain a URL

你离开我真会死。 提交于 2019-12-12 04:28:42
问题 Because I cant get this working: Python: KeyError with form.getfirst I have an alternative option, I have a function in DTML which needs to obtain a URL: For example if the dtml webpage is located at www.blah.com/foo/foo2?variable=55 How would i obtain the URL of this page using a python function? The function is called by: <dtml-var test> The syntax for "test" is rite, the Zope documentation says so. 回答1: for: http://www.blah.com/foo/foo2?job_ID=55555&test=1 <dtml-var URL> = http://www.blah

How can I change the URL of an object serverd by Dexterity in Plone

心不动则不痛 提交于 2019-12-12 03:58:58
问题 I defined some content types based on Plone Dexterity, I want any content type has his own ID. So I used the zope.schema.Id . class IArticle(form.Schema, IImageScaleTraversable): """ Article """ form.model("models/article.xml") id = schema.Id( title=_(u"Identifier"), description=_(u"The unique identifier of object."), required=False ) When I create a new article object, it works fine, but when I want to modify the Id of an existed article, It always show me error: {'args': (

Need help installing MySQL for Python

孤者浪人 提交于 2019-12-12 01:17:53
问题 Trying to install MySQL for Python. Two problems: 1) Instructions over the net says installation is python setup.py For me, it results with can't open file 'setup.py': [Errno 2] No such file or directory 2) README.txt says: The Z MySQL database adapter uses the MySQLdb package. This must be installed before you can use the Z MySQL DA. You can find this at: http://sourceforge.net/projects/mysql-python Which simply leads to the package itself, not anything else. Thanks for your help. PS. I'm

Plone 4.2.4 shows incorrect local time/3.5 hours ahead

核能气质少年 提交于 2019-12-11 13:24:20
问题 A fresh plone 4.2.4 install (Unified installer for Linux) writes wrong time for all Plone/Zope events. My timezone is set to Asia/Jerusalem and the time is set to "local PC time". Plone is ahead of it for exactly 3.5 (three and half) hours. How can I fix this, and why this should happen at all? System is OpenSuse 12.2 回答1: Python can only give Zope the timezone as a three-letter abbreviation. For Asia/Jerusalem that is IST. Unfortunately, that same abbreviation is also used for India Standard