@@ -277,6 +277,10 @@ def getLocalConfValue(conf, fp=""):
277277 print ("ERROR: " + error )
278278
279279
280+ def getSparqlEndpoint (sufix = "query" ):
281+ return app .config ["SPARQL_HOST" ] + app .config ["SPARQL_DATASET" ] + "/" + sufix
282+
283+
280284def refreshStats (stat , force = False ):
281285 interval = None
282286 lpath = getLockFpath ("stats" )
@@ -1138,14 +1142,18 @@ def getMarcFields(
11381142 btd = {}
11391143 btdx = []
11401144 for d in item .get ("btd" , []):
1141- des = descriptors .get (d )
1142- if des .get ("active" , True ) is True :
1143- trx = des .get ("trx" )
1144- if not trx :
1145- trx = des .get ("eng" )
1145+ if d .startswith ("Q" ):
1146+ des = qualifiers .get (d )
1147+ else :
1148+ des = descriptors .get (d )
1149+ if des :
1150+ if des .get ("active" , True ) is True :
1151+ trx = des .get ("trx" )
1152+ if not trx :
1153+ trx = des .get ("eng" )
11461154
1147- btd [trx ] = d
1148- btdx .append (trx )
1155+ btd [trx ] = d
1156+ btdx .append (trx )
11491157
11501158 for x in sorted (btdx , key = coll .sort_key ):
11511159 xtr = "$w" + fw + "g" + fw + "$a" + fw + x + fw + "$7" + fw + btd [x ]
@@ -1154,14 +1162,18 @@ def getMarcFields(
11541162 ntd = {}
11551163 ntdx = []
11561164 for d in item .get ("ntd" , []):
1157- des = descriptors .get (d )
1158- if des .get ("active" , True ) is True :
1159- trx = des .get ("trx" )
1160- if not trx :
1161- trx = des .get ("eng" )
1165+ if d .startswith ("Q" ):
1166+ des = qualifiers .get (d )
1167+ else :
1168+ des = descriptors .get (d )
1169+ if des :
1170+ if des .get ("active" , True ) is True :
1171+ trx = des .get ("trx" )
1172+ if not trx :
1173+ trx = des .get ("eng" )
11621174
1163- ntd [trx ] = d
1164- ntdx .append (trx )
1175+ ntd [trx ] = d
1176+ ntdx .append (trx )
11651177
11661178 for x in sorted (ntdx , key = coll .sort_key ):
11671179 xtr = "$w" + fw + "h" + fw + "$a" + fw + x + fw + "$7" + fw + ntd [x ]
@@ -1170,14 +1182,19 @@ def getMarcFields(
11701182 rtd = {}
11711183 rtdx = []
11721184 for d in item .get ("rtd" , []):
1173- des = descriptors .get (d )
1174- if des .get ("active" , True ) is True :
1175- trx = des .get ("trx" )
1176- if not trx :
1177- trx = des .get ("eng" )
1185+ if d .startswith ("Q" ):
1186+ des = qualifiers .get (d )
1187+ else :
1188+ des = descriptors .get (d )
1189+ if des :
1190+ des = descriptors .get (d )
1191+ if des .get ("active" , True ) is True :
1192+ trx = des .get ("trx" )
1193+ if not trx :
1194+ trx = des .get ("eng" )
11781195
1179- rtd [trx ] = d
1180- rtdx .append (trx )
1196+ rtd [trx ] = d
1197+ rtdx .append (trx )
11811198
11821199 for x in sorted (rtdx , key = coll .sort_key ):
11831200 xtr = (
@@ -1203,13 +1220,14 @@ def getMarcFields(
12031220 pax = []
12041221 for d in item .get ("pa" , []):
12051222 des = descriptors .get (d )
1206- if des .get ("active" , True ) is True :
1207- trx = des .get ("trx" )
1208- if not trx :
1209- trx = des .get ("eng" )
1210-
1211- pa [trx ] = d
1212- pax .append (trx )
1223+ if des :
1224+ if des .get ("active" , True ) is True :
1225+ trx = des .get ("trx" )
1226+ if not trx :
1227+ trx = des .get ("eng" )
1228+
1229+ pa [trx ] = d
1230+ pax .append (trx )
12131231
12141232 for x in sorted (pax , key = coll .sort_key ):
12151233 xtr = (
0 commit comments