From e4dd1a25d01e6374dd58a2c29cdde166574ebd96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 8 Jun 2012 19:04:41 +0200 Subject: [PATCH] Remove hexmd5 from ModelView.fields_view_get review366001 --- CHANGELOG | 1 + doc/ref/models/models.rst | 4 +--- trytond/model/modelview.py | 17 +---------------- 3 files changed, 3 insertions(+), 19 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 6c5ed833f7..4e35c91b5e 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,4 @@ +* Remove hexmd5 from ModelView.fields_view_get * Allow client to manage model access * Add time format validation * Remove ModelSQL.default_sequence diff --git a/doc/ref/models/models.rst b/doc/ref/models/models.rst index 2c02ac3bb7..2a24c3a72d 100644 --- a/doc/ref/models/models.rst +++ b/doc/ref/models/models.rst @@ -119,7 +119,7 @@ Static methods: Instance methods: -.. method:: ModelView.fields_view_get([view_id[, view_type[, toolbar[, hexmd5]]]]) +.. method:: ModelView.fields_view_get([view_id[, view_type[, toolbar]]]) Return a view definition used by the client. The definition is:: @@ -142,8 +142,6 @@ Instance methods: ... ], }, - ''md5': { - }, } .. method:: ModelView.view_header_get(value[, view_type]) diff --git a/trytond/model/modelview.py b/trytond/model/modelview.py index 1d10f8f742..6bacf83435 100644 --- a/trytond/model/modelview.py +++ b/trytond/model/modelview.py @@ -1,11 +1,6 @@ #This file is part of Tryton. The COPYRIGHT file at the top level of #this repository contains the full copyright notices and license terms. from lxml import etree -try: - import hashlib -except ImportError: - hashlib = None - import md5 from functools import wraps from trytond.model import Model from trytond.tools import safe_eval @@ -101,19 +96,16 @@ class ModelView(Model): self._buttons = {} @Cache('modelview.fields_view_get') - def fields_view_get(self, view_id=None, view_type='form', hexmd5=None): + def fields_view_get(self, view_id=None, view_type='form'): ''' Return a view definition. :param view_id: the id of the view, if None the first one will be used :param view_type: the type of the view if view_id is None - :param hexmd5: if filled, the function will return True if the result - has the same md5 :return: a dictionary with keys: - model: the model name - arch: the xml description of the view - fields: a dictionary with the definition of each field in the view - - md5: the check sum of the dictionary without this checksum ''' result = {'model': self._name} pool = Pool() @@ -227,13 +219,6 @@ class ModelView(Model): result['arch'] = xarch result['fields'] = xfields - # Compute md5 - if hashlib: - result['md5'] = hashlib.md5(str(result)).hexdigest() - else: - result['md5'] = md5.new(str(result)).hexdigest() - if hexmd5 == result['md5']: - return True return result @Cache('modelview.view_toolbar_get')