X-Git-Url: http://dolda2000.com/gitweb/?a=blobdiff_plain;f=lib%2Fpython%2Fdolcon%2F__init__.py;h=bb4456776c67e52080d02bdf9f584360588a4b86;hb=9a64a4f7bb7ce4d48fa1beb5241306a1a2e7d682;hp=11cb6d4467faaafd3429eaee5142054063826f35;hpb=ff076c0adebb0b8495465cb59531046eb158eab9;p=doldaconnect.git diff --git a/lib/python/dolcon/__init__.py b/lib/python/dolcon/__init__.py index 11cb6d4..bb44567 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, tuple(resp.extract()[0]) + return resp