2008-07-23 15:01:27 +00:00
# -*- encoding: utf-8 -*-
2006-12-07 13:41:40 +00:00
##############################################################################
#
2008-11-25 07:07:40 +00:00
# OpenERP, Open Source Management Solution
2009-01-04 22:13:29 +00:00
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
2008-11-03 18:27:16 +00:00
# $Id$
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
2006-12-07 13:41:40 +00:00
#
##############################################################################
# . Fields:
# - simple
# - relations (one2many, many2one, many2many)
# - function
#
# Fields Attributes:
# _classic_read: is a classic sql fields
# _type : field type
# readonly
# required
# size
#
import string
import netsvc
2009-02-05 23:43:52 +00:00
import sys
2006-12-07 13:41:40 +00:00
2008-12-08 14:03:42 +00:00
from psycopg2 import Binary
2006-12-07 13:41:40 +00:00
import warnings
2007-04-23 13:13:47 +00:00
import tools
2008-08-12 14:44:56 +00:00
2006-12-07 13:41:40 +00:00
def _symbol_set ( symb ) :
2008-08-12 14:44:56 +00:00
if symb == None or symb == False :
2008-07-22 14:24:36 +00:00
return None
elif isinstance ( symb , unicode ) :
return symb . encode ( ' utf-8 ' )
return str ( symb )
2006-12-07 13:41:40 +00:00
2008-08-12 14:44:56 +00:00
2006-12-07 13:41:40 +00:00
class _column ( object ) :
2008-07-22 14:24:36 +00:00
_classic_read = True
_classic_write = True
2009-08-20 15:29:21 +00:00
_prefetch = True
2008-07-22 14:24:36 +00:00
_properties = False
_type = ' unknown '
_obj = None
2008-08-17 18:28:29 +00:00
_multi = False
2008-07-22 14:24:36 +00:00
_symbol_c = ' %s '
_symbol_f = _symbol_set
_symbol_set = ( _symbol_c , _symbol_f )
_symbol_get = None
def __init__ ( self , string = ' unknown ' , required = False , readonly = False , domain = None , context = ' ' , states = None , priority = 0 , change_default = False , size = None , ondelete = " set null " , translate = False , select = False , * * args ) :
self . states = states or { }
self . string = string
self . readonly = readonly
self . required = required
self . size = size
self . help = args . get ( ' help ' , ' ' )
self . priority = priority
self . change_default = change_default
self . ondelete = ondelete
self . translate = translate
self . _domain = domain or [ ]
self . _context = context
self . write = False
self . read = False
self . view_load = 0
2008-08-12 14:44:56 +00:00
self . select = select
2008-07-22 14:24:36 +00:00
for a in args :
if args [ a ] :
setattr ( self , a , args [ a ] )
def restart ( self ) :
pass
def set ( self , cr , obj , id , name , value , user = None , context = None ) :
2008-12-09 13:35:40 +00:00
cr . execute ( ' update ' + obj . _table + ' set ' + name + ' = ' + self . _symbol_set [ 0 ] + ' where id= %s ' , ( self . _symbol_set [ 1 ] ( value ) , id ) )
2008-08-12 14:44:56 +00:00
2008-07-22 14:24:36 +00:00
def set_memory ( self , cr , obj , id , name , value , user = None , context = None ) :
2008-08-12 14:44:56 +00:00
raise Exception ( _ ( ' Not implemented set_memory method ! ' ) )
2008-07-22 14:24:36 +00:00
2008-08-29 13:08:14 +00:00
def get_memory ( self , cr , obj , ids , name , user = None , context = None , values = None ) :
2008-08-12 14:44:56 +00:00
raise Exception ( _ ( ' Not implemented get_memory method ! ' ) )
2008-08-29 13:08:14 +00:00
def get ( self , cr , obj , ids , name , user = None , offset = 0 , context = None , values = None ) :
2008-08-12 14:44:56 +00:00
raise Exception ( _ ( ' undefined get method ! ' ) )
2008-07-22 14:24:36 +00:00
def search ( self , cr , obj , args , name , value , offset = 0 , limit = None , uid = None ) :
2008-08-12 14:44:56 +00:00
ids = obj . search ( cr , uid , args + self . _domain + [ ( name , ' ilike ' , value ) ] , offset , limit )
2008-07-22 14:24:36 +00:00
res = obj . read ( cr , uid , ids , [ name ] )
return [ x [ name ] for x in res ]
2008-08-12 14:44:56 +00:00
2008-07-22 14:24:36 +00:00
def search_memory ( self , cr , obj , args , name , value , offset = 0 , limit = None , uid = None , context = None ) :
2008-08-12 14:44:56 +00:00
raise Exception ( _ ( ' Not implemented search_memory method ! ' ) )
2006-12-07 13:41:40 +00:00
# ---------------------------------------------------------
# Simple fields
# ---------------------------------------------------------
class boolean ( _column ) :
2008-07-22 14:24:36 +00:00
_type = ' boolean '
_symbol_c = ' %s '
_symbol_f = lambda x : x and ' True ' or ' False '
_symbol_set = ( _symbol_c , _symbol_f )
2006-12-07 13:41:40 +00:00
2008-08-12 14:44:56 +00:00
2008-10-25 08:53:56 +00:00
class integer_big ( _column ) :
_type = ' integer_big '
2008-12-09 13:35:40 +00:00
_symbol_c = ' %s '
2008-10-25 08:53:56 +00:00
_symbol_f = lambda x : int ( x or 0 )
_symbol_set = ( _symbol_c , _symbol_f )
2006-12-07 13:41:40 +00:00
class integer ( _column ) :
2008-07-22 14:24:36 +00:00
_type = ' integer '
2008-12-09 13:35:40 +00:00
_symbol_c = ' %s '
2008-07-22 14:24:36 +00:00
_symbol_f = lambda x : int ( x or 0 )
_symbol_set = ( _symbol_c , _symbol_f )
2006-12-07 13:41:40 +00:00
2008-08-12 14:44:56 +00:00
2006-12-07 13:41:40 +00:00
class reference ( _column ) :
2008-07-22 14:24:36 +00:00
_type = ' reference '
2008-08-12 14:44:56 +00:00
2008-07-22 14:24:36 +00:00
def __init__ ( self , string , selection , size , * * args ) :
_column . __init__ ( self , string = string , size = size , selection = selection , * * args )
2006-12-07 13:41:40 +00:00
2008-08-12 14:44:56 +00:00
2006-12-07 13:41:40 +00:00
class char ( _column ) :
2008-07-22 14:24:36 +00:00
_type = ' char '
2008-08-12 14:44:56 +00:00
2008-07-22 14:24:36 +00:00
def __init__ ( self , string , size , * * args ) :
_column . __init__ ( self , string = string , size = size , * * args )
self . _symbol_set = ( self . _symbol_c , self . _symbol_set_char )
2008-08-12 14:44:56 +00:00
2008-07-22 14:24:36 +00:00
# takes a string (encoded in utf8) and returns a string (encoded in utf8)
def _symbol_set_char ( self , symb ) :
2008-08-12 14:44:56 +00:00
#TODO:
# * we need to remove the "symb==False" from the next line BUT
2008-07-22 14:24:36 +00:00
# for now too many things rely on this broken behavior
# * the symb==None test should be common to all data types
2008-08-12 14:44:56 +00:00
if symb == None or symb == False :
2008-07-22 14:24:36 +00:00
return None
2008-08-12 14:44:56 +00:00
# we need to convert the string to a unicode object to be able
2008-07-22 14:24:36 +00:00
# to evaluate its length (and possibly truncate it) reliably
2009-02-12 13:32:52 +00:00
u_symb = tools . ustr ( symb )
2008-11-24 16:22:47 +00:00
return u_symb [ : self . size ] . encode ( ' utf8 ' )
2006-12-07 13:41:40 +00:00
2008-08-12 14:44:56 +00:00
2006-12-07 13:41:40 +00:00
class text ( _column ) :
2008-07-22 14:24:36 +00:00
_type = ' text '
2006-12-07 13:41:40 +00:00
import __builtin__
class float ( _column ) :
2008-07-22 14:24:36 +00:00
_type = ' float '
2008-12-09 13:35:40 +00:00
_symbol_c = ' %s '
2008-07-22 14:24:36 +00:00
_symbol_f = lambda x : __builtin__ . float ( x or 0.0 )
_symbol_set = ( _symbol_c , _symbol_f )
2008-08-12 14:44:56 +00:00
2008-07-22 14:24:36 +00:00
def __init__ ( self , string = ' unknown ' , digits = None , * * args ) :
_column . __init__ ( self , string = string , * * args )
self . digits = digits
2006-12-07 13:41:40 +00:00
2008-08-12 14:44:56 +00:00
2006-12-07 13:41:40 +00:00
class date ( _column ) :
2008-07-22 14:24:36 +00:00
_type = ' date '
2006-12-07 13:41:40 +00:00
2008-08-12 14:44:56 +00:00
2006-12-07 13:41:40 +00:00
class datetime ( _column ) :
2008-07-22 14:24:36 +00:00
_type = ' datetime '
2006-12-07 13:41:40 +00:00
2008-08-12 14:44:56 +00:00
2006-12-07 13:41:40 +00:00
class time ( _column ) :
2008-07-22 14:24:36 +00:00
_type = ' time '
2006-12-07 13:41:40 +00:00
2008-08-12 14:44:56 +00:00
2006-12-07 13:41:40 +00:00
class binary ( _column ) :
2008-07-22 14:24:36 +00:00
_type = ' binary '
_symbol_c = ' %s '
2008-12-08 14:03:42 +00:00
_symbol_f = lambda symb : symb and Binary ( symb ) or None
2008-07-22 14:24:36 +00:00
_symbol_set = ( _symbol_c , _symbol_f )
2008-12-14 16:46:47 +00:00
_symbol_get = lambda self , x : x and str ( x )
2006-12-07 13:41:40 +00:00
2008-08-29 13:08:14 +00:00
_classic_read = False
2009-08-20 15:29:21 +00:00
_prefetch = False
2008-09-16 07:31:23 +00:00
def __init__ ( self , string = ' unknown ' , filters = None , * * args ) :
_column . __init__ ( self , string = string , * * args )
self . filters = filters
2008-08-29 13:08:14 +00:00
def get_memory ( self , cr , obj , ids , name , user = None , context = None , values = None ) :
if not context :
context = { }
if not values :
values = [ ]
res = { }
for i in ids :
val = None
for v in values :
if v [ ' id ' ] == i :
val = v [ name ]
break
2009-02-04 06:51:26 +00:00
if context . get ( ' bin_size ' , False ) and val :
2009-02-03 21:58:14 +00:00
res [ i ] = tools . human_size ( long ( val ) )
2008-12-14 16:46:47 +00:00
else :
res [ i ] = val
2008-08-29 13:08:14 +00:00
return res
get = get_memory
2008-08-12 14:44:56 +00:00
2008-10-07 14:19:11 +00:00
2006-12-07 13:41:40 +00:00
class selection ( _column ) :
2008-07-22 14:24:36 +00:00
_type = ' selection '
2008-08-12 14:44:56 +00:00
2008-07-22 14:24:36 +00:00
def __init__ ( self , selection , string = ' unknown ' , * * args ) :
_column . __init__ ( self , string = string , * * args )
self . selection = selection
2006-12-07 13:41:40 +00:00
# ---------------------------------------------------------
# Relationals fields
# ---------------------------------------------------------
#
# Values: (0, 0, { fields }) create
# (1, ID, { fields }) modification
# (2, ID) remove (delete)
# (3, ID) unlink one (target id or target of relation)
# (4, ID) link
# (5) unlink all (only valid for one2many)
#
#CHECKME: dans la pratique c'est quoi la syntaxe utilisee pour le 5? (5) ou (5, 0)?
class one2one ( _column ) :
2008-07-22 14:24:36 +00:00
_classic_read = False
_classic_write = True
_type = ' one2one '
2008-08-12 14:44:56 +00:00
2008-07-22 14:24:36 +00:00
def __init__ ( self , obj , string = ' unknown ' , * * args ) :
warnings . warn ( " The one2one field doesn ' t work anymore " , DeprecationWarning )
_column . __init__ ( self , string = string , * * args )
self . _obj = obj
def set ( self , cr , obj_src , id , field , act , user = None , context = None ) :
if not context :
2008-08-12 14:44:56 +00:00
context = { }
2008-07-22 14:24:36 +00:00
obj = obj_src . pool . get ( self . _obj )
self . _table = obj_src . pool . get ( self . _obj ) . _table
2008-08-12 14:44:56 +00:00
if act [ 0 ] == 0 :
2008-07-22 14:24:36 +00:00
id_new = obj . create ( cr , user , act [ 1 ] )
2008-12-09 13:35:40 +00:00
cr . execute ( ' update ' + obj_src . _table + ' set ' + field + ' = %s where id= %s ' , ( id_new , id ) )
2008-07-22 14:24:36 +00:00
else :
2008-12-09 13:35:40 +00:00
cr . execute ( ' select ' + field + ' from ' + obj_src . _table + ' where id= %s ' , ( act [ 0 ] , ) )
2008-08-12 14:44:56 +00:00
id = cr . fetchone ( ) [ 0 ]
obj . write ( cr , user , [ id ] , act [ 1 ] , context = context )
2008-07-22 14:24:36 +00:00
def search ( self , cr , obj , args , name , value , offset = 0 , limit = None , uid = None ) :
2008-08-12 14:44:56 +00:00
return obj . pool . get ( self . _obj ) . search ( cr , uid , args + self . _domain + [ ( ' name ' , ' like ' , value ) ] , offset , limit )
2006-12-07 13:41:40 +00:00
class many2one ( _column ) :
2008-07-22 14:24:36 +00:00
_classic_read = False
_classic_write = True
_type = ' many2one '
2008-12-14 16:46:47 +00:00
_symbol_c = ' %s '
_symbol_f = lambda x : x or None
_symbol_set = ( _symbol_c , _symbol_f )
2008-08-12 14:44:56 +00:00
2008-07-22 14:24:36 +00:00
def __init__ ( self , obj , string = ' unknown ' , * * args ) :
_column . __init__ ( self , string = string , * * args )
self . _obj = obj
2008-12-18 09:50:58 +00:00
def set_memory ( self , cr , obj , id , field , values , user = None , context = None ) :
obj . datas . setdefault ( id , { } )
obj . datas [ id ] [ field ] = values
2008-07-22 14:24:36 +00:00
def get_memory ( self , cr , obj , ids , name , user = None , context = None , values = None ) :
result = { }
for id in ids :
result [ id ] = obj . datas [ id ] [ name ]
return result
def get ( self , cr , obj , ids , name , user = None , context = None , values = None ) :
if not context :
2008-08-12 14:44:56 +00:00
context = { }
2008-07-22 14:24:36 +00:00
if not values :
2008-08-12 14:44:56 +00:00
values = { }
2008-07-22 14:24:36 +00:00
res = { }
for r in values :
res [ r [ ' id ' ] ] = r [ name ]
for id in ids :
res . setdefault ( id , ' ' )
obj = obj . pool . get ( self . _obj )
# build a dictionary of the form {'id_of_distant_resource': name_of_distant_resource}
from orm import except_orm
try :
names = dict ( obj . name_get ( cr , user , filter ( None , res . values ( ) ) , context ) )
except except_orm :
2008-08-12 14:44:56 +00:00
names = { }
2008-07-22 14:24:36 +00:00
iids = filter ( None , res . values ( ) )
2009-02-27 16:37:20 +00:00
for iiid in iids :
names [ iiid ] = ' // Access Denied // '
2008-07-22 14:24:36 +00:00
for r in res . keys ( ) :
if res [ r ] and res [ r ] in names :
res [ r ] = ( res [ r ] , names [ res [ r ] ] )
else :
res [ r ] = False
return res
def set ( self , cr , obj_src , id , field , values , user = None , context = None ) :
if not context :
2008-08-12 14:44:56 +00:00
context = { }
2008-07-22 14:24:36 +00:00
obj = obj_src . pool . get ( self . _obj )
self . _table = obj_src . pool . get ( self . _obj ) . _table
2008-10-07 14:19:11 +00:00
if type ( values ) == type ( [ ] ) :
2008-07-22 14:24:36 +00:00
for act in values :
2008-08-12 14:44:56 +00:00
if act [ 0 ] == 0 :
2008-07-22 14:24:36 +00:00
id_new = obj . create ( cr , act [ 2 ] )
2008-12-09 13:35:40 +00:00
cr . execute ( ' update ' + obj_src . _table + ' set ' + field + ' = %s where id= %s ' , ( id_new , id ) )
2008-08-12 14:44:56 +00:00
elif act [ 0 ] == 1 :
2008-07-22 14:24:36 +00:00
obj . write ( cr , [ act [ 1 ] ] , act [ 2 ] , context = context )
2008-08-12 14:44:56 +00:00
elif act [ 0 ] == 2 :
2008-12-09 13:35:40 +00:00
cr . execute ( ' delete from ' + self . _table + ' where id= %s ' , ( act [ 1 ] , ) )
2008-08-12 14:44:56 +00:00
elif act [ 0 ] == 3 or act [ 0 ] == 5 :
2008-12-09 13:35:40 +00:00
cr . execute ( ' update ' + obj_src . _table + ' set ' + field + ' =null where id= %s ' , ( id , ) )
2008-08-12 14:44:56 +00:00
elif act [ 0 ] == 4 :
2008-12-09 13:35:40 +00:00
cr . execute ( ' update ' + obj_src . _table + ' set ' + field + ' = %s where id= %s ' , ( act [ 1 ] , id ) )
2008-07-22 14:24:36 +00:00
else :
if values :
2008-12-09 13:35:40 +00:00
cr . execute ( ' update ' + obj_src . _table + ' set ' + field + ' = %s where id= %s ' , ( values , id ) )
2008-07-22 14:24:36 +00:00
else :
2008-12-09 13:35:40 +00:00
cr . execute ( ' update ' + obj_src . _table + ' set ' + field + ' =null where id= %s ' , ( id , ) )
2008-07-22 14:24:36 +00:00
def search ( self , cr , obj , args , name , value , offset = 0 , limit = None , uid = None ) :
2008-08-12 14:44:56 +00:00
return obj . pool . get ( self . _obj ) . search ( cr , uid , args + self . _domain + [ ( ' name ' , ' like ' , value ) ] , offset , limit )
2006-12-07 13:41:40 +00:00
2008-06-15 14:59:23 +00:00
class one2many ( _column ) :
2008-07-22 14:24:36 +00:00
_classic_read = False
_classic_write = False
2009-08-20 15:29:21 +00:00
_prefetch = False
2008-07-22 14:24:36 +00:00
_type = ' one2many '
2008-08-12 14:44:56 +00:00
2008-07-22 14:24:36 +00:00
def __init__ ( self , obj , fields_id , string = ' unknown ' , limit = None , * * args ) :
_column . __init__ ( self , string = string , * * args )
self . _obj = obj
self . _fields_id = fields_id
self . _limit = limit
#one2many can't be used as condition for defaults
assert ( self . change_default != True )
def get_memory ( self , cr , obj , ids , name , user = None , offset = 0 , context = None , values = None ) :
if not context :
context = { }
2009-04-06 16:05:07 +00:00
if self . _context :
context = context . copy ( )
context . update ( self . _context )
2008-07-22 14:24:36 +00:00
if not values :
values = { }
res = { }
for id in ids :
res [ id ] = [ ]
2009-04-06 16:05:07 +00:00
ids2 = obj . pool . get ( self . _obj ) . search ( cr , user , [ ( self . _fields_id , ' in ' , ids ) ] , limit = self . _limit , context = context )
2008-07-22 14:24:36 +00:00
for r in obj . pool . get ( self . _obj ) . read ( cr , user , ids2 , [ self . _fields_id ] , context = context , load = ' _classic_write ' ) :
if r [ self . _fields_id ] in res :
2008-08-12 14:44:56 +00:00
res [ r [ self . _fields_id ] ] . append ( r [ ' id ' ] )
2008-07-22 14:24:36 +00:00
return res
def set_memory ( self , cr , obj , id , field , values , user = None , context = None ) :
if not context :
2008-08-12 14:44:56 +00:00
context = { }
2009-04-06 16:05:07 +00:00
if self . _context :
context = context . copy ( )
context . update ( self . _context )
2008-07-22 14:24:36 +00:00
if not values :
return
obj = obj . pool . get ( self . _obj )
for act in values :
2008-08-12 14:44:56 +00:00
if act [ 0 ] == 0 :
2008-07-22 14:24:36 +00:00
act [ 2 ] [ self . _fields_id ] = id
obj . create ( cr , user , act [ 2 ] , context = context )
2008-08-12 14:44:56 +00:00
elif act [ 0 ] == 1 :
obj . write ( cr , user , [ act [ 1 ] ] , act [ 2 ] , context = context )
elif act [ 0 ] == 2 :
2008-07-22 14:24:36 +00:00
obj . unlink ( cr , user , [ act [ 1 ] ] , context = context )
2008-08-12 14:44:56 +00:00
elif act [ 0 ] == 3 :
2008-07-22 14:24:36 +00:00
obj . datas [ act [ 1 ] ] [ self . _fields_id ] = False
2008-08-12 14:44:56 +00:00
elif act [ 0 ] == 4 :
2008-07-22 14:24:36 +00:00
obj . datas [ act [ 1 ] ] = id
2008-08-12 14:44:56 +00:00
elif act [ 0 ] == 5 :
2008-07-22 14:24:36 +00:00
for o in obj . datas . values ( ) :
2008-08-12 14:44:56 +00:00
if o [ self . _fields_id ] == id :
2008-07-22 14:24:36 +00:00
o [ self . _fields_id ] = False
2008-08-12 14:44:56 +00:00
elif act [ 0 ] == 6 :
2008-07-22 14:24:36 +00:00
for id2 in ( act [ 2 ] or [ ] ) :
obj . datas [ id2 ] [ self . _fields_id ] = id
def search_memory ( self , cr , obj , args , name , value , offset = 0 , limit = None , uid = None , operator = ' like ' , context = None ) :
raise _ ( ' Not Implemented ' )
def get ( self , cr , obj , ids , name , user = None , offset = 0 , context = None , values = None ) :
if not context :
context = { }
2009-04-06 16:05:07 +00:00
if self . _context :
context = context . copy ( )
context . update ( self . _context )
2008-07-22 14:24:36 +00:00
if not values :
values = { }
res = { }
for id in ids :
res [ id ] = [ ]
2009-04-06 16:05:07 +00:00
ids2 = obj . pool . get ( self . _obj ) . search ( cr , user , [ ( self . _fields_id , ' in ' , ids ) ] , limit = self . _limit , context = context )
2008-07-22 14:24:36 +00:00
for r in obj . pool . get ( self . _obj ) . _read_flat ( cr , user , ids2 , [ self . _fields_id ] , context = context , load = ' _classic_write ' ) :
2008-08-12 14:44:56 +00:00
res [ r [ self . _fields_id ] ] . append ( r [ ' id ' ] )
2008-07-22 14:24:36 +00:00
return res
def set ( self , cr , obj , id , field , values , user = None , context = None ) :
2009-08-20 15:29:21 +00:00
result = [ ]
2008-07-22 14:24:36 +00:00
if not context :
2008-08-12 14:44:56 +00:00
context = { }
2009-04-06 16:05:07 +00:00
if self . _context :
context = context . copy ( )
context . update ( self . _context )
2009-08-20 15:29:21 +00:00
context [ ' no_store_function ' ] = True
2008-07-22 14:24:36 +00:00
if not values :
return
_table = obj . pool . get ( self . _obj ) . _table
obj = obj . pool . get ( self . _obj )
for act in values :
2008-08-12 14:44:56 +00:00
if act [ 0 ] == 0 :
2008-07-22 14:24:36 +00:00
act [ 2 ] [ self . _fields_id ] = id
2009-08-20 15:29:21 +00:00
id_new = obj . create ( cr , user , act [ 2 ] , context = context )
result + = obj . _store_get_values ( cr , user , [ id_new ] , act [ 2 ] . keys ( ) , context )
2008-08-12 14:44:56 +00:00
elif act [ 0 ] == 1 :
obj . write ( cr , user , [ act [ 1 ] ] , act [ 2 ] , context = context )
elif act [ 0 ] == 2 :
2008-07-22 14:24:36 +00:00
obj . unlink ( cr , user , [ act [ 1 ] ] , context = context )
2008-08-12 14:44:56 +00:00
elif act [ 0 ] == 3 :
2008-12-09 13:35:40 +00:00
cr . execute ( ' update ' + _table + ' set ' + self . _fields_id + ' =null where id= %s ' , ( act [ 1 ] , ) )
2008-08-12 14:44:56 +00:00
elif act [ 0 ] == 4 :
2008-12-09 13:35:40 +00:00
cr . execute ( ' update ' + _table + ' set ' + self . _fields_id + ' = %s where id= %s ' , ( id , act [ 1 ] ) )
2008-08-12 14:44:56 +00:00
elif act [ 0 ] == 5 :
2008-12-09 13:35:40 +00:00
cr . execute ( ' update ' + _table + ' set ' + self . _fields_id + ' =null where ' + self . _fields_id + ' = %s ' , ( id , ) )
2008-08-12 14:44:56 +00:00
elif act [ 0 ] == 6 :
2009-04-27 18:17:01 +00:00
obj . write ( cr , user , act [ 2 ] , { self . _fields_id : id } , context = context or { } )
ids2 = act [ 2 ] or [ 0 ]
cr . execute ( ' select id from ' + _table + ' where ' + self . _fields_id + ' = %s and id not in ( ' + ' , ' . join ( map ( str , ids2 ) ) + ' ) ' , ( id , ) )
ids3 = map ( lambda x : x [ 0 ] , cr . fetchall ( ) )
obj . write ( cr , user , ids3 , { self . _fields_id : False } , context = context or { } )
2009-08-20 15:29:21 +00:00
return result
2008-08-12 14:44:56 +00:00
2008-07-22 14:24:36 +00:00
def search ( self , cr , obj , args , name , value , offset = 0 , limit = None , uid = None , operator = ' like ' ) :
return obj . pool . get ( self . _obj ) . name_search ( cr , uid , value , self . _domain , offset , limit )
2006-12-07 13:41:40 +00:00
2008-08-12 14:44:56 +00:00
2006-12-07 13:41:40 +00:00
#
# Values: (0, 0, { fields }) create
# (1, ID, { fields }) modification
# (2, ID) remove
# (3, ID) unlink
# (4, ID) link
# (5, ID) unlink all
# (6, ?, ids) set a list of links
#
class many2many ( _column ) :
2008-07-22 14:24:36 +00:00
_classic_read = False
_classic_write = False
2009-08-20 15:29:21 +00:00
_prefetch = False
2008-07-22 14:24:36 +00:00
_type = ' many2many '
2008-08-12 14:44:56 +00:00
2008-07-22 14:24:36 +00:00
def __init__ ( self , obj , rel , id1 , id2 , string = ' unknown ' , limit = None , * * args ) :
_column . __init__ ( self , string = string , * * args )
self . _obj = obj
2008-10-28 23:33:20 +00:00
if ' . ' in rel :
raise Exception ( _ ( ' The second argument of the many2many field %s must be a SQL table ! ' \
' You used %s , which is not a valid SQL table name. ' ) % ( string , rel ) )
2008-07-22 14:24:36 +00:00
self . _rel = rel
self . _id1 = id1
self . _id2 = id2
self . _limit = limit
def get ( self , cr , obj , ids , name , user = None , offset = 0 , context = None , values = None ) :
if not context :
2008-08-12 14:44:56 +00:00
context = { }
2008-07-22 14:24:36 +00:00
if not values :
2008-08-12 14:44:56 +00:00
values = { }
2008-07-22 14:24:36 +00:00
res = { }
if not ids :
return res
for id in ids :
res [ id ] = [ ]
2008-08-12 14:44:56 +00:00
ids_s = ' , ' . join ( map ( str , ids ) )
2008-07-22 14:24:36 +00:00
limit_str = self . _limit is not None and ' limit %d ' % self . _limit or ' '
obj = obj . pool . get ( self . _obj )
d1 , d2 = obj . pool . get ( ' ir.rule ' ) . domain_get ( cr , user , obj . _name )
if d1 :
2008-10-07 14:19:11 +00:00
d1 = ' and ' + d1
2008-07-22 14:24:36 +00:00
cr . execute ( ' SELECT ' + self . _rel + ' . ' + self . _id2 + ' , ' + self . _rel + ' . ' + self . _id1 + ' \
FROM ' +self._rel+ ' , ' +obj._table+ ' \
WHERE ' +self._rel+ ' . ' +self._id1+ ' in ( ' +ids_s+ ' ) \
AND ' +self._rel+ ' . ' +self._id2+ ' = ' +obj._table+ ' . id ' +d1
2008-12-09 13:35:40 +00:00
+ limit_str + ' order by ' + obj . _table + ' . ' + obj . _order + ' offset %s ' ,
2008-07-22 14:24:36 +00:00
d2 + [ offset ] )
for r in cr . fetchall ( ) :
res [ r [ 1 ] ] . append ( r [ 0 ] )
return res
def set ( self , cr , obj , id , name , values , user = None , context = None ) :
if not context :
2008-08-12 14:44:56 +00:00
context = { }
2008-07-22 14:24:36 +00:00
if not values :
return
obj = obj . pool . get ( self . _obj )
for act in values :
2008-08-12 14:44:56 +00:00
if act [ 0 ] == 0 :
2008-07-22 14:24:36 +00:00
idnew = obj . create ( cr , user , act [ 2 ] )
2008-12-09 13:35:40 +00:00
cr . execute ( ' insert into ' + self . _rel + ' ( ' + self . _id1 + ' , ' + self . _id2 + ' ) values ( %s , %s ) ' , ( id , idnew ) )
2008-08-12 14:44:56 +00:00
elif act [ 0 ] == 1 :
obj . write ( cr , user , [ act [ 1 ] ] , act [ 2 ] , context = context )
elif act [ 0 ] == 2 :
2008-07-22 14:24:36 +00:00
obj . unlink ( cr , user , [ act [ 1 ] ] , context = context )
2008-08-12 14:44:56 +00:00
elif act [ 0 ] == 3 :
2008-12-09 13:35:40 +00:00
cr . execute ( ' delete from ' + self . _rel + ' where ' + self . _id1 + ' = %s and ' + self . _id2 + ' = %s ' , ( id , act [ 1 ] ) )
2008-08-12 14:44:56 +00:00
elif act [ 0 ] == 4 :
2008-12-09 13:35:40 +00:00
cr . execute ( ' insert into ' + self . _rel + ' ( ' + self . _id1 + ' , ' + self . _id2 + ' ) values ( %s , %s ) ' , ( id , act [ 1 ] ) )
2008-08-12 14:44:56 +00:00
elif act [ 0 ] == 5 :
2008-12-09 13:35:40 +00:00
cr . execute ( ' update ' + self . _rel + ' set ' + self . _id2 + ' =null where ' + self . _id2 + ' = %s ' , ( id , ) )
2008-08-12 14:44:56 +00:00
elif act [ 0 ] == 6 :
2008-07-22 14:24:36 +00:00
2008-08-12 14:44:56 +00:00
d1 , d2 = obj . pool . get ( ' ir.rule ' ) . domain_get ( cr , user , obj . _name )
2008-07-22 14:24:36 +00:00
if d1 :
2008-10-07 14:19:11 +00:00
d1 = ' and ' + d1
2008-12-09 13:35:40 +00:00
cr . execute ( ' delete from ' + self . _rel + ' where ' + self . _id1 + ' = %s AND ' + self . _id2 + ' IN (SELECT ' + self . _rel + ' . ' + self . _id2 + ' FROM ' + self . _rel + ' , ' + obj . _table + ' WHERE ' + self . _rel + ' . ' + self . _id1 + ' = %s AND ' + self . _rel + ' . ' + self . _id2 + ' = ' + obj . _table + ' .id ' + d1 + ' ) ' , [ id , id ] + d2 )
2008-07-22 14:24:36 +00:00
2008-08-12 14:44:56 +00:00
for act_nbr in act [ 2 ] :
2008-12-09 13:35:40 +00:00
cr . execute ( ' insert into ' + self . _rel + ' ( ' + self . _id1 + ' , ' + self . _id2 + ' ) values ( %s , %s ) ' , ( id , act_nbr ) )
2008-07-22 14:24:36 +00:00
#
# TODO: use a name_search
#
def search ( self , cr , obj , args , name , value , offset = 0 , limit = None , uid = None , operator = ' like ' ) :
2008-08-12 14:44:56 +00:00
return obj . pool . get ( self . _obj ) . search ( cr , uid , args + self . _domain + [ ( ' name ' , operator , value ) ] , offset , limit )
2008-07-22 14:24:36 +00:00
def get_memory ( self , cr , obj , ids , name , user = None , offset = 0 , context = None , values = None ) :
result = { }
for id in ids :
result [ id ] = obj . datas [ id ] . get ( name , [ ] )
return result
def set_memory ( self , cr , obj , id , name , values , user = None , context = None ) :
if not values :
return
for act in values :
# TODO: use constants instead of these magic numbers
2008-08-12 14:44:56 +00:00
if act [ 0 ] == 0 :
2008-07-22 14:24:36 +00:00
raise _ ( ' Not Implemented ' )
2008-08-12 14:44:56 +00:00
elif act [ 0 ] == 1 :
2008-07-22 14:24:36 +00:00
raise _ ( ' Not Implemented ' )
2008-08-12 14:44:56 +00:00
elif act [ 0 ] == 2 :
2008-07-22 14:24:36 +00:00
raise _ ( ' Not Implemented ' )
2008-08-12 14:44:56 +00:00
elif act [ 0 ] == 3 :
2008-07-22 14:24:36 +00:00
raise _ ( ' Not Implemented ' )
2008-08-12 14:44:56 +00:00
elif act [ 0 ] == 4 :
2008-07-22 14:24:36 +00:00
raise _ ( ' Not Implemented ' )
2008-08-12 14:44:56 +00:00
elif act [ 0 ] == 5 :
2008-07-22 14:24:36 +00:00
raise _ ( ' Not Implemented ' )
2008-08-12 14:44:56 +00:00
elif act [ 0 ] == 6 :
2008-07-22 14:24:36 +00:00
obj . datas [ id ] [ name ] = act [ 2 ]
2008-06-15 14:59:23 +00:00
2006-12-07 13:41:40 +00:00
# ---------------------------------------------------------
# Function fields
# ---------------------------------------------------------
class function ( _column ) :
2008-07-22 14:24:36 +00:00
_classic_read = False
_classic_write = False
2009-08-20 15:29:21 +00:00
_prefetch = False
2008-07-22 14:24:36 +00:00
_type = ' function '
_properties = True
2008-08-12 14:44:56 +00:00
2008-08-17 18:28:29 +00:00
#
# multi: compute several fields in one call
#
def __init__ ( self , fnct , arg = None , fnct_inv = None , fnct_inv_arg = None , type = ' float ' , fnct_search = None , obj = None , method = False , store = False , multi = False , * * args ) :
2008-07-22 14:24:36 +00:00
_column . __init__ ( self , * * args )
self . _obj = obj
self . _method = method
self . _fnct = fnct
self . _fnct_inv = fnct_inv
self . _arg = arg
2008-08-17 18:28:29 +00:00
self . _multi = multi
2008-07-22 14:24:36 +00:00
if ' relation ' in args :
self . _obj = args [ ' relation ' ]
self . _fnct_inv_arg = fnct_inv_arg
if not fnct_inv :
self . readonly = 1
self . _type = type
self . _fnct_search = fnct_search
self . store = store
2008-12-07 02:16:54 +00:00
if store :
self . _classic_read = True
self . _classic_write = True
2008-12-16 08:55:33 +00:00
if type == ' binary ' :
self . _symbol_get = lambda x : x and str ( x )
2008-07-22 14:24:36 +00:00
if type == ' float ' :
2008-12-09 13:35:40 +00:00
self . _symbol_c = float . _symbol_c
self . _symbol_f = float . _symbol_f
self . _symbol_set = float . _symbol_set
2008-08-12 14:44:56 +00:00
2008-07-22 14:24:36 +00:00
def search ( self , cr , uid , obj , name , args ) :
if not self . _fnct_search :
#CHECKME: should raise an exception
return [ ]
return self . _fnct_search ( obj , cr , uid , obj , name , args )
def get ( self , cr , obj , ids , name , user = None , context = None , values = None ) :
if not context :
2008-08-12 14:44:56 +00:00
context = { }
2008-07-22 14:24:36 +00:00
if not values :
2008-08-12 14:44:56 +00:00
values = { }
2008-07-22 14:24:36 +00:00
res = { }
if self . _method :
2008-09-09 13:22:10 +00:00
res = self . _fnct ( obj , cr , user , ids , name , self . _arg , context )
2008-07-22 14:24:36 +00:00
else :
2008-09-09 13:22:10 +00:00
res = self . _fnct ( cr , obj . _table , ids , name , self . _arg , context )
2008-09-16 07:31:23 +00:00
2008-09-23 10:47:45 +00:00
if self . _type == ' binary ' and context . get ( ' bin_size ' , False ) :
2008-09-09 13:22:10 +00:00
# convert the data returned by the function with the size of that data...
2009-03-05 15:56:57 +00:00
res = dict ( map ( lambda ( x , y ) : ( x , tools . human_size ( len ( y or ' ' ) ) ) , res . items ( ) ) )
2008-09-09 13:22:10 +00:00
return res
2009-03-27 12:56:20 +00:00
get_memory = get
2008-07-22 14:24:36 +00:00
def set ( self , cr , obj , id , name , value , user = None , context = None ) :
if not context :
2008-08-12 14:44:56 +00:00
context = { }
2008-07-22 14:24:36 +00:00
if self . _fnct_inv :
self . _fnct_inv ( obj , cr , user , id , name , value , self . _fnct_inv_arg , context )
2009-03-27 12:56:20 +00:00
set_memory = set
2006-12-07 13:41:40 +00:00
2008-09-18 11:28:57 +00:00
# ---------------------------------------------------------
# Related fields
# ---------------------------------------------------------
class related ( function ) :
2008-12-09 08:03:55 +00:00
def _fnct_search ( self , tobj , cr , uid , obj = None , name = None , domain = None , context = { } ) :
self . _field_get2 ( cr , uid , obj , context )
i = len ( self . _arg ) - 1
sarg = name
while i > 0 :
if type ( sarg ) in [ type ( [ ] ) , type ( ( 1 , ) ) ] :
where = [ ( self . _arg [ i ] , ' in ' , sarg ) ]
2008-10-03 10:55:11 +00:00
else :
2008-12-09 08:03:55 +00:00
where = [ ( self . _arg [ i ] , ' = ' , sarg ) ]
if domain :
where = map ( lambda x : ( self . _arg [ i ] , x [ 1 ] , x [ 2 ] ) , domain )
domain = [ ]
sarg = obj . pool . get ( self . _relations [ i ] [ ' object ' ] ) . search ( cr , uid , where , context = context )
i - = 1
return [ ( self . _arg [ 0 ] , ' in ' , sarg ) ]
2008-12-12 13:05:11 +00:00
def _fnct_write ( self , obj , cr , uid , ids , field_name , values , args , context = None ) :
if values and field_name :
self . _field_get2 ( cr , uid , obj , context )
relation = obj . _name
res = { }
if type ( ids ) != type ( [ ] ) :
ids = [ ids ]
objlst = obj . browse ( cr , uid , ids )
for data in objlst :
2008-12-15 04:34:26 +00:00
t_id = None
2008-12-12 13:05:11 +00:00
t_data = data
relation = obj . _name
for i in range ( len ( self . arg ) ) :
field_detail = self . _relations [ i ]
relation = field_detail [ ' object ' ]
if not t_data [ self . arg [ i ] ] :
t_data = False
break
if field_detail [ ' type ' ] in ( ' one2many ' , ' many2many ' ) :
2009-06-16 14:29:06 +00:00
if self . _type != " many2one " :
t_id = t_data . id
t_data = t_data [ self . arg [ i ] ] [ 0 ]
2008-12-12 13:05:11 +00:00
else :
t_id = t_data [ ' id ' ]
t_data = t_data [ self . arg [ i ] ]
2008-12-15 04:34:26 +00:00
if t_id :
obj . pool . get ( field_detail [ ' object ' ] ) . write ( cr , uid , [ t_id ] , { args [ - 1 ] : values } )
2008-09-18 11:28:57 +00:00
2008-10-07 14:19:11 +00:00
def _fnct_read ( self , obj , cr , uid , ids , field_name , args , context = None ) :
2008-12-09 08:03:55 +00:00
self . _field_get2 ( cr , uid , obj , context )
2008-09-19 06:30:20 +00:00
if not ids : return { }
2008-10-07 14:19:11 +00:00
relation = obj . _name
2008-12-17 05:44:27 +00:00
res = { } . fromkeys ( ids , False )
2008-10-07 14:19:11 +00:00
objlst = obj . browse ( cr , uid , ids )
2008-09-19 06:30:20 +00:00
for data in objlst :
2008-12-17 05:44:27 +00:00
if not data :
continue
2008-10-07 14:19:11 +00:00
t_data = data
relation = obj . _name
2008-09-19 06:30:20 +00:00
for i in range ( len ( self . arg ) ) :
2008-12-09 08:03:55 +00:00
field_detail = self . _relations [ i ]
relation = field_detail [ ' object ' ]
2008-12-16 18:58:24 +00:00
try :
if not t_data [ self . arg [ i ] ] :
t_data = False
break
except :
2008-09-19 06:30:20 +00:00
t_data = False
break
2008-12-09 08:03:55 +00:00
if field_detail [ ' type ' ] in ( ' one2many ' , ' many2many ' ) :
2008-10-07 14:19:11 +00:00
t_data = t_data [ self . arg [ i ] ] [ 0 ]
2008-09-19 06:30:20 +00:00
else :
2008-10-07 14:19:11 +00:00
t_data = t_data [ self . arg [ i ] ]
2008-09-19 06:30:20 +00:00
if type ( t_data ) == type ( objlst [ 0 ] ) :
2009-01-02 12:01:53 +00:00
res [ data . id ] = t_data . id
2008-09-18 11:28:57 +00:00
else :
2008-10-07 14:19:11 +00:00
res [ data . id ] = t_data
2009-01-02 12:01:53 +00:00
if self . _type == ' many2one ' :
ids = filter ( None , res . values ( ) )
if ids :
ng = dict ( obj . pool . get ( self . _obj ) . name_get ( cr , uid , ids , context = context ) )
for r in res :
if res [ r ] :
res [ r ] = ( res [ r ] , ng [ res [ r ] ] )
2008-09-18 11:28:57 +00:00
return res
2008-09-19 06:30:20 +00:00
2008-10-07 14:19:11 +00:00
def __init__ ( self , * arg , * * args ) :
2008-09-19 06:30:20 +00:00
self . arg = arg
2008-12-09 08:03:55 +00:00
self . _relations = [ ]
2008-12-12 13:05:11 +00:00
super ( related , self ) . __init__ ( self . _fnct_read , arg , self . _fnct_write , fnct_inv_arg = arg , method = True , fnct_search = self . _fnct_search , * * args )
2008-09-18 11:28:57 +00:00
2008-12-09 08:03:55 +00:00
def _field_get2 ( self , cr , uid , obj , context = { } ) :
if self . _relations :
return
obj_name = obj . _name
for i in range ( len ( self . _arg ) ) :
f = obj . pool . get ( obj_name ) . fields_get ( cr , uid , [ self . _arg [ i ] ] , context = context ) [ self . _arg [ i ] ]
self . _relations . append ( {
' object ' : obj_name ,
' type ' : f [ ' type ' ]
} )
if f . get ( ' relation ' , False ) :
obj_name = f [ ' relation ' ]
self . _relations [ - 1 ] [ ' relation ' ] = f [ ' relation ' ]
2008-08-12 14:44:56 +00:00
2006-12-07 13:41:40 +00:00
# ---------------------------------------------------------
# Serialized fields
# ---------------------------------------------------------
class serialized ( _column ) :
2008-07-22 14:24:36 +00:00
def __init__ ( self , string = ' unknown ' , serialize_func = repr , deserialize_func = eval , type = ' text ' , * * args ) :
self . _serialize_func = serialize_func
self . _deserialize_func = deserialize_func
self . _type = type
self . _symbol_set = ( self . _symbol_c , self . _serialize_func )
self . _symbol_get = self . _deserialize_func
super ( serialized , self ) . __init__ ( string = string , * * args )
2006-12-07 13:41:40 +00:00
2007-08-30 14:22:03 +00:00
2006-12-07 13:41:40 +00:00
class property ( function ) :
2007-08-30 14:22:03 +00:00
2008-07-22 14:24:36 +00:00
def _fnct_write ( self , obj , cr , uid , id , prop , id_val , val , context = None ) :
if not context :
2008-08-12 14:44:56 +00:00
context = { }
2008-07-22 14:24:36 +00:00
( obj_dest , ) = val
definition_id = self . _field_get ( cr , uid , obj . _name , prop )
property = obj . pool . get ( ' ir.property ' )
nid = property . search ( cr , uid , [ ( ' fields_id ' , ' = ' , definition_id ) ,
( ' res_id ' , ' = ' , obj . _name + ' , ' + str ( id ) ) ] )
while len ( nid ) :
2008-12-09 13:35:40 +00:00
cr . execute ( ' DELETE FROM ir_property WHERE id= %s ' , ( nid . pop ( ) , ) )
2008-07-22 14:24:36 +00:00
nid = property . search ( cr , uid , [ ( ' fields_id ' , ' = ' , definition_id ) ,
( ' res_id ' , ' = ' , False ) ] )
default_val = False
if nid :
default_val = property . browse ( cr , uid , nid [ 0 ] , context ) . value
company_id = obj . pool . get ( ' res.users ' ) . company_get ( cr , uid , uid )
res = False
newval = ( id_val and obj_dest + ' , ' + str ( id_val ) ) or False
if ( newval != default_val ) and newval :
propdef = obj . pool . get ( ' ir.model.fields ' ) . browse ( cr , uid ,
definition_id , context = context )
res = property . create ( cr , uid , {
' name ' : propdef . name ,
' value ' : newval ,
' res_id ' : obj . _name + ' , ' + str ( id ) ,
' company_id ' : company_id ,
' fields_id ' : definition_id
} , context = context )
return res
def _fnct_read ( self , obj , cr , uid , ids , prop , val , context = None ) :
if not context :
2008-08-12 14:44:56 +00:00
context = { }
2008-07-22 14:24:36 +00:00
property = obj . pool . get ( ' ir.property ' )
definition_id = self . _field_get ( cr , uid , obj . _name , prop )
nid = property . search ( cr , uid , [ ( ' fields_id ' , ' = ' , definition_id ) ,
( ' res_id ' , ' = ' , False ) ] )
default_val = False
if nid :
d = property . browse ( cr , uid , nid [ 0 ] , context ) . value
default_val = ( d and int ( d . split ( ' , ' ) [ 1 ] ) ) or False
vids = [ obj . _name + ' , ' + str ( id ) for id in ids ]
nids = property . search ( cr , uid , [ ( ' fields_id ' , ' = ' , definition_id ) ,
( ' res_id ' , ' in ' , vids ) ] )
res = { }
for id in ids :
2008-08-12 14:44:56 +00:00
res [ id ] = default_val
2008-07-22 14:24:36 +00:00
for prop in property . browse ( cr , uid , nids ) :
res [ int ( prop . res_id . split ( ' , ' ) [ 1 ] ) ] = ( prop . value and \
int ( prop . value . split ( ' , ' ) [ 1 ] ) ) or False
obj = obj . pool . get ( self . _obj )
2009-08-10 16:04:02 +00:00
to_check = res . values ( )
if default_val and default_val not in to_check :
to_check + = [ default_val ]
existing_ids = obj . search ( cr , uid , [ ( ' id ' , ' in ' , to_check ) ] )
for id , res_id in res . items ( ) :
if res_id not in existing_ids :
cr . execute ( ' DELETE FROM ir_property WHERE value= %s ' , ( ( obj . _name + ' , ' + str ( res_id ) ) , ) )
res [ id ] = default_val
names = dict ( obj . name_get ( cr , uid , existing_ids , context ) )
2008-07-22 14:24:36 +00:00
for r in res . keys ( ) :
if res [ r ] and res [ r ] in names :
res [ r ] = ( res [ r ] , names [ res [ r ] ] )
else :
res [ r ] = False
return res
def _field_get ( self , cr , uid , model_name , prop ) :
if not self . field_id . get ( cr . dbname ) :
cr . execute ( ' SELECT id \
FROM ir_model_fields \
WHERE name = % s AND model = % s ' , (prop, model_name))
res = cr . fetchone ( )
self . field_id [ cr . dbname ] = res and res [ 0 ]
return self . field_id [ cr . dbname ]
def __init__ ( self , obj_prop , * * args ) :
self . field_id = { }
function . __init__ ( self , self . _fnct_read , False , self . _fnct_write ,
( obj_prop , ) , * * args )
def restart ( self ) :
self . field_id = { }
2008-07-08 08:13:12 +00:00
2008-07-23 15:01:27 +00:00
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: