zope

Best way to count page view in Plone

落爺英雄遲暮 提交于 2019-12-01 05:12:59
问题 I'm working in a case require fairy complex use of page views. Each content object will have page view, and this should be accessed easily so that we can do various things related to it (sorted on catalog result, display, calculate popular metter ...). The closest equivalent is the youtube video's view. I'm thinking of some possible ways to implemented this: Use annotation storage & indexer to create portal_catalog index & metadata. Use indexer only (either use volatile attribute or update

Get stacktrace from stuck python process

為{幸葍}努か 提交于 2019-11-30 15:37:15
问题 I have to run a legacy Zope2 website and have some grievance with it. The biggest issue is that, occasionally, it just locks up, running at 100% CPU load and not answering to requests anymore. While the problem isn't reproducible on a regular basis, one page containing 3 dynamic graphs triggers it sometimes, so I suspect some kind of race condition that leads to an endless loop or a stuck busywait. The problem is, I have not yet found a way to debug this thing. There's nothing in the Zope

Backing up (and restoring) a Plone instance

寵の児 提交于 2019-11-29 16:27:45
I have a Plone installation in my home directory under Linux. ~/Plone . This was made from a default distribution of Plone from its website. So Plone compiled own python and is bundeled with Zope. Please tell me, which files are necessary to backup if I want to: 1) Backup the whole data ever stored in my Plone instance; 2a) Restore the backed-up data in a same version of Plone, but located elsewhere. 2b) Restore the backed-up data in a (slightly) newer version of Plone. I thought, maybe it's a good idea to just backup the whole ~/Plone/zinstance directory, but I found thousands of occurrences

How to set the sharing rights of a folder in Plone?

落花浮王杯 提交于 2019-11-29 15:48:18
I want to set sharing rights of many folders by using a Python script in a Plone site. You need to look at the AccessControl/rolemanager.py module for details; the sharing tab in Plone is a friendly wrapper around that API. To add roles for a given userid, call manage_addLocalRoles : context.manage_addLocalRoles('userid', ('Role1', 'Role2',)) The other two important methods are manage_setLocalRoles(userid, roles) (replace the current set of roles completely) and manage_delLocalRoles(userid) (delete all roles). get_local_roles_for_userid(userid) could be handy too, to see what local roles are

How do you get and set cookies in Zope and Plone?

不问归期 提交于 2019-11-29 12:17:01
问题 Documentation, and more importantly, some code examples would be very useful. I would prefer this to not be in protected scripts, but in the code that goes into modern packages. 回答1: Use the response.setCookie() method. You can reach the response object via the request object. The latter you can reach via acquisition ( self.REQUEST ), or in views by accessing the passed-in request object, usually via self.request : self.request.response.setCookie(name, value, **options) where options end up

Sql Alchemy QueuePool limit overflow

左心房为你撑大大i 提交于 2019-11-29 11:25:08
问题 I have a Sql Alchemy application that is returning TimeOut: TimeoutError: QueuePool limit of size 5 overflow 10 reached, connection timed out, timeout 30 I read in a different post that this happens when I don't close the session but I don't know if this applies to my code: I connect to the database in the init.py: from .dbmodels import ( DBSession, Base, engine = create_engine("mysql://" + loadConfigVar("user") + ":" + loadConfigVar("password") + "@" + loadConfigVar("host") + "/" +

What is the difference between the various ZODB blobstorage layouts?

非 Y 不嫁゛ 提交于 2019-11-29 11:01:50
The ZODB blobstorage directory contains a .layout file with the string 'lawn', 'bushy'. What is the difference between the various blob storage directory formats? It is explained here: http://svn.zope.org/ZODB/trunk/src/ZODB/tests/blob_layout.txt?rev=101802&view=markup FTA: ====================== Blob directory layouts The internal structure of the blob directories is governed by so called layouts . The current default layout is called bushy . The original blob implementation used a layout that we now call lawn and which is still available for backwards compatibility. Layouts implement two

How does the function that is called inside the class declaration?

会有一股神秘感。 提交于 2019-11-28 05:25:31
问题 Have this code: >>> class Foo: ... zope.interface.implements(IFoo) ... ... def __init__(self, x=None): ... self.x = x ... ... def bar(self, q, r=None): ... return q, r, self.x ... ... def __repr__(self): ... return "Foo(%s)" % self.x Obviously, the call of zope.interface.implements in some way alters the properties and behavior of the class Foo . How does this happen? How do I use this approach in my code? Example code is the part of zope.interface module. 回答1: The detailed "what happens" The

What is the difference between the various ZODB blobstorage layouts?

我是研究僧i 提交于 2019-11-28 04:11:41
问题 The ZODB blobstorage directory contains a .layout file with the string 'lawn', 'bushy'. What is the difference between the various blob storage directory formats? 回答1: It is explained here: http://svn.zope.org/ZODB/trunk/src/ZODB/tests/blob_layout.txt?rev=101802&view=markup FTA: ====================== Blob directory layouts The internal structure of the blob directories is governed by so called layouts . The current default layout is called bushy . The original blob implementation used a

What are the valid conditions for zcml:condition?

≡放荡痞女 提交于 2019-11-28 00:40:10
问题 ZCML can include conditional directives of the form <configure zcml:condition="installed some.python.package"> (conditional configuration directives) </configure> What is the expression syntax for condition ? Is 'or' allowed? 回答1: I always have to look this up too. The syntax is very simple, and or is not part of the syntax, I am afraid. As you can see from the documentation in the zope.configuration source code, the syntax is always of the form verb arguments , where verb is one of have ,