Menu
  • HOME
  • TAGS

Can zope.publisher.browser.BrowserView be used in Plone?

Tag: plone,zope,zope3

Given that Products.Five is an integration layer to make the Zope Component Architecture (ZCA) usable in Plone:

  • Is it possible to use zope.publisher.browser in Plone or do I have to use Products.Five.browser to import BrowserView?

The former produces a traceback:

2015-06-04 14:47:02 ERROR Zope.SiteErrorLog 1433443622.720.549321919726 http://localhost:8080/Plone/@@hello Traceback (innermost last): Module ZPublisher.Publish, line 138, in publish Module ZPublisher.mapply, line 77, in mapply Module ZPublisher.Publish, line 48, in call_object Module zope.publisher.browser, line 968, in __call__ NotImplementedError: Subclasses should override __call__ to provide a response body

Whereas the latter "just works"

Best How To :

You need to use Products.Five.browser.BrowserView because it is in charge of plugging the view in Acquisition, hence (among others) in Zope 2 security infrastructure.

It inherits from AcquisitionBBB.

Zope 2 security relies on acquisition to configure permissions only at root of content trees.

How to transfer a structure from one Plone to another

plone,data-migration,plone-4.x

I found out that each time that I make this type of migration by hand, I make mistakes that force me to do it again. OTOH, if migration is automated, I can run it, find out what I did wrong, fix the migration, and do it all over again until...

Does Reinstalling a product run all the upgrade steps in Generic Setup?

plone,genericsetup

No A reinstall of a package runs the uninstall profile an then the default profile. [START UPDATE] As @hvelarde commented: It does not automatically run a uninstall profile. It could do nothing or do the uninstallation in a different way. But usually if there is a profile the profile is...

Can I use plone.protect 3.0 with Plone 4.3?

forms,security,plone,csrf,plone-4.x

I have only a little experience with it and played around with plone.protect 3.x and Plone 4.3.2, but nothing serious. I had also a lot of addons installed, so I cannot say if there were problems with Plone itself, or an addon. Here are my notes: Yes you can enable...

Custom dimension in collective.googleanalytics report

python,google-analytics,plone,google-analytics-api,plone-4.x

Solved updating collective.googleanalytics config.py to support custom dimensions. DIMENSIONS_CHOICES = ( ... "ga:dimension1", "ga:dimension2", "ga:dimension3", "ga:dimension4", "ga:dimension5", ...

Sqlalchemy, zope transactions and .user attribute

python,mysql,sqlalchemy,zope,zodb

The attribute is currently only used by the ZODB; the SQLAlchemy integration ignores that information. You could use it still but you'd have to extend the zope.sqlalchemy session data manager to do something with that information. You could add additional rows to your database based on the note and user,...

Usage of ZODB temporary storage

plone,zope,zodb

By default the recipe includes a temporary storage service to store session data: Temporary Folders are Zope folders that are used for storing objects temporarily. Temporary Folders acts almost exactly like a regular Folder with two significant differences: Everything contained in a Temporary Folder disappears when you restart Zope. (A...

Ploneboard conflict with AccessControl?

plone,zope

Since version 3.6 PloneBoard requires AccessControl>=3.0. The Problem in your case is, that Plone 4.2.x has an older version pinned: Check: http://dist.plone.org/release/4.2-latest/ If you run ./bin/buildout annotate | grep -C 5 AccessControl. You will see which buildout configuration pins the version of AccessControl. ... [versions] AccessControl= 2.13.13 http://dist.plone.org/release/4.2-latest/versions.cfg ... In...

How to hide a fieldset (tab) in Plone add/edit form

plone,fieldset,dexterity,z3c.form

Since the fields are still rendered in hidden mode, the fieldset still exists. If you want to completely omit the fieldset you need to omit all fields in the fieldset. This can be achieved using the omitted directive form.omitted. form.fieldset( 'transitionsLog', label=_(u"Transitions Log"), fields=['t_log'] ) form.omitted('t_log') # This will also...

Does Plone 4.1 use KSS? Can I disabled JS and CSS files associated with KSS safely?

plone,plone-4.x,kss

You can disable them. You'll lose some progressive enhancement features (ability to drag files to reorder on the Contents tab, for example), but the site should still be usable. Or you can upgrade to Plone 4.3, which no longer uses KSS....

What is the way to know a Zope permission title by knowing its id (and vice-versa)?

permissions,plone,zope,zope3

Permissions are registered as zope.security.interfaces.IPermission utilities by their id; you can thus look them up by their ids by using zope.component.getUtility(): from zope.component import getUtility from zope.security.interfaces import IPermission permission = getUtility(IPermission, name=u'choosen.id.for.your.permission') print permission.title To go the other way, from title to id, you need to search all utilities:...

Dynamically change dropdown options for one field, after setting another field in a dexterity form.Schema

python,sql,forms,plone,dexterity

You can do this with plone.formwidget.masterselect Like this (untested, but gives you an idear of how it works): from zope import schema from plone.supermodel import model from plone.formwidget.masterselect import _ from plone.formwidget.masterselect import MasterSelectBoolField from plone.formwidget.masterselect import MasterSelectField def getTownshipDynVocab(master): CountryID = master_value # search for your township entries by...

How to declare a subscriber that will be enable for only one plone site?

plone

In plone you have the concept of Browserlayer. Since you can install a browserlayer thru generic setup, you can activate/deactivate it per plone site. I would implement a condition in the subscriber, which checks for a installed browserlayer. Note: Browserlayers are applied on the REQUEST with a before traverse hook....

How to register a browser layer programmatically

plone,genericsetup

Here you go: >>> from plone.browserlayer.tests.interfaces import IMyProductLayer >>> from plone.browserlayer import utils >>> IMyProductLayer in utils.registered_layers() False >>> utils.register_layer(IMyProductLayer, name='my.product') >>> IMyProductLayer in utils.registered_layers() True Copied from https://github.com/plone/plone.browserlayer/blob/master/plone/browserlayer/README.rst If you just want to have a browser layer present in a test request, you can use the ZCA and directly...

Obtaining the “default” mockup TinyMCE configuration on Plone 5

tinymce,plone,plone-5.x

I think what you're asking for is to do something like this... First, get the default tinymce pattern configuration: from zope.component import getMultiAdapter import json pattern_options = getMultiAdapter( (context, request, None), name="plone_settings").tinymce()['data-pat-tinymce'] tiny_options = json.loads(pattern_options) Then, manipulate the tiny_options dictionary and customize to your needs and provide it to your...

I'd like to add a table style, like the ones that appear in the tinyMCE style combo box, not the table properties box

tinymce,plone

You can add one new row in the Styles section. For example: Special Row|tr|MySpecialCSSKlass Of course you have to style MySpecialCSSKlass by your own. You have to reset the JS cache before this change take effect. It's also necessary to place the curser inside of table row/cell. ...

How to change portlet order (put parent portlets first)

plone

There are two solutions I'm aware of collective.weightedportlets Solgema.PortletsManager collective.weightedportlets You can define a weight for each portlet, no matter in which section/group the portlet is (user, context, type, inherited). Version 1.1 is Plone 4.3 compatible. Solgema.PortletsManager Basically does a similar thing like collective.weightedportlets, but it can be done by...

How do I override the main template in Plone 3?

plone,zope,plone-3.x

You need to make sure, that the my_theme_custom_templates folder is loaded before the plone_templates folder. Go to http://localhost:8080/PLONE/portal_skins/manage_propertiesForm and check if your my_theme_custom_templates is on the second place in your active skin ("Skin selections"). Usually custom is on the first place, than you need to make sure your skin folders...

Plone 4 : How to customize a method in Archetypes content types?

adapter,plone,archetypes,plone-4.x

The solution you need depends on what you want to achieve. But archetypes.schemaextender is the wrong solution. schemaextender is there to modify the schema, this includes: fields order field/widget attributes schemata setter/getter of a field new fields override fields To implement your own adaptera is definitely the right approach. First...

Where is the main space used up in Plone file upload?

plone,zodb,plone-4.x

With collective.documentviewer, space is nearly doubled(or more) for every PDF. In order for collective.documentviewer to do what it does, it converts each document into a series of images which are stored in addition to the original PDF. It creates 2 sets of these--one smaller size and one larger. It does...

LookupError on form render if RelationChoice field in custom Dexterity type is not required

plone,dexterity

Yes its a bug (Plone 4.3.3): dev.plone.org/ticket/14027 and github.com/zopefoundation/z3c.form/issues/17 - Pin down z3c.form to 3.0.5 in your buildout configuration (This workaround works for me): [versions] z3c.form = 3.0.5 ...

Javascript form processing issue in Plone

javascript,plone,plone-4.x

I am guessing your onsubmit is getting overridden and never gets run. There is more than just TinyMCE that uses onsubmit. Moreover, you should NOT have to disable tinymce anyways. TinyMCE should only affect pages where the editor is loaded on. Couple things. First, verify your JS isn't getting run....

Plone - Syntax Error when doing hello world tutorial

syntax-error,plone

It seems your bootstrap.py is outdated and tries to access a URL that does not exist any longer. You can update your bootstrap like this: $ rm bootstrap.py $ wget http://downloads.buildout.org/1/bootstrap.py $ python2.7 bootstrap.py $ bin/buildout ...

Error while starting Plone instance

osx,python-2.7,plone

You are using WeasyPrint, and that project requires Cairo to be installed. You'll need to install that missing dependency. You can probably get it via Homebrew, I see there is a formula available at any rate....

How to set Plone to redirect to came_from after logout

python,plone,plone-4.x

A simple way: customize logged_out, transform it to a Python Script that redirect to whatever page you want: context.REQUEST.RESPONSE.redirect(url) ...

full text searching for various external formats plone 4.2

plone

I've never installed ftw.tika on Windows, but if you manage to setup the service and it's up and running it should work. To use ftw.tikayou need to install the ftw.tika package on your Plone Site by following the instructions in the README. This means you need to install the egg...

Create copy of plone installed onto another server with data

python,linux,plone

You are right that you also need to transfer files and images. They are stored as BLOBs on the file system. I guess that you will find a directory named blobstorage, close to the filestorage directory where you found Data.fs. You need to transfer this blobstorage directory and all its...

What's the buildout:zcml option for?

plone,buildout,zcml

There is no inherent functionality related to the zcml parameter in the [buildout] section, other than a convenient place to define zcml. Typically an [instance] section will refer to it: [instance] recipe = plone.recipe.zope2instance eggs = Plone zcml = ${buildout:zcml} The use of buildout:zcml similar to buildout:eggs is an anti-pattern,...

How to restore Plone 3?

plone,plone-3.x

Was your previous Plone 3.x version 3.2 or later? If so, both old and new use buildout for configuration management. If so, the general plan is: 1) Copy the eggs, develop, zcml and versions directives from old to new. Copy the src and products directory from old to new. 2)...

“TypeError: make_staticdir() got an unexpected keyword argument 'document_root'” running Diazo through Proxy

python,plone,diazo

It turns out that this error is caused by a mistake in the proxy.ini file due to which a suppressed error is thrown in the webobentrypoints library. To correct this, please change the third section of proxy.ini entitled "app:static" to use "path" instead of the incorrect "document_root" such that it...

Dealing with the error: A different document with value xxxx already exists in the index

plone

I had the same error today. In short: the UID index in portal_catalog (ZCatalog UUIDIndex) complains that you are trying to index multiple objects with the same UID In my case it was caused by a zexp import of a folder that contained images that where already available in another...

Plone Archetypes redirection after creation

python,redirect,plone,archetypes

Your *.metadata file might be missing or have an action that routes to a different location than you expect: http://docs.plone.org/old-reference-manuals/forms/using_cmfformcontroller.html The default metadata for content_edit lives in Products/Archetypes/skins/archetypes/content_edit.cpy.metadata: ... [actions] action.success = traverse_to:string:validate_integrity action.success_add_reference = redirect_to:python:object.REQUEST['last_referer'] action.failure = traverse_to_action:string:edit action.next_schemata =...

Migrate Plone users and groups to relational data

plone,plone-4.x

imho it's based on what you want to achieve. In Plone you have PAS, so technically it doesn't really matter, where you put users, groups and user group relationships. You can store users/groups in: Plone (by default) SQL - pas.plugins.sqlalchemy LDAP/AD - Products.PloneLDAP There are also many other plugins for...

Multiple contact forms in a Plone website

python,plone,plone-4.x

Simplest way (no need of developing anything) is to install PloneFormGen and create a custom contact-info form with a mailer adapter. Seems that new-way-dexterity-based collective.easyform also provides same features (but never tested)....

How to change the content of viewport property of meta tag in Plone 4.1?

plone,plone-4.x

I assume your are using a Theme based on plonetheme.sunburst. Unfortunately your part ist hard coded directly in the main_template.pt Which means the only way to change this, is to customise the main_template.pt. You an either to this thru the ZMI... portal_skins -> sunburst_templates -> main_template.pt -> Click "Customize" button...

