internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: plone/Products.CMFPlone

Issue:
Bug: `_smtp` is missing at SMTPMailer's __init__ patching what is introduced in zope.sendmail from version  4.1.0
### What I did:
I am working on internal Addon development (adding support for Plone 5.2) , sending mail notification one of the part functionalities. FYI: some how I forget to active MockMailhost.
When I run all my existing unittests and  got unexpected errors : 

```
File "/home/nazrul/.cache/buildout/eggs/plone.testing-7.0.0-py2.7.egg/plone/testing/zope.py", line 859, in testTearDown
    transaction.abort()
  File "/home/nazrul/.cache/buildout/eggs/transaction-2.4.0-py2.7.egg/transaction/_manager.py", line 255, in abort
    return self.manager.abort()
  File "/home/nazrul/.cache/buildout/eggs/transaction-2.4.0-py2.7.egg/transaction/_manager.py", line 136, in abort
    return self.get().abort()
  File "/home/nazrul/.cache/buildout/eggs/transaction-2.4.0-py2.7.egg/transaction/_transaction.py", line 529, in abort
    reraise(t, v, tb)
  File "/home/nazrul/.cache/buildout/eggs/transaction-2.4.0-py2.7.egg/transaction/_transaction.py", line 515, in abort
    rm.abort(self)
  File "/home/nazrul/.cache/buildout/eggs/zope.sendmail-4.2-py2.7.egg/zope/sendmail/delivery.py", line 57, in abort
    self.onAbort()
  File "/home/nazrul/.cache/buildout/eggs/zope.sendmail-4.2-py2.7.egg/zope/sendmail/mailer.py", line 78, in abort
    if self.connection is None:
  File "/home/nazrul/.cache/buildout/eggs/zope.sendmail-4.2-py2.7.egg/zope/sendmail/mailer.py", line 48, in <lambda>
    return property(lambda self: getattr(self._smtp, name),
AttributeError: 'SMTPMailer' object has no attribute '_smtp'
```
All tests are passing for earlier version of Plone.

### What is my prediction: 
After day long investigation, I found [SMTPMailer __init__ method is patched here](https://github.com/plone/Products.CMFPlone/blob/master/Products/CMFPlone/patches/sendmail.py#L39) , beside Also found that [zope.sendmail from version 4.1.0 the SMTPMailer's __init__](https://github.com/zopefoundation/zope.sendmail/blob/4.1.0/src/zope/sendmail/mailer.py#L45)
has been introduced a new attribute `_smtp` what is ignored during patching.

### How to reproduce:

This is only for Plone 5.2.x

1. disable Mock Mail
2. Try to send email from your tests code 
3. Or try send mail from your production/testing server.





Discussion:

Resolving patch:
diff --git a/Products/CMFPlone/patches/sendmail.py b/Products/CMFPlone/patches/sendmail.py
--- a/Products/CMFPlone/patches/sendmail.py
+++ b/Products/CMFPlone/patches/sendmail.py
@@ -3,11 +3,13 @@
 from Products.CMFPlone.interfaces import IMailSchema
 from transaction._transaction import Status
 from zope.component import getUtility
+from zope.sendmail.mailer import _SMTPState
 from zope.sendmail.mailer import SMTPMailer
 
 import logging
 import transaction
 
+
 log = logging.getLogger("MailDataManager")
 
 
@@ -53,5 +55,7 @@ def new_init(
     self.password = mail_settings.smtp_pass
     self.force_tls = force_tls
     self.no_tls = no_tls
+    self._smtp = _SMTPState()
+
 
 SMTPMailer.__init__ = new_init


Test patch:
Repository: plone/Products.CMFPlone

Issue:
mark special links "opt in" instead of "opt out"
## PLIP (Plone Improvement Proposal)

<!--

Read http://docs.plone.org/develop/coredev/docs/plips.html first!

Set "03 type: feature: plip" as label.

Mention the @plone/framework-team when the PLIP is information complete!

-->

## Responsible Persons

### Proposer: Markus Hilbert

### Seconder: Philip Bauer

## Abstract

make the mark special links an opt in option

## Motivation

devs turn that off at every project and link highlighting for https makes not much sense as every link is https - so the layout gets polluted by lock-icons

## Assumptions

not much to assume here.

## Proposal & Implementation

straight forward: change the boolean in registry.xml to false instead of true.

## Deliverables

if there is a documentation about that, this might need changes too.

## Risks

don't see any

## Participants

@iham 


Discussion:

Resolving patch:
diff --git a/Products/CMFPlone/interfaces/controlpanel.py b/Products/CMFPlone/interfaces/controlpanel.py
--- a/Products/CMFPlone/interfaces/controlpanel.py
+++ b/Products/CMFPlone/interfaces/controlpanel.py
@@ -1723,7 +1723,7 @@ class ILinkSchema(Interface):
     mark_special_links = schema.Bool(
         title=_(u'Mark special links'),
         description=_(u'Marks external or special protocol links with class.'),
-        default=True,
+        default=False,
         required=False)
 
 


Test patch:
Repository: plone/Products.CMFPlone

Issue:
Enable dropdown navigation by default
When playing around with http://demo-latest-py3.plone.org I get the feeling that having dropdown-navigation enabled by default would be great since it enhances usability a lot. 

But: When upgrading existing sites to 5.2 that would probably be very irritating and ruin layouts. 

So I propose to:

* Set `plone.navigation_depth` to a default of 3 (which is the setting on http://demo-latest-py3.plone.org) for new sites.
* Disable it (set `plone.navigation_depth` to a level of 0) during a upgrade to 5.2

Side-note: It is a little irritating that 0 and 1 result in the same navigation.


Discussion:
Be aware that the time needed to render the navigation grows exponentially with plone.navigation_depth.
Setting 3 as a default seems too much to me.

Maybe it would be cool to add a warning about potential speed issues in the description of the field in the control panel?

Resolving patch:
diff --git a/Products/CMFPlone/interfaces/controlpanel.py b/Products/CMFPlone/interfaces/controlpanel.py
--- a/Products/CMFPlone/interfaces/controlpanel.py
+++ b/Products/CMFPlone/interfaces/controlpanel.py
@@ -732,7 +732,7 @@ class INavigationSchema(Interface):
     navigation_depth = schema.Int(
         title=_(u'Navigation depth'),
         description=_(u'Number of folder levels to show in the navigation.'),
-        default=1,
+        default=3,
         required=True
     )
 


Test patch:
Repository: plone/Products.CMFPlone

Issue:
Plone 5.1.4 to 5.1.5 update: resource registry meta bundle generator comments first css construct of individual bundles
In one of our projects, after upgrading from Plone 5.1.4 to Plone 5.1.5  A very small part of the css became broken in plone.app.mosaic layouts . Images inside a tile no longer had a "height: auto" on them. This is normally included in mosaic-styles.css , and the mosaic styles were included in default.css.  

We quickly patched the missing statement into our theme file and did a patch release, but the underlying problem was vague.  The problem would only appear on production, running the site locally did not show the problem, so my attention was pulled to the metabundle generation. This was modified between 5.1.4 and 5.1.5 in https://github.com/plone/Products.CMFPlone/commit/397918cd39ba0be4e2e150df5f5f2220e6ecc828 by @vangheem 

The problematic code is in this part:

https://github.com/plone/Products.CMFPlone/blob/2195c4a43ba100fb2b7973dccb4299dad2de42fe/Products/CMFPlone/resources/browser/combine.py#L123-L132

The individual bundles are separated by comment lines with // Start bundle and // End Bundle, but // actually comments out the first following css construct , more info at  https://www.xanthir.com/b4U10

And the mosaic-styles.css individual bundle start with:

```
// Start Bundle: mosaic-styles
/* Images will never be bigger then a tile */
.mosaic-tile img {
  max-width: 100%;
  height: auto;
}
```

If even skips over the /* */ comment on the next line and comments the first {} it sees
So that is how only our height: auto; got disabled in production . 

This is  at the moment only broken in Plone 5.1 , In Plone 5.2 the whole bundler got rewritten again, partly because of Python3 support and doesn't seem to insert these comments. I have swapped the // comment for /* */ comments and this also solves the problem. I'll create a pull request shortly. 



Discussion:

Resolving patch:
diff --git a/Products/CMFPlone/resources/browser/combine.py b/Products/CMFPlone/resources/browser/combine.py
--- a/Products/CMFPlone/resources/browser/combine.py
+++ b/Products/CMFPlone/resources/browser/combine.py
@@ -124,9 +124,9 @@ def _write_out(self, resources, postfix):
         fi = StringIO()
         for bname, script in resources.items():
             fi.write('''
-// Start Bundle: {0}
+/* Start Bundle: {0} */
 {1}
-// End Bundle: {2}
+/* End Bundle: {2} */
 '''.format(bname, script, bname))
         self.folder.writeFile(self.name + postfix, fi)
         resources.clear()


Test patch:
Repository: plone/Products.CMFPlone

Issue:
Can not save website controlpanel when default page is empty.
In some project I have an empty `default page` setting in my registry. 
```
  <records
      interface="Products.CMFPlone.interfaces.controlpanel.ISiteSchema"
      prefix="plone">
    <value key="default_page"></value>
...
```

After save of Website settings I got a validation error "required input is missing" (German: Erforderliche Eingabe fehlt.). But there was no field marked, its floats free between robots and roles field. With inspector I see there a hidden input:
```
<input id="form-widgets-default_page" name="form.widgets.default_page" value="" class="hidden-widget" type="hidden" data-_extension-text-contrast="bg">
```
The field is required but hidden with an empty value, so this is what it is causing the problem.


Discussion:
How to solve this? make `default_page` not required? In general I think `plone.app.registry` should check if one tries to clear a required registry value... what do you think?
well, default page can be empty. IMO. It's OK to remove the required.

Resolving patch:
diff --git a/Products/CMFPlone/interfaces/controlpanel.py b/Products/CMFPlone/interfaces/controlpanel.py
--- a/Products/CMFPlone/interfaces/controlpanel.py
+++ b/Products/CMFPlone/interfaces/controlpanel.py
@@ -1155,7 +1155,7 @@ class ISiteSchema(Interface):
         description=_(
             u'Select which IDs (short names) can act as fallback '
             u'default pages for a container.'),
-        required=True,
+        required=False,
         default=[
             u'index_html',
             u'index.html',


Test patch:
Repository: plone/Products.CMFPlone

Issue:
The TinyMCE pattern loads HTML as CSS and slows edit forms
## The TinyMCE pattern loads HTML as CSS and slows edit forms

### What I did:

Open an `@@edit` form with the browser's network inspector open.

### What I expect to happen:

It should load quickly and with the correct resources.

### What actually happened:

For every field using the TinyMCE pattern, there was a network request for the portal root rendered at HTML but loaded as CSS.  This takes a lot of time and greatly slows the page load time.

### What version of Plone/ Addons I am using:

Products.CMFPlone==5.1.5
plone.app.theming==2.0.5


Discussion:

Resolving patch:
diff --git a/Products/CMFPlone/patterns/tinymce.py b/Products/CMFPlone/patterns/tinymce.py
--- a/Products/CMFPlone/patterns/tinymce.py
+++ b/Products/CMFPlone/patterns/tinymce.py
@@ -48,7 +48,7 @@ def get_content_css(self, style_css=''):
                 files.append('/'.join([self.nav_root_url, url.strip()]))
         theme = self.get_theme()
         tinymce_content_css = getattr(theme, 'tinymce_content_css', None)
-        if tinymce_content_css is not None:
+        if tinymce_content_css:
             for path in theme.tinymce_content_css.split(','):
                 if path.startswith('http://') or path.startswith('https://'):
                     files.append(path)


Test patch:
Repository: plone/Products.CMFPlone

Issue:
TTW Bundle compilation broken
Since the integration of plone.staticresources / Plone 5.2 the TTW bundle compilation in ``@@resourceregistry-controlpanel`` is broken.
r.js cannot be found.


Discussion:

Resolving patch:
diff --git a/Products/CMFPlone/controlpanel/browser/resourceregistry.py b/Products/CMFPlone/controlpanel/browser/resourceregistry.py
--- a/Products/CMFPlone/controlpanel/browser/resourceregistry.py
+++ b/Products/CMFPlone/controlpanel/browser/resourceregistry.py
@@ -409,14 +409,8 @@ def config(self):
         base_url = self.context.absolute_url()
         resources = self.get_resources()
 
-        try:
-            less_url = self.registry['plone.resources.lessc']
-        except KeyError:
-            less_url = '++plone++static/components/less/dist/less-1.7.4.min.js'
-        try:
-            rjs_url = resources['rjs'].js
-        except KeyError:
-            rjs_url = '++plone++static/components/r.js/dist/r.js'
+        less_url = self.registry['plone.resources.lessc']
+        rjs_url = self.registry['plone.resources.rjs']
 
         data = {
             'development': self.registry['plone.resources.development'],


Test patch:
Repository: plone/Products.CMFPlone

Issue:
PasswordResetView::getErrors function never called.
## BUG

<!--

Read https://plone.org/support/bugs first!

Please use the labels at Github, at least one of the types: bug, regression, question, enhancement.

Please include tracebacks, screenshots, code of debugging sessions or code that reproduces the issue if possible.
The best reproductions are in plain Plone installations without addons or at least with minimal needed addons installed.

-->

### What I did:
I am trying to reset the password, using a normal Plone user and I made a PDB inside https://github.com/plone/Products.CMFPlone/blob/master/Products/CMFPlone/browser/login/password_reset.py#L159

URL: {site url}/passwordreset/e3127df738bc41e1976cc36cc9832132?userid=local_manager

### What I expect to happen:
I expected a call `RegistrationTool.testPasswordValidity(password, password2)
` as I have some business logic inside testPasswordValidity but I saw code never coming here

### What actually happened:
As I see inside ''getErrors''  method, there is a call to registration tool testPasswordValidity method but the ''getErrors'' never called.
### What version of Plone/ Addons I am using:
Plone 5.2.5rc




Discussion:
Fix in password_reset which works for me 
https://github.com/plone/Products.CMFPlone/blob/bd98bd05a3eaf1c5b9579a7fb49da9c37f6721fd/Products/CMFPlone/browser/login/password_reset.py#L141

 ```
    errors = self.getErrors()
    if errors:
        self.status = errors
        return self.form()
```



@benkummer did you make a pull request or just tried in your local.
@nazrulworld I did try it local. Icannot do pull requests yet

Resolving patch:
diff --git a/Products/CMFPlone/browser/login/password_reset.py b/Products/CMFPlone/browser/login/password_reset.py
--- a/Products/CMFPlone/browser/login/password_reset.py
+++ b/Products/CMFPlone/browser/login/password_reset.py
@@ -117,6 +117,9 @@ def _auto_login(self, userid, password):
         return
 
     def _reset_password(self, pw_tool, randomstring):
+        state = self.getErrors()
+        if state:
+            return self.form()
         userid = self.request.form.get('userid')
         password = self.request.form.get('password')
         try:


Test patch:
Repository: plone/Products.CMFPlone

Issue:
sorting in control panel
The items of the control panel are completely unsorted (should be sorted in alphabetical order (depending on the current language in Plone).
![screenshot-dev1 veit-schiele de 8080 2015-07-18 13-35-44](https://cloud.githubusercontent.com/assets/594239/8761438/07d76bf4-2d52-11e5-8540-82fd53932690.png)



Discussion:
At the sprint it was discussed that it should always be sorted by English titles.

I wonder if that is due to integrators using Plone in multiple languages though and that most users would just prefer it sorted in their own language.

If we could get the research I'd much prefer it was sorted based on most used. I would think that themeing and addons would come first. but for sure they should he sorted consistently despite language. 

Sorting on English titles is completely nonsense and does not make any
sense at all.
Sorting based on "frequently used" or "most important" might be an argument
but not EN titles only.
So why are other lists sorted by the current UI language?

2015-07-19 5:36 GMT+02:00 Dylan Jay notifications@github.com:

> If we could get the research I'd much prefer it was sorted based on most
> used. I would think that themeing and addons would come first. but for sure
> they should he sorted consistently despite language.
> 
> —
> Reply to this email directly or view it on GitHub
> https://github.com/plone/Products.CMFPlone/issues/721#issuecomment-122619649
> .

Points that came up in the discussion:
- sorting on localized language is very annoying for people having/using sites in more than 1 language, because the ordering changes all the time. People are creatures of habit.
- there is precedent for this: look f.i. to controlpanel settings on OS X (or Ubuntu or Windows), they are not sorted by local language.
- the best would be to sort according to 'semantic logic'. A start is already that there are groups now, which makes the sorting within those groups less of an issue. Also the icons make it already easier.
- but we need some real discussion and not just a few person's opinion, to decide what that order is. 


Resolving patch:
diff --git a/Products/CMFPlone/PloneControlPanel.py b/Products/CMFPlone/PloneControlPanel.py
--- a/Products/CMFPlone/PloneControlPanel.py
+++ b/Products/CMFPlone/PloneControlPanel.py
@@ -143,9 +143,10 @@ def enumConfiglets(self, group=None):
                 a['title'] = translate(title,
                                        context=self.REQUEST)
 
-        def _id(v):
-            return v['id']
-        res.sort(key=_id)
+        def _title(v):
+            return v['title']
+
+        res.sort(key=_title)
         return res
 
     security.declareProtected(ManagePortal, 'unregisterConfiglet')


Test patch:
Repository: plone/Products.CMFPlone

Issue:
Unnecessary css file tries to load while editing a page
While editing a page an unnecessary css file tries to load:
![unnecessary_css](https://user-images.githubusercontent.com/5301889/57622531-2353a180-758e-11e9-9c5b-5d3cdef9a9b0.jpg)



Discussion:
It is only if 'tinymce-content-css' option is missing in themes manifest.cfg - see  #2860

Resolving patch:
diff --git a/Products/CMFPlone/patterns/tinymce.py b/Products/CMFPlone/patterns/tinymce.py
--- a/Products/CMFPlone/patterns/tinymce.py
+++ b/Products/CMFPlone/patterns/tinymce.py
@@ -49,7 +49,7 @@ def get_content_css(self, style_css=''):
                 files.append('/'.join([self.nav_root_url, url.strip()]))
         theme = self.get_theme()
         tinymce_content_css = getattr(theme, 'tinymce_content_css', None)
-        if tinymce_content_css is not None:
+        if tinymce_content_css is not None and tinymce_content_css != '':
             for path in theme.tinymce_content_css.split(','):
                 if path.startswith('http://') or path.startswith('https://'):
                     files.append(path)


Test patch:
Repository: plone/Products.CMFPlone

Issue:
mail_password form crashes if user is not found
Visiting /mali_password without providing a userid will simply crash. And if mail_password_form is submitted and a user is not found, or the user doesn't have an email configured, it will crash as well.


Discussion:

Resolving patch:
diff --git a/Products/CMFPlone/browser/login/mail_password.py b/Products/CMFPlone/browser/login/mail_password.py
--- a/Products/CMFPlone/browser/login/mail_password.py
+++ b/Products/CMFPlone/browser/login/mail_password.py
@@ -8,6 +8,7 @@
 class MailPasswordView(BrowserView):
 
     def __call__(self):
+        response = None
         try:
             response = self.context.portal_registration.mailPassword(
                 self.request.form.get('userid', ''),
@@ -22,6 +23,6 @@ def __call__(self):
                 raise e
             IStatusMessage(self.request).add(msg)
             self.request.response.redirect(
-                self.context.absolute_url() + 'mail_password_form'
+                self.context.absolute_url() + '/mail_password_form'
             )
         return response


Test patch:
Repository: plone/Products.CMFPlone

Issue:
I cannot migrate a Plone 5.2 ZoDB to 6
I took a Plone 5.2.3 Database with some history and I tried to migrate it to Plone 6 (buildout coredev, dx site root plip cfg).

When I browse to the site root http://localhost:8080, I have this:
```
...
AttributeError: 'MountedObject' object has no attribute 'getId'

 - Expression: "view/sites"
 - Filename:   ... ne/Products/CMFPlone/browser/templates/plone-overview.pt
 ...
```

The reason is that we have the `temp_folder` which is already meant to be removed in Plone 6 but unluckily this is broken and so the meta_type attribute can be found:
```
((Pdb++)) pp root.values()                                                     
[<BrowserIdManager at /browser_id_manager>,
 <SessionDataManager at /session_data_manager>,
 <SiteErrorLog at /error_log>,
 <persistent broken Products.ZODBMountPoint.MountedObject.MountedObject instance b'\x00\x00\x00\x00\x00\x00\x00\t'>,
 <Products.SiteAccess.VirtualHostMonster.VirtualHostMonster object at 0x7f304b3984a0 oid 0xa in <Connection at 7f3051c6a490>>,
 <ZopePageTemplate at /index_html>,
 <PloneSite at /Plone>,
 <PluggableAuthService at /acl_users>]
```



Discussion:

Resolving patch:
diff --git a/Products/CMFPlone/browser/admin.py b/Products/CMFPlone/browser/admin.py
--- a/Products/CMFPlone/browser/admin.py
+++ b/Products/CMFPlone/browser/admin.py
@@ -18,6 +18,7 @@
 from plone.protect.authenticator import check as checkCSRF
 from plone.protect.interfaces import IDisableCSRFProtection
 from urllib import parse
+from ZODB.broken import Broken
 from zope.component import adapts
 from zope.component import getAllUtilitiesRegisteredFor
 from zope.component import getUtility
@@ -55,7 +56,10 @@ def sites(self, root=None):
 
         result = []
         secman = getSecurityManager()
-        for obj in root.values():
+        candidates = (
+            obj for obj in root.values() if not isinstance(obj, Broken)
+        )
+        for obj in candidates:
             if obj.meta_type == 'Folder':
                 result = result + self.sites(obj)
             elif IPloneSiteRoot.providedBy(obj):


Test patch: