Your ROOT_URL in app.ini is https://git.hpc.odu.edu/ but you are visiting https://git.wahab.hpc.odu.edu/wirawan0/wpylib/commit/1eaeb3e68cd74bbd0dd7692556513b1fd483d1bb You should set ROOT_URL correctly, otherwise the web may not work correctly.

* Added function: dict_defval and dict_defvals.

master
Wirawan Purwanto 11 years ago
parent 597398a34b
commit 1eaeb3e68c
  1. 11
      sugar.py

@ -86,6 +86,17 @@ def dict_join(*dicts):
rslt.update(d)
return rslt
def dict_defval(p, key, val):
"""For a dict-like object, sets a default value for the given key,
if that has not been defined in the object."""
if key not in p: p[key] = val
def dict_defvals(p, q):
"""For a dict-like object, sets multiple default values for the given keys
(q is an input dict containing the defaults)."""
for qk in q:
dict_defval(p, qk, q[qk])
def list_join(*L):
r = []
for i in L:

Loading…
Cancel
Save