tiramisu_json_api => tiramisu_api

This commit is contained in:
Emmanuel Garette 2019-07-28 22:49:52 +02:00
parent f2d5ad4f30
commit 5722fbfaa8
8 changed files with 19 additions and 19 deletions

View File

@ -3,17 +3,17 @@
from setuptools import setup, find_packages from setuptools import setup, find_packages
import tiramisu_json_api import tiramisu_api
setup( setup(
name='tiramisu_json_api', name='tiramisu_api',
version=tiramisu_json_api.__version__, version=tiramisu_api.__version__,
packages=find_packages(), packages=find_packages(),
author="Emmanuel Garette & Tiramisu Team", author="Emmanuel Garette & Tiramisu Team",
description="A subset of Tiramisu API that works remotly with tiramisu-json", description="A subset of Tiramisu API.",
long_description=open('README.md').read(), long_description=open('README.md').read(),
include_package_data=True, include_package_data=True,
url='https://framagit.org/tiramisu/tiramisu-json-api', url='https://framagit.org/tiramisu/tiramisu-api-python',
classifiers=[ classifiers=[
"Programming Language :: Python", "Programming Language :: Python",

View File

@ -6,9 +6,9 @@ import pytest
# import warnings # import warnings
# from tiramisu.error import ValueWarning # from tiramisu.error import ValueWarning
from tiramisu_json_api import Config from tiramisu_api import Config
from tiramisu_json_api.error import PropertiesOptionError from tiramisu_api.error import PropertiesOptionError
from tiramisu_json_api.setting import undefined from tiramisu_api.setting import undefined
# warnings.simplefilter("always", ValueWarning) # warnings.simplefilter("always", ValueWarning)

View File

@ -1,5 +1,5 @@
from json import loads from json import loads
from tiramisu_json_api import Config from tiramisu_api import Config
def test_list_option(): def test_list_option():

View File

@ -1,5 +1,5 @@
from .api import Config from .api import Config
__version__ = "0.0.1" __version__ = "0.1"
__all__ = ('Config',) __all__ = ('Config',)

View File

@ -9,7 +9,7 @@ from .setting import undefined
from .i18n import _ from .i18n import _
TIRAMISU_JSON_VERSION = '1.0' TIRAMISU_FORMAT = '1.0'
DEBUG = False DEBUG = False
@ -637,22 +637,22 @@ class ContextValue(_Value):
class Config: class Config:
# config # config
def __init__(self, def __init__(self,
json): dico):
if DEBUG: if DEBUG:
from pprint import pprint from pprint import pprint
pprint(json) pprint(dico)
if json.get('version') != TIRAMISU_JSON_VERSION: if dico.get('version') != TIRAMISU_FORMAT:
raise Exception('incompatible tiramisu-json format version (got {}, expected {})'.format(json.get('version', '0.0'), TIRAMISU_JSON_VERSION)) raise Exception('incompatible version of tiramisu (got {}, expected {})'.format(dico.get('version', '0.0'), TIRAMISU_FORMAT))
self.model = json.get('model') self.model = dico.get('model')
self.global_model = json.get('global') self.global_model = dico.get('global')
self.form = json.get('form') self.form = dico.get('form')
# support pattern # support pattern
if self.form: if self.form:
for key, option in self.form.items(): for key, option in self.form.items():
if key != 'null' and 'pattern' in option: if key != 'null' and 'pattern' in option:
option['pattern'] = re.compile(option['pattern']) option['pattern'] = re.compile(option['pattern'])
self.temp = {} self.temp = {}
self.schema = json.get('schema') self.schema = dico.get('schema')
self.updates = [] self.updates = []
if self.schema: if self.schema:
first_path = next(iter(self.schema.keys())) first_path = next(iter(self.schema.keys()))