Code Duplication    Length = 21-21 lines in 2 locations

gmp/xml.py 2 locations

@@ 1233-1253 (lines=21) @@
1230
1231
        return cmd.to_string()
1232
1233
    def modify_role_command(self, role_id, kwargs):
1234
        """Generates xml string for modify role on gvmd."""
1235
        if not role_id:
1236
            raise ValueError('modify_role requires a role_id element')
1237
1238
        cmd = XmlCommand('modify_role')
1239
        cmd.set_attribute('role_id', role_id)
1240
1241
        comment = kwargs.get('comment', '')
1242
        if comment:
1243
            cmd.add_element('comment', comment)
1244
1245
        name = kwargs.get('name', '')
1246
        if name:
1247
            cmd.add_element('name', name)
1248
1249
        users = kwargs.get('users', '')
1250
        if users:
1251
            cmd.add_element('users', users)
1252
1253
        return cmd.to_string()
1254
1255
    def modify_scanner_command(self, scanner_id, host, port, scanner_type,
1256
                               kwargs):
@@ 1044-1064 (lines=21) @@
1041
1042
        return cmd.to_string()
1043
1044
    def modify_group_command(self, group_id, kwargs):
1045
        """Generates xml string for modify group on gvmd."""
1046
        if not group_id:
1047
            raise ValueError('modify_group requires a group_id attribute')
1048
1049
        cmd = XmlCommand('modify_group')
1050
        cmd.set_attribute('group_id', group_id)
1051
1052
        comment = kwargs.get('comment', '')
1053
        if comment:
1054
            cmd.add_element('comment', comment)
1055
1056
        name = kwargs.get('name', '')
1057
        if name:
1058
            cmd.add_element('name', name)
1059
1060
        users = kwargs.get('users', '')
1061
        if users:
1062
            cmd.add_element('users', users)
1063
1064
        return cmd.to_string()
1065
1066
    def modify_note_command(self, note_id, text, kwargs):
1067
        """Generates xml string for modify note on gvmd."""