rda-python-common 1.0.38__py3-none-any.whl → 1.0.40__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.

Potentially problematic release.


This version of rda-python-common might be problematic. Click here for more details.

@@ -46,6 +46,8 @@ DBPASS = {}
46
46
  DBNAMES = {
47
47
  'ivaddb' : 'ivaddb',
48
48
  'cntldb' : 'ivaddb',
49
+ 'ivaddb1' : 'ivaddb',
50
+ 'cntldb1' : 'ivaddb',
49
51
  'cdmsdb' : 'ivaddb',
50
52
  'ispddb' : 'ispddb',
51
53
  'obsua' : 'upadb',
@@ -113,20 +115,21 @@ PGDBI['SCPATH'] = None # additional schema path for set search_path
113
115
  PGDBI['VHSET'] = 0
114
116
  PGDBI['PGSIZE'] = 1000 # number of records for page_size
115
117
  PGDBI['MTRANS'] = 5000 # max number of changes in one transactions
116
- PGDBI['MAXICNT'] = 12000000 # maximum number of records in each table
118
+ PGDBI['MAXICNT'] = 6000000 # maximum number of records in each table
117
119
 
118
120
  #
119
121
  # create a pgddl command string with
120
122
  # table name (tname), prefix (pre) and suffix (suf)
121
123
  #
122
- def get_pgddl_command(tname, pre = None, suf = None):
124
+ def get_pgddl_command(tname, pre = None, suf = None, scname = None):
123
125
 
124
126
  ms = re.match(r'^(.+)\.(.+)$', tname)
125
- if ms:
126
- scname = ms.group(1)
127
- tname = ms.group(2)
128
- else:
129
- scname = PGDBI['SCNAME']
127
+ if not scname:
128
+ if ms:
129
+ scname = ms.group(1)
130
+ tname = ms.group(2)
131
+ else:
132
+ scname = PGDBI['SCNAME']
130
133
  xy = ''
131
134
  if suf: xy += ' -x ' + suf
132
135
  if pre: xy += ' -y ' + pre
@@ -246,7 +246,7 @@ def get_email():
246
246
  #
247
247
  # send a customized email with all entries included
248
248
  #
249
- def send_customized_email(logmsg, emlmsg, logact = 0):
249
+ def send_customized_email(logmsg, emlmsg, logact = LOGWRN):
250
250
 
251
251
  entries = {
252
252
  'fr' : ["From", 1, None],
@@ -267,18 +267,20 @@ def send_customized_email(logmsg, emlmsg, logact = 0):
267
267
  vals = ms.groups()
268
268
  msg = msg.replace(vals[1], '')
269
269
  if vals[2]: entries[ekey][2] = vals[2]
270
- elif logact and entries[ekey][1]:
270
+ elif entries[ekey][1]:
271
271
  return pglog("{}Missing Entry '{}' for sending email".format(logmsg, entry), logact|ERRLOG)
272
272
 
273
- ret = send_python_email(entries['sb'][2], entries['to'][2], msg, entries['fr'][2], entries['cc'][2])
274
- if ret != SUCCESS and PGLOG['EMLSEND']: ret = pgsystem(PGLOG['EMLSEND'], logact, 4, emlmsg)
273
+ ret = send_python_email(entries['sb'][2], entries['to'][2], msg, entries['fr'][2], entries['cc'][2], logact)
274
+ if ret == SUCCESS or not PGLOG['EMLSEND']: return ret
275
275
 
276
+ # try commandline sendmail
277
+ ret = pgsystem(PGLOG['EMLSEND'], logact, 4, emlmsg)
276
278
  logmsg += "Email " + entries['to'][2]
277
279
  if entries['cc'][2]: logmsg += " Cc'd " + entries['cc'][2]
278
280
  logmsg += " Subject: " + entries['sb'][2]
279
- if ret:
281
+ if ret:
280
282
  log_email(emlmsg)
281
- if logact: pglog(logmsg, logact&(~EXITLG))
283
+ pglog(logmsg, logact&(~EXITLG))
282
284
  else:
283
285
  errmsg = "Error sending email: " + logmsg
284
286
  pglog(errmsg, (logact|ERRLOG)&~EXITLG)
@@ -288,7 +290,7 @@ def send_customized_email(logmsg, emlmsg, logact = 0):
288
290
  #
289
291
  # send an email; if empty msg send email message saved in PGLOG['EMLMSG'] instead
290
292
  #
291
- def send_email(subject = None, receiver = None, msg = None, sender = None, logact = 0):
293
+ def send_email(subject = None, receiver = None, msg = None, sender = None, logact = LOGWRN):
292
294
 
293
295
  return send_python_email(subject, receiver, msg, sender, None, logact)
294
296
 
@@ -296,7 +298,7 @@ def send_email(subject = None, receiver = None, msg = None, sender = None, logac
296
298
  # send an email via python module smtplib; if empty msg send email message saved
297
299
  # in PGLOG['EMLMSG'] instead. pass cc = '' for skipping 'Cc: '
298
300
  #
299
- def send_python_email(subject = None, receiver = None, msg = None, sender = None, cc = None, logact = 0):
301
+ def send_python_email(subject = None, receiver = None, msg = None, sender = None, cc = None, logact = LOGWRN):
300
302
 
301
303
  if not msg:
302
304
  if PGLOG['EMLMSG']:
@@ -340,7 +342,7 @@ def send_python_email(subject = None, receiver = None, msg = None, sender = None
340
342
  finally:
341
343
  eml.quit()
342
344
  log_email(str(emlmsg))
343
- if logact: pglog(logmsg, logact&~EXITLG)
345
+ pglog(logmsg, logact&~EXITLG)
344
346
  return SUCCESS
345
347
 
346
348
  #
@@ -415,7 +417,7 @@ def pglog(msg, logact = MSGLOG):
415
417
  if logact&EMLALL:
416
418
  if logact&SNDEML or not msg:
417
419
  title = (msg if msg else "Message from {}-{}".format(PGLOG['HOSTNAME'], get_command()))
418
- msg = title + '\n' + msg
420
+ msg = title
419
421
  send_email(title.rstrip())
420
422
  elif msg:
421
423
  set_email(msg, logact)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rda_python_common
3
- Version: 1.0.38
3
+ Version: 1.0.40
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
@@ -1,15 +1,15 @@
1
1
  rda_python_common/PgCMD.py,sha256=EYjG2Z4zEnvsXE1z-jt5UaNoEKxnOYYiMMzvW6HrKA4,20597
2
- rda_python_common/PgDBI.py,sha256=12qnRXO7pWv8togtTsOvtVuGtwixnR-s2vLGPpdDfHw,74658
2
+ rda_python_common/PgDBI.py,sha256=vyjQSgXRh8THM7Gez5leix9Xv3oz8KsYxppjlbA9Rak,74755
3
3
  rda_python_common/PgFile.py,sha256=gJuzBxLRYo3HQyNW1WNYDsQWRei2cco9bYEb6uOL8Ds,98487
4
- rda_python_common/PgLOG.py,sha256=XYJ4w-CVZrkaK4CMWd6ZjUKWIQSvN9lui4Dtt52VBPI,55277
4
+ rda_python_common/PgLOG.py,sha256=aY6EuPaIJlMEdfxR7_amraiwNnaKyU9CgW1LJ0jXWd4,55295
5
5
  rda_python_common/PgLock.py,sha256=12i84nsGBuifSyPnm8IR63LvHvRuVU573D5QKFlHdOI,22623
6
6
  rda_python_common/PgOPT.py,sha256=Sf--l5iKY82xF5NbXxEy8PWip7ACpaa3KLdMac7E-oc,56047
7
7
  rda_python_common/PgSIG.py,sha256=ZVM9Qz6yIFurwIQJtV5-CFbKOTdFsZ-Rs95SEpDFgNk,35795
8
8
  rda_python_common/PgSplit.py,sha256=QKPbF55m8KCTGmwVwL3uG_nuylCC4FSVfLuXeLjJHbE,8816
9
9
  rda_python_common/PgUtil.py,sha256=OqESKCd72b9g8m8jwjPJhXDtPYlW6G8oSOhwChvz2Cg,48600
10
10
  rda_python_common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
- rda_python_common-1.0.38.dist-info/licenses/LICENSE,sha256=1dck4EAQwv8QweDWCXDx-4Or0S8YwiCstaso_H57Pno,1097
12
- rda_python_common-1.0.38.dist-info/METADATA,sha256=nz0V4NcLxfDz9qbXb1vLl5Qx8_IiQtauePj-reMX87I,716
13
- rda_python_common-1.0.38.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
14
- rda_python_common-1.0.38.dist-info/top_level.txt,sha256=KVQmx7D3DD-jsiheqL8HdTrRE14hpRnZY5_ioMArA5k,18
15
- rda_python_common-1.0.38.dist-info/RECORD,,
11
+ rda_python_common-1.0.40.dist-info/licenses/LICENSE,sha256=1dck4EAQwv8QweDWCXDx-4Or0S8YwiCstaso_H57Pno,1097
12
+ rda_python_common-1.0.40.dist-info/METADATA,sha256=niFKGnpZE0EMwnfXEXhtPfY3jqh7MY6J02G2Rp-84Js,716
13
+ rda_python_common-1.0.40.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
14
+ rda_python_common-1.0.40.dist-info/top_level.txt,sha256=KVQmx7D3DD-jsiheqL8HdTrRE14hpRnZY5_ioMArA5k,18
15
+ rda_python_common-1.0.40.dist-info/RECORD,,