core.bones.textBone
¶
Module Contents¶
Classes¶
Find tags and other markup and call handler functions. |
|
Attributes¶
- core.bones.textBone._defaultTags¶
- class core.bones.textBone.HtmlSerializer(validHtml=None)¶
Bases:
html.parser.HTMLParser
Find tags and other markup and call handler functions.
- Usage:
p = HTMLParser() p.feed(data) … p.close()
Start tags are handled by calling self.handle_starttag() or self.handle_startendtag(); end tags by self.handle_endtag(). The data between tags is passed from the parser to the derived class by calling self.handle_data() with the data as argument (the data may be split up in arbitrary chunks). If convert_charrefs is True the character references are converted automatically to the corresponding Unicode character (and self.handle_data() is no longer split in chunks), otherwise they are passed by calling self.handle_entityref() or self.handle_charref() with the string containing respectively the named or numeric reference as the argument.
- handle_data(self, data)¶
- handle_charref(self, name)¶
- handle_entityref(self, name)¶
- flushCache(self)¶
Flush pending tags into the result and push their corresponding end-tags onto the stack
- handle_starttag(self, tag, attrs)¶
Delete all tags except for legal ones
- handle_endtag(self, tag)¶
- cleanup(self)¶
Append missing closing tags
- sanitize(self, instr)¶
- class core.bones.textBone.textBone(validHtml: Union[None, Dict] = __undefinedC__, languages: Union[None, List[str]] = None, maxLength: int = 200000, defaultValue: Any = None, indexed: bool = False, *args, **kwargs)¶
Bases:
viur.core.bones.baseBone
- class __undefinedC__¶
- type = text¶
- static generageSearchWidget(target, name='TEXT BONE', mode='equals')¶
- singleValueSerialize(self, value, skel: SkeletonInstance, name: str, parentIndexed: bool)¶
- singleValueFromClient(self, value, skel, name, origData)¶
- getEmptyValue(self)¶
- isInvalid(self, value)¶
Returns None if the value would be valid for this bone, an error-message otherwise.
- getReferencedBlobs(self, valuesCache, name)¶
Test for /file/download/ links inside our text body. Doesn’t check for actual <a href=> or <img src=> yet.
- getSearchTags(self, skeletonValues, name)¶
- getSearchDocumentFields(self, valuesCache, name, prefix='')¶
Returns a list of search-fields (GAE search API) for this bone.