Skip to content

Commit

Permalink
Merge pull request #18 from plone/tomgross-nocmfdefault
Browse files Browse the repository at this point in the history
Remove all CMFDefault dependencies
  • Loading branch information
gforcada committed Apr 25, 2015
2 parents 230bd77 + e9dfb56 commit 44549ca
Show file tree
Hide file tree
Showing 7 changed files with 891 additions and 35 deletions.
11 changes: 6 additions & 5 deletions Products/ATContentTypes/content/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from AccessControl import ClassSecurityInfo
from ComputedAttribute import ComputedAttribute

from Products.CMFDefault.utils import SimpleHTMLParser
from lxml import etree
from Products.GenericSetup.interfaces import IDAVAware

from Products.Archetypes.atapi import Schema
Expand Down Expand Up @@ -216,10 +216,11 @@ def manage_afterPUT(self, data, marshall_data, file, context, mimetype,
content = data

if -1 != content.lower().find("<html"):
parser = SimpleHTMLParser()
parser.feed(content)
if parser.title:
self.setTitle(parser.title)
parser = etree.HTMLParser()
tree = etree.fromstring(content, parser=parser)
titletag = tree.xpath('//title')
if titletag:
self.setTitle(titletag[0].text)
return

ATCTContent.manage_afterPUT(self, data, marshall_data, file,
Expand Down
33 changes: 10 additions & 23 deletions Products/ATContentTypes/setuphandlers.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from Acquisition import aq_base
from Products.ATContentTypes.lib import constraintypes
from Products.CMFCore.utils import getToolByName
from Products.CMFDefault.utils import bodyfinder
from Products.CMFPlone.utils import bodyfinder
from Products.CMFPlone.utils import _createObjectByType
from plone.i18n.normalizer.interfaces import IURLNormalizer
from plone.portlets.interfaces import ILocalPortletAssignmentManager
Expand All @@ -13,11 +13,7 @@
from plone.registry.interfaces import IRegistry
from zope.component import getUtility

try:
from Products.CMFPlone.interfaces import ILanguageSchema
PLONE_5 = True
except:
PLONE_5 = False
from Products.CMFPlone.interfaces import ILanguageSchema


def assignTitles(portal):
Expand Down Expand Up @@ -62,23 +58,14 @@ def setupPortalContent(p):
pprop = getToolByName(p, "portal_properties")
sheet = pprop.site_properties

if PLONE_5:
registry = getUtility(IRegistry)
language_settings = registry.forInterface(
ILanguageSchema,
prefix='plone'
)
language_settings.use_combined_language_codes = use_combined
language_settings.default_language = language
language_settings.available_languages = [language]
else:
tool = getToolByName(p, "portal_languages")
tool.manage_setLanguageSettings(
language,
[language],
setUseCombinedLanguageCodes=use_combined,
startNeutral=False
)
registry = getUtility(IRegistry)
language_settings = registry.forInterface(
ILanguageSchema,
prefix='plone'
)
language_settings.use_combined_language_codes = use_combined
language_settings.default_language = language
language_settings.available_languages = [language]

# Enable visible_ids for non-latin scripts

Expand Down
Loading

0 comments on commit 44549ca

Please sign in to comment.