From: Tony Mack Date: Fri, 12 Oct 2012 20:18:14 +0000 (-0400) Subject: primary key set in class's fields attribute intead of as its own class attribute X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=dc3babc41e3f84285fc71b687e5011e5bc1ebead;p=plcapi.git primary key set in class's fields attribute intead of as its own class attribute --- diff --git a/PLC/Accessors/Factory.py b/PLC/Accessors/Factory.py index fec0d63e..d4fe8b50 100644 --- a/PLC/Accessors/Factory.py +++ b/PLC/Accessors/Factory.py @@ -110,7 +110,10 @@ def define_accessors_ (module, objclass, methodsuffix, tagname, # accepts get_accepts = [ Auth () ] - primary_key=objclass.primary_key + primary_key = None + for field in objclass.fields: + if objclass.fields[field].primary_key == True: + primary_key = field secondary_key = taggable_classes[objclass]['secondary_key'] get_accepts += [ Mixed (objclass.fields[primary_key], objclass.fields[secondary_key]) ] # for set, idem set of arguments + one additional arg, the new value