# Path: lingobarter/core/db.py



import json
from flask.ext.babelex import lazy_gettext
from lingobarter.core.db import db

def default_formatter(value):
    return value


class CustomValue(db.EmbeddedDocument):
    FORMATS = (
        ('json', "json"),
        ('text', "text"),
        ('int', "int"),
        ('float', "float"),
    )

    DEFAULT_FORMATTER = default_formatter

    FORMATTERS = {
        'json': json.loads,
        'text': DEFAULT_FORMATTER,
        'int': int,
        'float': float
    }

    REVERSE_FORMATTERS = {
        'json': lambda val: val if isinstance(val, str) else json.dumps(val),
        'text': DEFAULT_FORMATTER,
        'int': DEFAULT_FORMATTER,
        'float': DEFAULT_FORMATTER
    }

    name = db.StringField(max_length=50, required=True)

# Path: lingobarter/core/db.py



# Path: lingobarter/core/models/custom_values.py
import json
from flask.ext.babelex import lazy_gettext
from lingobarter.core.db import db


def default_formatter(value):
    return value


class CustomValue(db.EmbeddedDocument):
    FORMATS = (
        ('json', "json"),
        ('text', "text"),
        ('int', "int"),
        ('float', "float"),
    )

    DEFAULT_FORMATTER = default_formatter

    FORMATTERS = {
        'json': json.loads,
        'text': DEFAULT_FORMATTER,
        'int': int,
        'float': float
    }

    REVERSE_FORMATTERS = {
        'json': lambda val: val if isinstance(val, str) else json.dumps(val),
        'text': DEFAULT_FORMATTER,
        'int': DEFAULT_FORMATTER,
        'float': DEFAULT_FORMATTER
    }

    name = db.StringField(max_length=50, required=True)

    rawvalue = db.StringField(verbose_name=lazy_gettext("Value"),