Code Duplication    Length = 21-21 lines in 2 locations

gmp/xml.py 2 locations

@@ 1247-1267 (lines=21) @@
1244
1245
        return cmd.to_string()
1246
1247
    def modify_role_command(self, role_id, kwargs):
1248
        """Generates xml string for modify role on gvmd."""
1249
        if not role_id:
1250
            raise ValueError('modify_role requires a role_id element')
1251
1252
        cmd = XmlCommand('modify_role')
1253
        cmd.set_attribute('role_id', role_id)
1254
1255
        comment = kwargs.get('comment', '')
1256
        if comment:
1257
            cmd.add_element('comment', comment)
1258
1259
        name = kwargs.get('name', '')
1260
        if name:
1261
            cmd.add_element('name', name)
1262
1263
        users = kwargs.get('users', '')
1264
        if users:
1265
            cmd.add_element('users', users)
1266
1267
        return cmd.to_string()
1268
1269
    def modify_scanner_command(self, scanner_id, host, port, scanner_type,
1270
                               kwargs):
@@ 1051-1071 (lines=21) @@
1048
1049
        return cmd.to_string()
1050
1051
    def modify_group_command(self, group_id, kwargs):
1052
        """Generates xml string for modify group on gvmd."""
1053
        if not group_id:
1054
            raise ValueError('modify_group requires a group_id attribute')
1055
1056
        cmd = XmlCommand('modify_group')
1057
        cmd.set_attribute('group_id', group_id)
1058
1059
        comment = kwargs.get('comment', '')
1060
        if comment:
1061
            cmd.add_element('comment', comment)
1062
1063
        name = kwargs.get('name', '')
1064
        if name:
1065
            cmd.add_element('name', name)
1066
1067
        users = kwargs.get('users', '')
1068
        if users:
1069
            cmd.add_element('users', users)
1070
1071
        return cmd.to_string()
1072
1073
    def modify_note_command(self, note_id, text, kwargs):
1074
        """Generates xml string for modify note on gvmd."""