1
2
3
4
5
6 version_info = (0, 5, 4)
7 __version__ = ".".join(map(str, version_info))
8
9 try:
10 from .resource import RequestFailed,CouchdbResource
11
12 from .exceptions import InvalidAttachment, DuplicatePropertyError,\
13 BadValueError, MultipleResultsFound, NoResultFound, ReservedWordError,\
14 DocsPathNotFound, BulkSaveError, ResourceNotFound, ResourceConflict, \
15 PreconditionFailed
16
17 from .client import Server, Database, ViewResults, View, TempView
18 from .consumer import Consumer
19 from .designer import document, push, pushdocs, pushapps, clone
20 from .external import External
21 from .loaders import BaseDocsLoader, FileSystemDocsLoader
22
23 from .schema import Property, Property, IntegerProperty,\
24 DecimalProperty, BooleanProperty, FloatProperty, DateTimeProperty,\
25 DateProperty, TimeProperty, dict_to_json, dict_to_json, dict_to_json,\
26 value_to_python, dict_to_python, DocumentSchema, DocumentBase, Document,\
27 StaticDocument, QueryMixin, AttachmentMixin, SchemaProperty, SchemaListProperty,\
28 SchemaDictProperty, \
29 ListProperty, DictProperty, StringListProperty, contain, StringProperty
30
31 except ImportError:
32 import traceback
33 traceback.print_exc()
34
35 import logging
36
37 LOG_LEVELS = {
38 "critical": logging.CRITICAL,
39 "error": logging.ERROR,
40 "warning": logging.WARNING,
41 "info": logging.INFO,
42 "debug": logging.DEBUG
43 }
44
46 """
47 Set level of logging, and choose where to display/save logs
48 (file or standard output).
49 """
50 if not handler:
51 handler = logging.StreamHandler()
52
53 loglevel = LOG_LEVELS.get(level, logging.INFO)
54 logger = logging.getLogger('couchdbkit')
55 logger.setLevel(loglevel)
56 format = r"%(asctime)s [%(process)d] [%(levelname)s] %(message)s"
57 datefmt = r"%Y-%m-%d %H:%M:%S"
58
59 handler.setFormatter(logging.Formatter(format, datefmt))
60 logger.addHandler(handler)
61