I try to assign value to attributes of some calss like the following:
for name in dir(modelType):
if request.get(name):
getattr(model, name) = request.get(name)
but get the excption: "can't assign to function call"
how can I change attributes without knowing them at complie time?
You use
setattr()
to assign values to attributes.See: http://docs.python.org/library/functions.html#setattr