Skip to content

Instantly share code, notes, and snippets.

View prokoptsev's full-sized avatar

Alexey Prokoptsev prokoptsev

View GitHub Profile
# source: https://groups.google.com/forum/#!topic/wtforms/ur84vD5S66Y
# Not exactly, but there are multiple ways to do this in WTForms that
# are different, each with its own advantages.
# Old Method: For two completely different forms which you want to
# validate entirely separately, you can create two form instances, each
# with their own prefix. This was the only way prior to WTForms 0.4 or
# thereabouts, to run multiple forms.
#!/usr/bin/env python
# codeing: utf-8
import readline
import shlex
if __name__ == '__main__':
print 'Enter a command to do something, e.g. `create name price`.'
print 'To get help, enter `help`.'
'''
***
Modified generic daemon class
***
Author: http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/www.boxedice.com
License: http://creativecommons.org/licenses/by-sa/3.0/
Changes: 23rd Jan 2009 (David Mytton <david@boxedice.com>)
- Replaced hard coded '/dev/null in __init__ with os.devnull
- Added OS check to conditionally remove code that doesn't
#!/usr/bin/env python2
# coding: utf-8
from __future__ import unicode_literals
import sys
import string
import textwrap
import webbrowser
from urlparse import urlparse
from argparse import ArgumentParser, RawDescriptionHelpFormatter
@prokoptsev
prokoptsev / upprint.py
Created February 29, 2016 13:42 — forked from shvechikov/upprint.py
UnicodePrettyPrinter
# -*- coding: utf-8 -*-
import sys
from pprint import PrettyPrinter
class UnicodePrettyPrinter(PrettyPrinter):
"""Unicode-friendly PrettyPrinter
Prints:
- u'привет' instead of u'\u043f\u0440\u0438\u0432\u0435\u0442'