This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import inspect | |
| import logging | |
| from functools import wraps | |
| from typing import Callable | |
| def log_io(log_input=False, log_output=False) -> Callable: | |
| """ | |
| Logs the input/output of the decorated method. | |
| Must be explicitly called with input=True and/or output=True |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import re | |
| from django.utils.text import force_text | |
| from django.utils.safestring import mark_safe | |
| from django.utils.functional import allow_lazy | |
| def snake_case(value): | |
| """ | |
| Converts spaces to underscore. Removes characters that | |
| aren't alphanumerics, underscores, or hyphens. Converts to lowercase. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from HTMLParser import HTMLParser | |
| from django.core.exceptions import ObjectDoesNotExist | |
| from django.template import Context | |
| from django.test import RequestFactory | |
| from cms.models import Title | |
| class MLStripper(HTMLParser): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function AjaxHandler() { | |
| this.init = function(config) { | |
| this.config = config; | |
| this.bindEvents(); | |
| }; | |
| this.hideFormErrors = function($form) { | |
| $.each($form.find(':input.required.error'), function(index, field) { | |
| $form.find(field) | |
| .removeClass('required error') |