rda-python-common 3.0.16__py3-none-any.whl → 3.0.18__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -22,7 +22,7 @@ object that existing callers expect.
22
22
 
23
23
  from . import PgLOG, PgUtil, PgDBI, PgFile, PgLock, PgCMD, PgSIG, PgOPT, PgSplit
24
24
 
25
- __version__ = "3.0.16"
25
+ __version__ = "3.0.18"
26
26
 
27
27
  __all__ = [
28
28
  "PgLOG",
@@ -2357,22 +2357,23 @@ class PgFile(PgUtil, PgSIG):
2357
2357
  if re.match(r'^\[\]', buf): break
2358
2358
  if re.match(r'^\[\{', buf):
2359
2359
  ary = json.loads(buf)
2360
- hash = ary[0]
2360
+ cnt = len(ary)
2361
+ isdir = (cnt > 1 or ary[0]['Key'] != file)
2362
+ # a key prefix has no timestamp of its own; report the newest member's
2363
+ hash = max(ary, key = lambda a: a['LastModified']) if isdir else ary[0]
2361
2364
  uhash = None
2362
2365
  if ucmd:
2363
2366
  ubuf = self.pgsystem(ucmd, self.LOGWRN, self.CMDRET)
2364
2367
  if ubuf and re.match(r'^\{', ubuf): uhash = json.loads(ubuf)
2365
2368
  ret = self.object_file_stat(hash, uhash, opt)
2366
- if ret:
2367
- cnt = len(ary)
2368
- if cnt > 1 or hash['Key'] != file:
2369
- ret['count'] = cnt
2370
- ret['fname'] = op.basename(file)
2371
- ret['isfile'] = 0
2372
- size = 0
2373
- for a in ary:
2374
- size += int(a['Size'])
2375
- ret['data_size'] = size
2369
+ if ret and isdir:
2370
+ ret['count'] = cnt
2371
+ ret['fname'] = op.basename(file)
2372
+ ret['isfile'] = 0
2373
+ size = 0
2374
+ for a in ary:
2375
+ size += int(a['Size'])
2376
+ ret['data_size'] = size
2376
2377
  uhash = None
2377
2378
  break
2378
2379
  if opt&64: return self.FAILURE
@@ -320,13 +320,18 @@ class PgLOG:
320
320
  msg = emlmsg
321
321
  for ekey in entries:
322
322
  entry = entries[ekey][0]
323
- ms = re.search(r'(^|\n)({}: *(.*)\n)'.format(entry), emlmsg, re.I)
323
+ ms = re.search(r'(^|\n)({}: *(.*)\n)'.format(entry), msg, re.I)
324
324
  if ms:
325
- vals = ms.groups()
326
- msg = msg.replace(vals[1], '')
327
- if vals[2]: entries[ekey][2] = vals[2]
325
+ # cut out this header line only; a replace() of the matched text would also
326
+ # strip an identical line from anywhere in the message body
327
+ msg = msg[:ms.start(2)] + msg[ms.end(2):]
328
+ if ms.group(3): entries[ekey][2] = ms.group(3)
328
329
  elif entries[ekey][1]:
329
330
  return self.pglog("{}Missing Entry '{}' for sending email".format(logmsg, entry), logact|self.ERRLOG)
331
+ if not msg.strip():
332
+ # send_python_email() mails the buffered EMLMSG when it is given no body, which
333
+ # would send an unrelated message to this recipient and empty the buffer
334
+ return self.pglog("{}Empty message body for sending email".format(logmsg), logact|self.ERRLOG)
330
335
  ret = self.send_python_email(entries['sb'][2], entries['to'][2], msg, entries['fr'][2], entries['cc'][2], logact)
331
336
  if ret == self.SUCCESS or not self.PGLOG['EMLSEND']: return ret
332
337
  # try commandline sendmail
@@ -386,7 +391,10 @@ class PgLOG:
386
391
  self.PGLOG['EMLMSG'] = ''
387
392
  else:
388
393
  return ''
389
- docc = False if cc else True
394
+ # only an omitted cc means 'use CCDADDR and carbon copy the sender'; an explicitly
395
+ # empty cc suppresses the Cc entirely, and used to leak the sender into the global
396
+ # CCDADDR anyway, carbon copying it on every later email of the same process
397
+ docc = True if cc is None else False
390
398
  if not sender:
391
399
  sender = self.PGLOG['CURUID']
392
400
  if sender != self.PGLOG['COMMONUSER']: docc = False
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rda_python_common
3
- Version: 3.0.16
3
+ Version: 3.0.18
4
4
  Summary: RDA Python common library codes shared by other RDA python packages
5
5
  Author-email: Zaihua Ji <zji@ucar.edu>
6
6
  Project-URL: Homepage, https://github.com/NCAR/rda-python-common
@@ -189,7 +189,7 @@ PgLOG.pglog("hello", PgLOG.LOGWRN)
189
189
  python -c "import rda_python_common; print(rda_python_common.__version__)"
190
190
  ```
191
191
 
192
- You should see the installed version (currently `3.0.16`). If the import
192
+ You should see the installed version (currently `3.0.18`). If the import
193
193
  fails, double-check that the active Python environment is the one where you
194
194
  ran `pip install`.
195
195
 
@@ -7,12 +7,12 @@ rda_python_common/PgOPT.py,sha256=0nQPF19N-1VWwrjFHEeruVSwVDwvFKd4uowPc8dK7e4,56
7
7
  rda_python_common/PgSIG.py,sha256=0MJPH0fTtSshIsvUXkzQjReHPyCWdzHYOY5LbFSh7-A,34318
8
8
  rda_python_common/PgSplit.py,sha256=En7xcdkE4YNRcMX88qXnrUgUOnQU3Kqh8uxRIdlJhEA,9156
9
9
  rda_python_common/PgUtil.py,sha256=7hXAznAI8tYh-nJRKBIXejNe2ROQ2Wxn28OAndeg0Iw,48433
10
- rda_python_common/__init__.py,sha256=SXJ9H3nEd5bF9WiHvbYzPqLADjU_wAHSbGiOag2MtQ8,995
10
+ rda_python_common/__init__.py,sha256=RnBj2y9ieviHHwkUJ6ayCqCa2pkhjnf3IuTr0CbAFgo,995
11
11
  rda_python_common/pg_cmd.py,sha256=PiQaAeb7l92LceqMwSzLpz9nD5pDRHJcEZxTDn-HeCs,33255
12
12
  rda_python_common/pg_dbi.py,sha256=h1snZ8fJwHeBQJmNjsjJoDKkfT4FW9avMvdHgcIc-cA,122328
13
- rda_python_common/pg_file.py,sha256=U6G10v_788DITInnrSzRpJMRC0MhpWub_HsHGKTtCeE,166954
13
+ rda_python_common/pg_file.py,sha256=3cnaY4wS9t8D4Rcv5_QfHmB9JkNwNGgnKj-KNDff6sc,167089
14
14
  rda_python_common/pg_lock.py,sha256=31EaVDjCkcx3-n8-KnzG18R8Pz7Z6KyFsEqcml6Iq5c,32702
15
- rda_python_common/pg_log.py,sha256=zWtd0o77zNyYYA0puAmB2NpW3FgOod5FB7Duyc6GPww,81971
15
+ rda_python_common/pg_log.py,sha256=fN6dcAlcd6nHf21r_CfraCAMgwkrqrDCMSdMtXUa62A,82686
16
16
  rda_python_common/pg_opt.py,sha256=LxVAf47wi2STkVGSXMvV3IZphEJcoO8bvYXy6kQ5ox4,82403
17
17
  rda_python_common/pg_password.py,sha256=X-eIDwdqBhtrhrbDTNWle-0JtWsyIVZdDOZaBu7cFHM,2343
18
18
  rda_python_common/pg_sig.py,sha256=o4L9qjrgOIAASXntY6kHfEGV2TXuFL3mTczqkemY9oQ,53572
@@ -20,9 +20,9 @@ rda_python_common/pg_split.py,sha256=aAWKUZPmZ-LQ_fJ3DSKzPKxJw0fMDJ2fgP8ZT629M30
20
20
  rda_python_common/pg_util.py,sha256=JL9NoW-VoQvsjXsUr09oBUWYJJNltU4GyQIfWlpkf90,86084
21
21
  rda_python_common/pgpassword.py,sha256=aTQaO59QokWrv2EKom4TvKhNW2Mr6aFMMBVG4DCbcKI,5023
22
22
  rda_python_common/pgpassword.usg,sha256=Wrle6A8sdlMGx3ZEAmE6TNDPOlG84Whe0T3rCNFzPfY,2013
23
- rda_python_common-3.0.16.dist-info/licenses/LICENSE,sha256=1dck4EAQwv8QweDWCXDx-4Or0S8YwiCstaso_H57Pno,1097
24
- rda_python_common-3.0.16.dist-info/METADATA,sha256=luPqGelJ-O6qsvmbn41HIMiqKqK5a1tJTBFXOeB6XMA,14530
25
- rda_python_common-3.0.16.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
26
- rda_python_common-3.0.16.dist-info/entry_points.txt,sha256=pZgVNWspcK-F1TbPav7C3C9NdeHDZMm_25fW9weix00,65
27
- rda_python_common-3.0.16.dist-info/top_level.txt,sha256=KVQmx7D3DD-jsiheqL8HdTrRE14hpRnZY5_ioMArA5k,18
28
- rda_python_common-3.0.16.dist-info/RECORD,,
23
+ rda_python_common-3.0.18.dist-info/licenses/LICENSE,sha256=1dck4EAQwv8QweDWCXDx-4Or0S8YwiCstaso_H57Pno,1097
24
+ rda_python_common-3.0.18.dist-info/METADATA,sha256=3QrHnixrdNIgkpmFIHckhAUU-yF13XU34C3U6Aq0VG0,14530
25
+ rda_python_common-3.0.18.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
26
+ rda_python_common-3.0.18.dist-info/entry_points.txt,sha256=pZgVNWspcK-F1TbPav7C3C9NdeHDZMm_25fW9weix00,65
27
+ rda_python_common-3.0.18.dist-info/top_level.txt,sha256=KVQmx7D3DD-jsiheqL8HdTrRE14hpRnZY5_ioMArA5k,18
28
+ rda_python_common-3.0.18.dist-info/RECORD,,