def test_href(self): vm = schema.new(schema.VM) vm.id = 10 vm.href = '/vms/10' vm.description = 'foo' vm2 = schema.href(vm) assert vm2.id == vm.id assert vm2.href == vm.href assert vm2.description is None
def execute(self): """Execute the "update" command.""" self.check_connection() connection = self.context.connection typename, id = self.arguments typ = self.resolve_singular_type(typename) base = self.resolve_base(self.options) obj = self.get_object(typ, id, base) # Trac issue #179: don't set fields that already exist obj = schema.href(obj) obj = self.update_object(obj, self.options) connection.update(obj)
def execute(self): """Execute the "update" command.""" args = self.arguments opts = self.options connection = self.check_connection() base = self.resolve_base(opts) info = schema.type_info(args[0], base=base) if info is None: self.error('no such type: %s' % args[0]) for link in base.link: if link.rel == info[3]: break else: self.error('type does not exist here: %s' % args[0]) obj = self.get_object(info[0], args[1], base) if obj is None: self.error('object does not exist') # Trac issue #179: don't set fields that already exist obj = schema.href(obj) self.update_object(obj, self.options) connection.update(obj)