Skip to content

Commit

Permalink
port all CMFDefault occurenceces
Browse files Browse the repository at this point in the history
  • Loading branch information
tomgross committed Apr 24, 2015
1 parent dd06d74 commit e9dfb56
Show file tree
Hide file tree
Showing 6 changed files with 879 additions and 603 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
Loading

0 comments on commit e9dfb56

Please sign in to comment.