X-Git-Url: http://dolda2000.com/gitweb/?a=blobdiff_plain;f=lib%2Fpython%2Fdolcon%2F__init__.py;h=86ce62456344a253319928b078310d2d4b232635;hb=194d48ea4710829c7c890c43381857fe07f77050;hp=11cb6d4467faaafd3429eaee5142054063826f35;hpb=a5b603ac4db2b0db5eaa2c135b1b3eecebd16ce9;p=doldaconnect.git diff --git a/lib/python/dolcon/__init__.py b/lib/python/dolcon/__init__.py index 11cb6d4..86ce624 100644 --- a/lib/python/dolcon/__init__.py +++ b/lib/python/dolcon/__init__.py @@ -88,3 +88,14 @@ def ecmda(code, *args): if resp.getcode() != code: raise ValueError, resp.getcode() return resp + +def ecmds(*args): + """Another convenience function for ecmd. + + Like ecmda, but will fail on all 5xx codes, and succeed on all + others. + """ + resp = ecmd(*args) + if resp.getcode() >= 500 and resp.getcode() < 600: + raise ValueError, resp.extract()[0] + return resp