Giter Site home page Giter Site logo

plone / plone.app.content Goto Github PK

View Code? Open in Web Editor NEW
7.0 157.0 32.0 1.74 MB

Various views for Plone, such as folder_contents, as well as general content infrastructure, such as base classes and name choosers.

Home Page: https://pypi.org/project/plone.app.content/

Python 100.00%

plone.app.content's Introduction

plone.app.content's People

Contributors

ale-rt avatar cah190 avatar csenger avatar davisagli avatar do3cc avatar erral avatar esteele avatar frapell avatar fulv avatar gagaro avatar gforcada avatar hannosch avatar jensens avatar limi avatar lrowe avatar mauritsvanrees avatar optilude avatar pbauer avatar petschki avatar pre-commit-ci[bot] avatar reinhardt avatar rpatterson avatar thet avatar tisto avatar tomgross avatar vangheem avatar vincentfretin avatar vloothuis avatar wichert avatar witsch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

plone.app.content's Issues

Update markup of templates to Bootstrap 5

Due to #2967 we have to update the markup of the templates listed below.

Updated:

  • plone.app.content.browser.table.pt
  • plone.app.content.browser.folderfactories.pt
  • plone.app.content.browser.templates.content_status_history.pt
  • plone.app.content.browser.templates.select_default_page.pt
  • plone.app.content.browser.templates.select_default_view.pt

Unknown:

  • plone.app.content.browser.constraintypes.pt
  • plone.app.content.browser.full_review_list.pt
  • plone.app.content.browser.templates.delete_confirmation.pt
  • plone.app.content.browser.templates.object_rename.pt

Feel free to add missing templates here. See also #3061 for further details. Check overrides in plonetheme.tokyo for already existing updated templates.

"Can be used as a default page" option in content-controlpanel

I have a content type that I do not want to be selectable as default page for a folder. I understand the documentation that way that I can uncheck "Can be used as a default page" option in content-controlpanel. But this is not working as expect: My type can still be selected as default page (select_default_page view). I guess that this line is not correct. Can somebody confirm that?

In addition I can add every non-folderish content as default page using folderlistings "Set as default page":
setasdefaultpage

There is no check if content type is allowed as default page in
https://github.com/plone/plone.app.content/blob/master/plone/app/content/browser/contents/defaultpage.py

@@getVocabulary?name=plone.app.vocabularies.Catalog&query= cannot be called in the context of a Folder

If you call that view on a folder, you will enter here:

because of the or not INavigationRoot.providedBy(context).

Given that field_name is None, you will directly jump here:

without evaluating the proper permission on the context.

This is really tedious when you want to publish a folder as the homepage of a site: the folder contents view will not work (even if you manually add INavigationRoot through manage_interfaces).

folder_contents filter should not use SearchableText, but Title

When using the filter query in folder_contents, right now it will use the "SearchableText" index, which is not very intuitive for end users when results don't match what they search for...

Plone already has a site search, which uses the SearchableText, so I think it would be better if the filter from the folder_contents would limit the search to only the item Title by default.

TUS without sticky sessions

User problem

For a devop to enable TUS and resumable uploads with plone you need to know how to enable sticky sessions (via haproxy or nginx) or use a distributed file system so the tmp dir tus uses is shared.
There are a few problems with this

  1. Sticky sessions has HA and performance implications. What if all the upload load ends up on one server, or that server goes down?
  2. Sticky sessions involves mucking around with loadbalancer configs which might not be easy for the devop

options

  1. Make it possible to use a shared zeo temporary folder for partial uploads which might not have any undo.
  2. Perhaps use plone.app.async which also might not have any history. A task might contain a partial and might keep being delayed until the queue contains the other partials, and then gets processed by reading all the tasks off the queue at once.
  3. Use ZODB directly but accept that it will grow the history by a large amount. Warn about this, but offer it as an option so TUS can be supported out of the box with no reconfiguration.

FileUploadView by mimetype needs further checks

(Plone 5.1.4 release)
The FileUploadView in plone.ap.content.browser.file appears to try to find the content type based on mimetype of the file uploaded. For some extensions, like .txt, this means it will upload it as a Page/Document - but still assign the value to the file attribute. To the end user, it looks like it just creates a blank page.

One could make the argument that this should be handled by that type's factory, but I think my users would expect this to be a File type not a Document type after they upload. Extension/mimetype lookups should only be deciding which File-like content types to use, i.e. File or Image, and never Document.

plone.app.content circular dependency old Zope DateTime

I got an error when i use the folder_listing view of a folder. The Folder contain many Events. This Site was a migrated Instance from an old Plone 4.0.1 Version with AT to Plone 5.0.4 with DX.
I debugged it and find the solution for me. i don't know if this is generally usefull. Here my code:

# -*- coding: utf-8 -*-
# utils.py
import Missing
import datetime
import json
import DateTime

def custom_json_handler(obj):
    if obj == Missing.Value:
        return None
    if type(obj) == DateTime.DateTime:
        return obj.asdatetime().isoformat()
    if type(obj) in (datetime.datetime, datetime.date):
        return obj.isoformat()
    return obj


def json_dumps(data):
    return json.dumps(data, default=custom_json_handler)


# can eventually provide custom handling here if we want
json_loads = json.loads

Use new utils.check_id from CMFPlone

Part of plone/Products.CMFPlone#1801.

  • For Plone 5.1: branch 3.5.x should use Products.CMFPlone.utils.check_id. (We could to a try/except ImportError, but I will add the script in CMFPlone on coredev 5.1 anyway, so should be fine).
  • For Plone 5.2: master branch should use Products.CMFPlone.utils.check_id.

Can't rearrange Folder on ModificationDate

The index don't exist. Available indexes on a Folder are:
Creator
Date
Description
SearchableText
Subject
Title
Type
UID
allowedRolesAndUsers
cmf_uid
commentators
created
effective
effectiveRange
end
expires
getId
getObjPositionInParent
getRawRelatedItems
id
in_reply_to
is_default_page
is_folderish
meta_type
modified
object_provides
path
portal_type
review_state
sortable_title
start
sync_uid
total_comments

so the supposed index 'ModificationDate' is not available

Changing plone/app/content/browser/contents/__init__.py so:
--- __init__.py.ori	2017-12-25 23:19:33.351624000 +0100
+++ __init__.py	2018-01-17 11:56:01.438211350 +0100
@@ -179,7 +179,6 @@
             'in_response_to',
             'listCreators',
             'meta_type',
-            'modified',
             'portal_type',
             'sync_uid'
         ]
@@ -200,7 +199,7 @@
             'is_folderish': translate(_('Folder'), context=self.request),
             'last_comment_date': translate(_('Last comment date'), context=self.request),  # noqa
             'location': translate(_('Location'), context=self.request),
-            'ModificationDate': translate(_('Last modified'), context=self.request),  # noqa
+            'modified': translate(_('Last modified'), context=self.request),  # noqa
             'review_state': translate(_('Review state'), context=self.request),  # noqa
             'start': translate(_('Start Date'), context=self.request),
             'Subject': translate(_('Tags'), context=self.request),
@@ -246,7 +245,6 @@
             'getRawRelatedItems',
             'in_reply_to',
             'meta_type',
-            'modified',
             'object_provides',
             'portal_type',
             'SearchableText',
@@ -264,7 +262,7 @@
             'expires': translate(_('Expiration date'), context=self.request),
             'id': translate(_('ID'), context=self.request),
             'is_folderish': translate(_('Folder'), context=self.request),
-            'ModificationDate': translate(_('Last modified'), context=self.request),  # noqa
+            'modified': translate(_('Last modified'), context=self.request),  # noqa
             'review_state': translate(_('Review state'), context=self.request),
             'sortable_title': translate(_('Title'), context=self.request),
             'start': translate(_('Start Date'), context=self.request),
@@ -341,7 +339,7 @@
         'is_folderish',
         'last_comment_date',
         'location',
-        'ModificationDate',
+        'modified',
         'path',
         'portal_type',
         'review_state',

makes rearranging a folder for 'Last modified' work successfully

Folder contents properties action does not set tzinfo for dates

BUG/PROBLEM REPORT (OR OTHER COMMON ISSUE)

What I did:

  1. Create a document and publish it.
  2. Change publish/effective date editing the document.
  3. Change the same date in the folder_contents properties action button

What I expect to happen:

Step 2 and 3 should set the date the same way

What actually happened:

Step 2 saves the timezone. Step 3 does not.

What version of Plone/ Addons I am using:

Clean installation

Plone 5.1.4 (5114)
CMF 2.2.12
Zope 2.13.27
Python 2.7.14
PIL 5.3.0 (Pillow)

More info:

Starting the client in debug mode:

Step 2 output:

>>> app['filesystem']['site'][document'].effective_date
DateTime('2019/04/30 10:00:00 GMT+2')

Step 3 output

>>> app['filesystem']['site'][document'].effective_date
DateTime('2019/04/29 10:00:00 GMT+0')

Making some testing with DateTime I got this results:

>>> from DateTime import DateTime
>>> from datetime import datetime
>>> # Creating DateTime w/o param sets GMT
>>> DateTime()
DateTime('2019/04/29 10:24:50.212822 GMT+2')
>>> # Creating DateTime with string does not set GMT (I guess we need to pass the GMT as part of the string)
>>> DateTime('2019-04-29 10:00')
DateTime('2019/04/29 10:00:00 GMT+0')
>>> # Creating DateTime with datetime instance sets GMT
>>> DateTime(datetime.strptime('2019-04-29 10:00:00', '%Y-%m-%d %H:%M:%S'))
DateTime('2019/04/29 10:00:00 GMT+2')

So my workaround was this:

# Need to import datetime
if self.effectiveDate and hasattr(obj, 'effective_date'):
    self.effectiveDate = datetime.strptime(self.effectiveDate, '%Y-%m-%d %H:%M')
    obj.effective_date = DateTime(self.effectiveDate)

The same applies to expiration date

TypeError: '<' not supported between instances of 'dict' and 'dict'

I've just been migrating a lot of our Dexterity types from the website to code and stumbled upon this issue. Apparently the cause is this line:

        results = [(translate(ctype['title'], context=request), ctype)
                   for ctype in results]
        results.sort()

The error happens when translating titles of existing types. In my case, I was creating a custom event type called "Termin", the German word for "event". When Plone tries to sort the content types, it translates "event" to "Termin", which causes Plone to attempt to sort the next occurence of the title name, which is the dict.

You can prevent the issue from happening by telling Plone to simply sort by ID instead in case of duplicates.
results.sort(key = lambda x: (x[0], x[1].get('id', '')))

The same error also seems to happen in other parts of Plone, as shown here.

Bulk upload with Archetypes folder

Bulk upload is not working with Archetypes folder, throws, the following adapt error:
Traceback (innermost last): Module ZPublisher.Publish, line 70, in publish Module ZPublisher.mapply, line 77, in mapply Module ZPublisher.Publish, line 48, in call_object Module plone.app.content.browser.file, line 159, in __call__ TypeError: ('Could not adapt', <ATFolder at /plone/contentimages>, <InterfaceClass Products.ATContentTypes.interfaces.factories.IATCTFileFactory>)

This Issue comes from the Plone Community Forum: https://community.plone.org/t/bulk-upload-in-plone-5-with-archetypes-folder/2631

Path shown in item selection widget is stripped based on navigation root path

Why do we cut the path of the item based on the nearest INavigationRoot?

https://github.com/plone/plone.app.content/blob/master/plone/app/content/browser/vocabulary.py#L119

https://github.com/plone/plone.app.content/blob/master/plone/app/content/browser/vocabulary.py#L205

https://github.com/plone/plone.app.content/blob/master/plone/app/content/browser/vocabulary.py#L227

With this the path shown when configuring a collection or a collection portlet, or selecting a content-item through TinyMCE gets cut, and only the part of the path from the navigation root on is shown.

For instance, here, I am configuring a collection portlet in a multilingual site (/en, /es and /eu are navigation root objects).

2017-04-12 09-35-49-ko-pantaila-argazkia

The widgets shows the contents from all navigation roots, but the shown paths are missing the initial /eu, /es, /en.

I patched the get_base_path method to strip only the part regarding the Plone site root's id, and it shows like this:

2017-04-12 09-38-39-ko-pantaila-argazkia

Is the first one an intended behavior? I find it confusing...

Any idea on this? @Gagaro

Circular reference on json dumper in utils.py

I ran into a similar issue as addressed here:

dafc702

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 plone.app.content.browser.vocabulary, line 241, in call
Module plone.app.content.utils, line 43, in json_dumps
Module json, line 250, in dumps
Module json.encoder, line 207, in encode
Module json.encoder, line 270, in iterencode
ValueError: Circular reference detected

In my case, type(obj) is <class 'z3c.relationfield.relation.RelationValue'>

I'm not sure whether the right approach is to add one more exception the the custom json handler. In any case, I got rid of the error by doing this:

from z3c.relationfield.relation import RelationValue

    if type(obj) == RelationValue:
        return obj.to_id

What is the intended result, should the handler return the referenced object instead of its id?

Upgrade step for pull request #10 is missing

See also https://community.plone.org/t/plone-4-3-12-soft-released/3529/7.

plone.app.content 2.1.6 includes pull request #10. The changelog entry got merged to the wrong version header, I fixed that in 5b04365.

Looking at the discussion in pull request #10, it seems there may be an upgrade step somewhere, but maybe it is not in the correct version. Apparently the change was planned for Plone 4.3.4, instead of 4.3.12 where it ended up.

Also, the profile is not hidden, so you see it as installable in the add-ons control panel. That is also a way around the missing upgrade: you can safely install it.

So todo:

  • Create upgrade step or move it to the correct version in plone.app.upgrade. This should apply the default profile. It only contains a small registry.xml.

  • Hide the plone.app.content:default profile in CMFPlone/factory.py.

BTW, I see no code in Plone 4.3 that actually uses this: grepping for file_mimetype_behaviour or ISiteContentSettings only gives a result for the definition in plone.app.content and its registry file.

cc @djay

the "plonejsi18n" view canot create correct language code when request 's LANGUAGE contain sub-language

the "plonejsi18n" view is responsive for getting tranalated vocabulary through ajax request.
When the browser request's LANGUAGE contain sub-language,for example:"zh-CN",i18n.i18njs will generate wrong language code: "zh-cn",This correct language code should be "zh_CN".
`
def call(self, domain=None, language=None):

    if domain is None:
        catalog = {}
    else:
        if language is None:
            language = self.request['LANGUAGE']
        catalog = self._gettext_catalog(domain, language)

    response = self.request.response
    response.setHeader('Content-Type', 'application/json; charset=utf-8')
    response.setBody(json.dumps(catalog))
    return response`

Folder content view adds Uploads to wrong folder

In plone 5.0b2 when I open the folder contents in one folder say /a then navigate to a different folder say /a/b and upload a File using the upload button, the file gets added to /a instead of /a/b/.

I have tracked this issue down to plone/mockup@27471487b5a71 which made the structure pattern expect portal_type instead of Type inside fc-contextInfo. I will add a pull request which adds portal_type to the attributes of the fc-contextInfo view.

Error with exotic mime types

I have a content with a mimetype which is not registered in the mimetype registry and this is causing:

Traceback (innermost last):
  Module ZPublisher.WSGIPublisher, line 156, in transaction_pubevents
  Module ZPublisher.WSGIPublisher, line 338, in publish_module
  Module ZPublisher.WSGIPublisher, line 248, in publish
  Module ZPublisher.mapply, line 85, in mapply
  Module ZPublisher.WSGIPublisher, line 62, in call_object
  Module plone.app.content.browser.vocabulary, line 252, in __call__
IndexError: tuple index out of range

Move ignored columns to the registry?

On https://github.com/plone/plone.app.content/blob/master/plone/app/content/browser/contents/__init__.py in FolderContentsView class there is a ignored_columns method with a static list of catalog columns that are to be hidden from the folder_contents view.

If someone, say me :-), wants to have any of those columns available the only way to do so is either fork p.a.content or override that method.

Wouldn't make sense to move this configuration, and probably others, in a plone.app.registry key so it would be a matter of changing some settings?

Is there any strong opinion against it?

Uploading a txt-file tries to create a Document instead of a File and fails

This happens in 5.0b2 and master-branch. Here is the traceback:

Traceback (innermost last):
  Module ZPublisher.Publish, line 138, in publish
  Module ZPublisher.mapply, line 77, in mapply
  Module Products.PDBDebugMode.runcall, line 70, in pdb_runcall
  Module ZPublisher.Publish, line 48, in call_object
  Module plone.app.content.browser.file, line 147, in __call__
UnboundLocalError: local variable 'size' referenced before assignment

Uploading files or images with leading underscores throw a user visible exception

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 plone.z3cform.layout, line 66, in __call__
Module plone.z3cform.layout, line 50, in update
Module plone.dexterity.browser.add, line 130, in update
Module plone.z3cform.fieldsets.extensible, line 59, in update
Module plone.z3cform.patch, line 30, in GroupForm_update
Module z3c.form.group, line 145, in update
Module plone.app.z3cform.csrf, line 21, in execute
Module z3c.form.action, line 98, in execute
Module z3c.form.button, line 315, in __call__
Module z3c.form.button, line 170, in __call__
Module plone.dexterity.browser.add, line 105, in handleAdd
Module z3c.form.form, line 250, in createAndAdd
Module plone.dexterity.browser.add, line 80, in add
Module plone.dexterity.utils, line 179, in addContentToContainer
Module plone.app.multilingual.content.lrf, line 25, in chooseName
Module plone.app.content.namechooser, line 53, in chooseName
Module plone.app.content.namechooser, line 86, in _findUniqueName
ValueError: Cannot find a unique name based on _1x1 after 100 attemps.

I encountered the problem in a Plone 4 site but could reproduce it on demo.plone.org (5.0.2) too.
The name checker in there does not allow a leading _, but the namechooser uses a name normalizer that does not remove the leading underscore. PR inbound

Some "Contents" (pat-structure) actions fail when path has inaccessible level

For example, user cannot delete a page through Contents editor (pat-structure) if the user does not have access on all levels above the current level.

Steps to reproduce

  1. Create folder /private
  2. Create folder /private/shared
  3. Create page /private/shared/page
  4. Give user Editor permissions for /private/shared
  5. User opens /private/shared/folder_contents
  6. User cannot delete /private/shared/page through folder_contents

Technically this is due to restritedTraverse-call in ContentsBaseAction.call and affects all actions calling that base implementation (at least delete and copy): https://github.com/plone/plone.app.content/blame/59f1b2606ed0104a1d34bafe502aaf64aa7c0483/plone/app/content/browser/contents/__init__.py#L107

TypeError: 'NoneType' object has no attribute '__getitem__'

Plone 5.0.5, plone.app.content 3.1.1

A DX content type with

class IPublication(model.Schema):

    connectors = RelationList(
        title=u"Connectors",
        default=[],
        value_type=RelationChoice(title=_(u"Connectors"),
                                  source=ObjPathSourceBinder()),
        required=True,
    )

leads to the following error as soon as you enter something into the auto-complete widget.


2016-08-25 13:55:47 ERROR Zope.SiteErrorLog 1472126147.580.27364738339 http://dev.zopyx.com:12020/Plonewqeqwe/foo/@@edit/++widget++form.widgets.connectors/@@getSource
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 plone.app.content.browser.vocabulary, line 217, in __call__
TypeError: 'NoneType' object has no attribute '__getitem__'
> self.parsed_query
> {'sort_on': u'sortable_title', 'sort_order': 'ascending', u'SearchableText': {'query': u'co*'}}
> len(results)
> 0

folder_contents broken in Plone 5.0.5 for sites using virtual hosting

It seems that the folder_contents is broken in Plone 5.0.5 for sites with virtual hosting environments.
With Plone 5.0.4 everything is ok.
Pinning the version of plone.app.content to 3.0.20 for Plone 5.0.5 works.

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 plone.app.content.browser.contents, line 275, in __call__
  Module plone.app.content.browser.contents, line 233, in get_options
  Module plone.app.content.browser.contents, line 65, in get_top_site_from_url
  Module ZPublisher.HTTPRequest, line 280, in physicalPathFromURL
ValueError: Url does not match virtual hosting context

recursive workflow action in folder_contents

I've stumbled upon this in wildcard.foldercontents but since the original code is here I have the following issue: If you make recursive workflow actions in folder_contents you end up in a mess because of these lines here https://github.com/plone/plone.app.content/blob/master/plone/app/content/browser/contents/workflow.py#L80:

80: if self.putils.isDefaultPage(obj):
81:     self.action(obj.aq_parent.aq_parent)

why is there a check for default page and if so, why acquire two parent levels?
in my case, the workflow for the whole folder structure was changed because, every subfolder had a defaultPage.
If I remove those two lines, everything work as expected ... if this is ok, I'll make a pull request.

SimpleVocabularies are not searchable..trying to search a SimpleVocabulary should be an error.

A Dexterity content-type has the following field rendered suing AjaxSelectFieldWidget from a static SimpleVocabulary.

    directives.widget('idm_link2', AjaxSelectFieldWidget, vocabulary='unimr.staff.persons')
    idm_link2 = schema.List(
        title=_(u'Person IDM Link'),
        value_type=schema.Choice(
            title=u'Dummy',
            vocabulary='unimr.staff.persons'),
        required=True
    )

The AJAX search always returns the full vocabulary because it falls back to the default vocabulary if there is no search() implementation.

https://github.com/plone/plone.app.content/blob/master/plone/app/content/browser/vocabulary.py#L118

If you search for something and the related vocabulary does not provide the search() method then this should count as an error instead of return all rows. At least a logging message should indicate the situation about returning the complete vocabulary as fallback.

Current folder_constraintypes_form misses set values

This bug can be replicated on Plone 4.3.2 by going to the folder_constraintypes_form and setting some values such as:

  1. On the select choose "select manually"
  2. Add some content types as manually allowed content
  3. Save and you will see that the options set remain in view
  4. refresh page and you will get "use parent default settings" and the inputs are missing the select and checked values

Using the code with the adapter for these form fields from this changeset 902b2e0 fixed this issue that I am reporting however this code was removed by @davisagli in this changeset 2aa0a17

json_dumps fails on Decimal

(Pdb++) pprint(items)
[{u'CreationDate': '2017-06-22T18:13:06+02:00',
  u'Creator': 'admin',
  u'Description': '',
  u'EffectiveDate': 'None',
  u'ExpirationDate': 'None',
  u'Language': u'',
  u'ModificationDate': '2017-06-22T18:26:16+02:00',
  u'Subject': (),
  u'Title': 'Basis-Lizenz',
  u'Type': u'License Base',
  u'UID': u'86433e9fde3b4683a160a97d7150408f',
  u'exclude_from_nav': False,
  u'getIcon': Missing.Value,
  u'getMimeIcon': '/Plone/++resource++mimetype.icons/txt.png',
  u'getObjSize': '0 KB',
  u'getURL': 'http://localhost:11150/Plone/licenses/basis-lizenz',
  u'id': 'basis-lizenz',
  u'is_folderish': True,
  u'item_net': Decimal('149'),
  u'last_comment_date': None,
  u'mime_type': u'text/plain',
  u'path': '/licenses/basis-lizenz',
  u'portal_type': 'license',
  u'review_state': Missing.Value,
  u'total_comments': 0}]

(Pdb++) json_dumps({  'results': items[0],'total': total  })
*** ValueError: Circular reference detected

(Pdb++) items[0]['item_net']= 149
(Pdb++) json_dumps({  'results': items[0],'total': total  })
'{"total": 1, "results": {"getURL": "http://localhost:11150/Plone/licenses/basis-lizenz", "total_comments": 0, "Title": "Basis-Lizenz", "exclude_from_nav": false, "Type": "License Base", "id": "basis-lizenz", "last_comment_date": null, "UID": "86433e9fde3b4683a160a97d7150408f", "is_folderish": true, "ExpirationDate": "None", "ModificationDate": "2017-06-22T18:26:16+02:00", "review_state": null, "getMimeIcon": "/Plone/++resource++mimetype.icons/txt.png", "mime_type": "text/plain", "EffectiveDate": "None", "portal_type": "license", "Language": "", "path": "/licenses/basis-lizenz", "getObjSize": "0 KB", "Description": "", "Creator": "admin", "getIcon": null, "item_net": 149, "CreationDate": "2017-06-22T18:13:06+02:00", "Subject": []}}'

Overridden translations ignored by plonejsi18n

When trying to add a "widgets.po" in my project it gets ignored. plonejsi18n loads it along with the original but in the wrong order so the original labels always override my custom labels.

folder_contents and INavigationRoot problems

When folder_contents is called on a INavigationRoot rooted subsite and some item is copied, then navigated up to the main portal site (which should be possible with #83 ), then pasted the copied object isn't pasted where we've navigated to but on the INavigationRoot object.

This is due to use of zope.component.hooks.getSite, which returns the INavigationRoot object.
Fix is coming...

folder_contents broken when using Root Navigation behaviour on folder clone

I am having a problem where folder_contents breaks when in a folder inside a subsite. The contents of the folder don't show up, and a 404 error trying to load @@qsOptions is logged in the browser console. It sounds a bit like issue #103, but not exactly. I am also using virtual hosting and nginx.

These are the steps to reproduce:

  1. Create new plone site (mysite)

  2. Create a new "Subsite" dexterity content type as a clone of "Folder". Add the "Navigation root" behaviour to it.

  3. Add a new "Subsite" in the root of mysite (mysubsite) and publish it.

  4. Create a page inside mysubsite, publish it and make it the default view for mysubsite

  5. Create a folder called "Folder 1" inside mysubsite (folder1) and folders, pages or any other content type objects inside folder1. Publish them all.

  6. Create virtual host configuration on separate webserver (in my case, a nginx reverse proxy) for mysubsite:

server {
  listen 80;
  server_name
    mysubsite.something.com
    mysubsite.somethingelse.something.com
    ;

  return 301 https://$server_name$request_uri;
}

server {
  listen 443 ssl http2;
  server_name
    mysubsite.something.com
    mysubsite.somethingelse.something.com
    ;

  if ($host != $server_name) {
        return 301 https://$server_name$request_uri;
  }

  include /etc/nginx/conf.d/local/0-proxy-headers;

  location / {
    proxy_pass http://plone.something.com:53080/VirtualHostBase/https/mysubsite.something.com:443/mysite/mysubsite/VirtualHostRoot/;
  }
}

0-proxy-headers contains this:

proxy_request_buffering off;
proxy_buffering off;

add_header Strict-Transport-Security "max-age=31536000; includeSubdomains;" always;

proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
  1. Log into mysubsite.something.com
  2. Click on "Folder 1" in the top menu
  3. Click "Contents" in the admin panel
  1. The problem doesn't appear when logging into mysubsite.something.com, then clicking on "Contents" at the root, and then clicking on "Folder 1"

Info about my setup:
Plone 5.1.2.1 (5112) (Although it breaks in 5.0.6 as well)
CMF 2.2.12
Zope 2.13.27
Python 2.7.14 (default, Aug 17 2018, 09:45:23) [GCC 4.4.7 20120313 (Red Hat 4.4.7-18)]
PIL 5.1.0 (Pillow)

UnicodeDecodeError when changing the workflow state

If the workflow transition contains non-ASCII characters, a UnicodeDecodeError occurs when the user clicks the button which should open the workflow change modal.

2019-04-29 13:47:43 ERROR Zope.SiteErrorLog 1556538463.670.911733453482 http://localhost:8080/foobar/platform/@@fc-workflow
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 plone.app.content.browser.contents.workflow, line 63, in __call__
  Module Products.CMFCore.FSPythonScript, line 127, in __call__
  Module Shared.DC.Scripts.Bindings, line 322, in __call__
  Module Shared.DC.Scripts.Bindings, line 359, in _bindAndExec
  Module Products.PythonScripts.PythonScript, line 344, in _exec
  Module script, line 21, in translate
   - <FSPythonScript at /extranet.amnesty.ch/platform/translate>
   - Line 21
  Module Products.CMFPlone.TranslationServiceTool, line 53, in translate
  Module zope.i18n, line 114, in translate
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 3: ordinal not in range(128)

Using safe_unicode in self.context.translate(safe_unicode(transition['name'])) will help.

folder_contents view add contents in parent folder

Adding new content in folder_contents view results in new content in the parent folder. For example, actual path is /a/b/c and adding new content "d", the expected path of "d" is /a/b/c/d, but the real result is /a/b/d.

Environment:

  • Plone 5.1.2.1 (5112)
  • CMF 2.2.12
  • Zope 2.13.27
  • Python 2.7.12 (default, Dec 4 2017, 14:50:18) [GCC 5.4.0 20160609]
  • PIL 4.3.0 (Pillow)

Looking at the developer network tab, I saw that @@fc-contextInfo is called multiple times. The response includes the wrong path informations for the add menu and the following responses include the right path informations, but they are not use for the add menu.
I've added an HAR-file (renamed to txt) of these network communication.
plone.app.content.txt

The issue is taking place for the first site request. If you force a page reload (e.g. hit "F5") the paths of the add menu are correct.

Master branch versus 3.1.x

In coredev 5.0, @gforcada has set the plone.app.content branch to 3.1.x at the end of May: plone/buildout.coredev@f997972

But the master branch has had a few commit since then and is at version 3.1.3.dev0 after @esteele released version 3.1.2 a few days ago.

I do see that Gil had updated the version to 3.2 initially: ff8d1a6
And that I have downgraded it: d5df82d

Plone 5.0.4 has plone.app.content 3.0.20
Plone 5.0.5 has plone.app.content 3.1.1.

Is coredev 5.0 maybe meant to use branch 3.0.x instead of 3.1.x? All seems well in combination with 3.1.x. Version 3.1(.0) does have some new features, so maybe it was meant not to go in Plone 5.0. But it has already happened by now.

So: a bit of a strange mess. Maybe this also partly explains why in #97 Jenkins wants me to also test on 5.1 even though the branch I want to merge to is 3.1.x.

CC @thet since he made the most changes recently.

Proposal:

  • Let coredev 5.0 use the master branch again.
  • Remove the 3.1.x branch.

Do not require ICategorization behavior on folder contents properties form

After removing the ICategorization behavior from File and Image types, I encountered a problem when editors were trying to manipulate images via the properties page. They got this error:

1549886058.340.671272700427 https://hda-graz.at/programm/veranstaltungsfotos/mostlikely-sudden-workshop/@@fc-properties
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 bda.aaf.site.browser.foldercontents_actions_properties, line 40, in __call__
  Module plone.app.content.browser.contents.properties, line 93, in __call__
  Module plone.app.content.browser.contents, line 127, in __call__
  Module plone.app.content.browser.contents.properties, line 160, in action
  Module bda.aaf.site.browser.foldercontents_actions_properties, line 66, in dx_action
  Module plone.app.content.browser.contents.properties, line 109, in dx_action
TypeError: ('Could not adapt', <Image at /Plone/hda/programm/veranstaltungsfotos/mostlikely-sudden-workshop/190130_vortrag-buchpraesentation-most-likely_-c-thomas-raggam-hda-6.jpg>, <SchemaClass plone.app.dexterity.behaviors.metadata.ICategorization>)

Here, this line:

behavior_categorization = ICategorization(obj)

should read:

 behavior_categorization = ICategorization(obj, None) 

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.