git://git.onelab.eu
/
plcapi.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
options override tags - mention tags in __doc__
[plcapi.git]
/
PLC
/
Methods
/
UpdateAddress.py
diff --git
a/PLC/Methods/UpdateAddress.py
b/PLC/Methods/UpdateAddress.py
index
c0687b6
..
4586f64
100644
(file)
--- a/
PLC/Methods/UpdateAddress.py
+++ b/
PLC/Methods/UpdateAddress.py
@@
-1,8
+1,10
@@
+# $Id$
+# $URL$
from PLC.Faults import *
from PLC.Method import Method
from PLC.Parameter import Parameter, Mixed
from PLC.Addresses import Address, Addresses
from PLC.Faults import *
from PLC.Method import Method
from PLC.Parameter import Parameter, Mixed
from PLC.Addresses import Address, Addresses
-from PLC.Auth import
Password
Auth
+from PLC.Auth import Auth
can_update = lambda (field, value): field in \
['line1', 'line2', 'line3',
can_update = lambda (field, value): field in \
['line1', 'line2', 'line3',
@@
-23,7
+25,7
@@
class UpdateAddress(Method):
address_fields = dict(filter(can_update, Address.fields.items()))
accepts = [
address_fields = dict(filter(can_update, Address.fields.items()))
accepts = [
-
Password
Auth(),
+ Auth(),
Address.fields['address_id'],
address_fields
]
Address.fields['address_id'],
address_fields
]
@@
-34,7
+36,7
@@
class UpdateAddress(Method):
address_fields = dict(filter(can_update, address_fields.items()))
# Get associated address details
address_fields = dict(filter(can_update, address_fields.items()))
# Get associated address details
- addresses = Addresses(self.api, [address_id])
.values()
+ addresses = Addresses(self.api, [address_id])
if not addresses:
raise PLCInvalidArgument, "No such address"
address = addresses[0]
if not addresses:
raise PLCInvalidArgument, "No such address"
address = addresses[0]
@@
-45,5
+47,10
@@
class UpdateAddress(Method):
address.update(address_fields)
address.sync()
address.update(address_fields)
address.sync()
-
- return 1
+
+ # Logging variables
+ self.event_objects = {'Address': [address['address_id']]}
+ self.message = 'Address %d updated: %s' % \
+ (address['address_id'], ", ".join(address_fields.keys()))
+
+ return 1