Code Duplication    Length = 21-21 lines in 2 locations

gmp/xml.py 2 locations

@@ 1224-1244 (lines=21) @@
1221
1222
        return cmd.to_string()
1223
1224
    def modify_role_command(self, role_id, kwargs):
1225
        """Generates xml string for modify role on gvmd."""
1226
        if not role_id:
1227
            raise ValueError('modify_role requires a role_id element')
1228
1229
        cmd = XmlCommand('modify_role')
1230
        cmd.set_attribute('role_id', role_id)
1231
1232
        comment = kwargs.get('comment', '')
1233
        if comment:
1234
            cmd.add_element('comment', comment)
1235
1236
        name = kwargs.get('name', '')
1237
        if name:
1238
            cmd.add_element('name', name)
1239
1240
        users = kwargs.get('users', '')
1241
        if users:
1242
            cmd.add_element('users', users)
1243
1244
        return cmd.to_string()
1245
1246
    def modify_scanner_command(self, scanner_id, host, port, scanner_type,
1247
                               kwargs):
@@ 1035-1055 (lines=21) @@
1032
1033
        return cmd.to_string()
1034
1035
    def modify_group_command(self, group_id, kwargs):
1036
        """Generates xml string for modify group on gvmd."""
1037
        if not group_id:
1038
            raise ValueError('modify_group requires a group_id attribute')
1039
1040
        cmd = XmlCommand('modify_group')
1041
        cmd.set_attribute('group_id', group_id)
1042
1043
        comment = kwargs.get('comment', '')
1044
        if comment:
1045
            cmd.add_element('comment', comment)
1046
1047
        name = kwargs.get('name', '')
1048
        if name:
1049
            cmd.add_element('name', name)
1050
1051
        users = kwargs.get('users', '')
1052
        if users:
1053
            cmd.add_element('users', users)
1054
1055
        return cmd.to_string()
1056
1057
    def modify_note_command(self, note_id, text, kwargs):
1058
        """Generates xml string for modify note on gvmd."""