# Path: pydal/_compat.py
# PY2 = sys.version_info[0] == 2
#     def implements_bool(cls):
#     def implements_iterator(cls):
#     def to_bytes(obj, charset="utf-8", errors="strict"):
#     def to_native(obj, charset="utf8", errors="strict"):
#     def to_bytes(obj, charset="utf-8", errors="strict"):
#     def to_native(obj, charset="utf8", errors="strict"):
# def with_metaclass(meta, *bases):
#         def __new__(cls, name, this_bases, d):
# def to_unicode(obj, charset="utf-8", errors="strict"):
#     class metaclass(meta):
# 
# Path: pydal/helpers/serializers.py
# class Serializers(object):
#     def _json_parse(self, o):
#     def __getattr__(self, name):
#     def json(self, value):
#     def yaml(self, value):


import copy
import marshal
import struct
import threading
import time
import traceback
            import types
from .._compat import (
    PY2,
    exists,
    copyreg,
    implements_bool,
    iterkeys,
    itervalues,
    iteritems,
    to_bytes,
    long,
)
from .._globals import THREAD_LOCAL
from .serializers import serializers
        colset, db, tablename, id = self.colset, self.db, self.tablename, self.id
        table = db[tablename]
        newfields = fields or dict(colset)
        for fieldname in list(newfields.keys()):
            if fieldname not in table.fields or table[fieldname].type == "id":
                del newfields[fieldname]
        table._db(table._id == id, ignore_common_filters=True).update(**newfields)
        colset.update(newfields)
        return colset


class RecordDeleter(RecordOperator):
    def __call__(self):
        return self.db(self.db[self.tablename]._id == self.id).delete()


class MethodAdder(object):
    def __init__(self, table):
        self.table = table

    def __call__(self):
        return self.register()

    def __getattr__(self, method_name):
        return self.register(method_name)

    def register(self, method_name=None):
        def _decorated(f):
            instance = self.table


# Path: pydal/_compat.py
# PY2 = sys.version_info[0] == 2
#     def implements_bool(cls):
#     def implements_iterator(cls):
#     def to_bytes(obj, charset="utf-8", errors="strict"):
#     def to_native(obj, charset="utf8", errors="strict"):
#     def to_bytes(obj, charset="utf-8", errors="strict"):
#     def to_native(obj, charset="utf8", errors="strict"):
# def with_metaclass(meta, *bases):
#         def __new__(cls, name, this_bases, d):
# def to_unicode(obj, charset="utf-8", errors="strict"):
#     class metaclass(meta):
# 
# Path: pydal/helpers/serializers.py
# class Serializers(object):
#     def _json_parse(self, o):
#     def __getattr__(self, name):
#     def json(self, value):
#     def yaml(self, value):


# Path: pydal/helpers/classes.py
import copy
import marshal
import struct
import threading
import time
import traceback
            import types
from .._compat import (
    PY2,
    exists,
    copyreg,
    implements_bool,
    iterkeys,
    itervalues,
    iteritems,
    to_bytes,
    long,
)
from .._globals import THREAD_LOCAL
from .serializers import serializers

        colset, db, tablename, id = self.colset, self.db, self.tablename, self.id
        table = db[tablename]
        newfields = fields or dict(colset)
        for fieldname in list(newfields.keys()):
            if fieldname not in table.fields or table[fieldname].type == "id":
                del newfields[fieldname]
        table._db(table._id == id, ignore_common_filters=True).update(**newfields)
        colset.update(newfields)
        return colset


class RecordDeleter(RecordOperator):
    def __call__(self):
        return self.db(self.db[self.tablename]._id == self.id).delete()


class MethodAdder(object):
    def __init__(self, table):
        self.table = table

    def __call__(self):
        return self.register()

    def __getattr__(self, method_name):
        return self.register(method_name)

    def register(self, method_name=None):
        def _decorated(f):
            instance = self.table


            if PY2: