minor fixes for avoiding errors with Python3 / up-to-date libraries
This commit is contained in:
parent
93a2acf7db
commit
df1229d8fd
2 changed files with 3 additions and 1 deletions
|
@ -167,7 +167,7 @@ class RecordsFieldInstance(GridFieldInstance):
|
||||||
def marshall(self, value):
|
def marshall(self, value):
|
||||||
result = []
|
result = []
|
||||||
value = value or []
|
value = value or []
|
||||||
cardinality = getattr(self.context, 'cardinality', None)
|
cardinality = getattr(self.context, 'cardinality', None) or 0
|
||||||
for row in value:
|
for row in value:
|
||||||
item = {}
|
item = {}
|
||||||
for fi in self.columnFieldInstances:
|
for fi in self.columnFieldInstances:
|
||||||
|
|
|
@ -24,6 +24,8 @@ sentencePattern = re.compile(r'[:.\?\!]')
|
||||||
|
|
||||||
def sanitize(value, validTags=validTags, validAttrs=validAttrs,
|
def sanitize(value, validTags=validTags, validAttrs=validAttrs,
|
||||||
validStyles=validStyles, stripEscapedComments=True):
|
validStyles=validStyles, stripEscapedComments=True):
|
||||||
|
if value is None:
|
||||||
|
return ''
|
||||||
soup = BeautifulSoup(value, features='lxml')
|
soup = BeautifulSoup(value, features='lxml')
|
||||||
for comment in soup.findAll(string=lambda text: isinstance(text, Comment)):
|
for comment in soup.findAll(string=lambda text: isinstance(text, Comment)):
|
||||||
comment.extract()
|
comment.extract()
|
||||||
|
|
Loading…
Add table
Reference in a new issue