How to conditionally require a field based on a selection in a form?

forms,plone,z3c.form

It is possible! What you need is called an "invariant validator". Have a look to: http://docs.plone.org/develop/addons/schema-driven-forms/customising-form-behaviour/validation.html#invariants http://docs.plone.org/develop/addons/schema-driven-forms/customising-form-behaviour/validation.html#invariantsr ...

Plone/IRelatedItems- How can I programatically set relatedItems of a dexterity content type?

python,plone

You need to store a list of RelationValues. >>> from zope.component import getUtility >>> from zope.intid.interfaces import IIntIds >>> from z3c.relationfield import RelationValue >>> intids = getUtility(IIntIds) >>> source.relatedItems = [RelationValue(self.intids.getId(target))] >>> source.relatedItems [<z3c.relationfield.relation.RelationValue object at 0x10bf2eed8>] You can now access the target by... >>> target_ref = source.relatedItems[0] >>>...

Can zope.publisher.browser.BrowserView be used in Plone?

plone,zope,zope3

You need to use Products.Five.browser.BrowserView because it is in charge of plugging the view in Acquisition, hence (among others) in Zope 2 security infrastructure. It inherits from AcquisitionBBB. Zope 2 security relies on acquisition to configure permissions only at root of content trees....

Upgrade step to remove profile

plone,upgrade,genericsetup

You need to add to the product an uninstall profile (and commonly is a good idea to add it to the original product, through a pull request). An uninstall profile must remove all the persistent changes done by the install ones, so look at it: https://github.com/collective/collective.js.cycle2/tree/master/src/collective/js/cycle2/profiles/default The only "dangerous" thing...

When not using UnifiedInstaller, why is sys.path not populated?

plone,buildout

I'm pretty sure bin/buildout always contained only a couple entries. It'd be bin/instance or bin/client that would historically contain the list of eggs. bin/buildout is only used for generating the environment, so it doesn't need all the python packages included in the path there. bin/clients or bin/instance should set sys.path....

How can I run archetypes.querywidget test suite locally?

testing,plone

Yes. Please use buildout.coredev for all core packages. See our docs for more details: https://buildoutcoredev.readthedocs.org/en/latest/intro.html Short version: git clone -b 4.3 https://github.com/plone/buildout.coredev.git cd buildout.coredev python bootstrap.py bin/buildout bin/test -s archetypes.querywidget If you want a specific version, you can either amend sources.cfg (make sure you don't commit), or just go to...

Why is my MultiAdapter failing to register?

python,zope,zope.component

You should not pass in the adapter you want to look up to component.getMultiAdapter(). The second argument to that function is the name used for named adapters, but your registration did not use a name. Simply remove that second argument: >>> component.getMultiAdapter((AddOne(), MulTwo())) <__main__.MWriter object at 0x1072516d0> Unfortunately, calling MWriter()...

Mobile app marker for Plone / Diazo

android,ios,iphone,plone,diazo

Have you seen zettwerk.mobiletheming? It allows you to define a different theme for a different url - so you can provide two (diazo) themes for one page. There is also an example (jquery.mobile based) theme which you can try: zettwerk.mobile. Also check the provided screencasts to see it in action....

In Plone, how do I fix Archetypes content that is missing the cmf_uid() annotation?

plone

Here is a script that searches the portal (passed as context) for any Document that has a non-unique cmf_uid. Many of these documents actually have no cmf_uid but the indexed cmf_uid actually comes from the parent folder via Acquisition. Since the manifestation of the problem was that plone.app.iterate was unable...

Redirecting Site Root URL to its Language Root Folder

plone

It's like Ulrich mentioned, you can define the language-switcher View as default view on the plone root. This automatically redirects you to the desired language folder. More Infos: https://github.com/plone/plone.app.multilingual/blob/2.x/src/plone/app/multilingual/browser/switcher.py If you setup the a multilingual site, the default page of the plone root should be configured correctly: Check LanguageSetup: https://github.com/plone/plone.app.multilingual/blob/2.x/src/plone/app/multilingual/browser/setup.py#L245...

Plone- In a dexterity.EditForm why is attempting to disable a widget causing a ConstraintNotSatisfied error?

plone,dexterity

You might have better luck using the mode property. Try something like this: from z3c.form.interfaces import HIDDEN_MODE def updateWidgets(self): super(Edit, self).updateWidgets() self.widgets['restaurant_code'].mode = HIDDEN_MODE ...