[migration] hackish black magic to bootstrap addition of formula attr during migration
Turns out we can't add an attribute to CWAttribute before the attribute
exists. add_attribute generates rql with a 'formula' relation, which CW
doesn't know about yet, so things get unhappy. Once that is fixed, we
need to make the CWAttribute addition operation deal with CWAttribute
entities that don't have a formula yet.
Finally, move the migration to bootstrapmigration_repository so it
happens early on, and use add_entity_type rather than add_relation_type
for CWComputedRType.
from__future__importabsolute_importimportmarkdownimportlogginglog=logging.getLogger(__name__)defmarkdown_publish(context,data):"""publish a string formatted as MarkDown Text to HTML :type context: a cubicweb application object :type data: str :param data: some MarkDown text :rtype: unicode :return: the data formatted as HTML or the original data if an error occurred """md=markdown.Markdown()try:returnmd.convert(data)except:importtraceback;traceback.print_exc()log.exception("Error while converting Markdown to HTML")returndata