config.py 435 B

123456789101112131415161718192021
  1. import os
  2. import sys
  3. import playhouse.sqlite_ext
  4. DB = playhouse.sqlite_ext.SqliteExtDatabase(None)
  5. PER_PAGE = 50
  6. if sys.stderr.isatty():
  7. def log(msg, *args, **kwargs):
  8. sys.stderr.write(msg.format(*args, **kwargs))
  9. sys.stderr.write("\n")
  10. else:
  11. def log(msg, *args, **kwargs):
  12. sys.stderr.write("\x1b[31m")
  13. sys.stderr.write(msg.format(*args, **kwargs))
  14. sys.stderr.write("\x1b[39m\n")