Repository: rucio/rucio

Issue:
remove leftovers of dict.iteritems for python3 compatibility
Motivation
----------
There are some leftovers of dict.iteritems that are not python3 compatible. 


Modification
------------
Replace them with six.iteritems.


Add the possibility to declare bad files in the WebUI
Motivation
----------
Add the possibility to declare bad files in the WebUI






Discussion:

Resolving patch:
diff --git a/lib/rucio/core/did.py b/lib/rucio/core/did.py
--- a/lib/rucio/core/did.py
+++ b/lib/rucio/core/did.py
@@ -22,7 +22,7 @@
 # - Thomas Beermann <thomas.beermann@cern.ch>, 2013-2018
 # - Joaquin Bogado <jbogado@linti.unlp.edu.ar>, 2014-2015
 # - Wen Guan <wguan.icedew@gmail.com>, 2015
-# - Hannes Hansen <hannes.jakob.hansen@cern.ch>, 2018
+# - Hannes Hansen <hannes.jakob.hansen@cern.ch>, 2018-2019
 #
 # PY3K COMPATIBLE
 
@@ -34,7 +34,7 @@
 from datetime import datetime, timedelta
 from hashlib import md5
 from re import match
-from six import string_types
+from six import string_types, iteritems
 
 from sqlalchemy import and_, or_, exists, String, cast, type_coerce, JSON
 from sqlalchemy.exc import DatabaseError, IntegrityError, CompileError, InvalidRequestError
@@ -1360,7 +1360,7 @@ def add_did_meta(scope, name, meta, session=None):
         if existing_meta is None:
             existing_meta = {}
 
-        for k, v in meta.iteritems():
+        for k, v in iteritems(meta):
             existing_meta[k] = v
 
         row_did_meta.meta = None
@@ -1434,7 +1434,7 @@ def list_dids_by_meta(scope, select, session=None):
     if scope is not None:
         query = query.filter(models.DidMeta.scope == scope)
 
-    for k, v in select.iteritems():
+    for k, v in iteritems(select):
         if session.bind.dialect.name == 'oracle':
             query = query.filter(text("json_exists(meta,'$.%s?(@==''%s'')')" % (k, v)))
         else:
diff --git a/lib/rucio/daemons/conveyor/submitter.py b/lib/rucio/daemons/conveyor/submitter.py
--- a/lib/rucio/daemons/conveyor/submitter.py
+++ b/lib/rucio/daemons/conveyor/submitter.py
@@ -45,6 +45,7 @@
     from ConfigParser import NoOptionError  # py2
 except Exception:
     from configparser import NoOptionError  # py3
+from six import iteritems
 
 from rucio.common.config import config_get
 from rucio.core import heartbeat, request as request_core, transfer as transfer_core
@@ -180,7 +181,7 @@ def submitter(once=False, rses=None, mock=False,
                             submit_transfer(external_host=external_host, job=job, submitter='transfer_submitter',
                                             logging_prepend_str=prepend_str, timeout=timeout)
                     else:
-                        for _, jobs in grouped_jobs[external_host].iteritems():
+                        for _, jobs in iteritems(grouped_jobs[external_host]):
                             # submit transfers
                             for job in jobs:
                                 submit_transfer(external_host=external_host, job=job, submitter='transfer_submitter',
diff --git a/lib/rucio/db/sqla/models.py b/lib/rucio/db/sqla/models.py
--- a/lib/rucio/db/sqla/models.py
+++ b/lib/rucio/db/sqla/models.py
@@ -27,6 +27,7 @@
 import datetime
 import uuid
 
+from six import iteritems
 from sqlalchemy import BigInteger, Boolean, Column, DateTime, Float, Integer, SmallInteger, String as _String, Text, event, UniqueConstraint
 from sqlalchemy.engine import Engine
 from sqlalchemy.ext.compiler import compiles
@@ -208,7 +209,7 @@ def delete(self, flush=True, session=None):
 
     def update(self, values, flush=True, session=None):
         """dict.update() behaviour."""
-        for k, v in values.iteritems():
+        for k, v in iteritems(values):
             self[k] = v
         if session and flush:
             session.flush()


Test patch: