This file contains 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
#!/usr/bin/env python3 | |
# coding: utf-8 | |
# source code from https://github.com/dainan13/py-aluminium/blob/master/src/easyprint.py | |
# modified by [email protected] for python3.X support. | |
from __future__ import print_function | |
import types | |
import unicodedata | |
import re |
This file contains 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
def safeunicode(obj, encoding='utf-8'): | |
r"""s | |
Converts any given object to unicode string. | |
>>> safeunicode('hello') | |
u'hello' | |
>>> safeunicode(2) | |
u'2' | |
>>> safeunicode('\xe1\x88\xb4') | |
u'\u1234' |
This file contains 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
#!/usr/bin/env python | |
# ftpserver.py | |
# | |
# pyftpdlib is released under the MIT license, reproduced below: | |
# ====================================================================== | |
# Copyright (C) 2007 Giampaolo Rodola' <[email protected]> | |
# | |
# All Rights Reserved | |
# | |
# Permission to use, copy, modify, and distribute this software and |
This file contains 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
# use tornado's formatter out of tornado | |
try: | |
from tornado.options import _LogFormatter as Fmt # tornado 2.2 | |
except: | |
from tornado.log import LogFormatter as Fmt # toando 2.4 | |
class TornadoFormatter(Fmt): | |
''' require toanado installed | |
usuage: | |
use it as an ordinary LogFormatter |