예제 #1
0
 def get_ref(self, ref, string_decode, file_decode):
     runtime_response = self.ciel_runtime.synchronous_request(
         "open_ref", {"ref": ref})
     if "error" in runtime_response:
         raise ReferenceUnavailableException(ref)
     elif "strdata" in runtime_response:
         return string_decode(
             decode_datavalue_string(runtime_response["strdata"]))
     elif "filename" in runtime_response:
         with open(runtime_response["filename"], "r") as fp:
             return file_decode(fp)
예제 #2
0
 def from_safe_dict(in_dict):
     try:
         in_dict["strdata"] = decode_datavalue_string(in_dict["strdata"])
     except KeyError:
         pass
     return FileOrString(**in_dict)
예제 #3
0
파일: producer.py 프로젝트: ZubairNabi/ciel
def ref_from_safe_string(string, id):
    if len(string) < 1024:
        return SWDataValue(id, value=string)
    else:
        return ref_from_string(decode_datavalue_string(string), id)
예제 #4
0
def ref_from_safe_string(string, id):
    if len(string) < 1024:
        return SWDataValue(id, value=string)
    else:
        return ref_from_string(decode_datavalue_string(string), id)
예제 #5
0
파일: fetcher.py 프로젝트: ZubairNabi/ciel
 def from_safe_dict(in_dict):
     try:
         in_dict["strdata"] = decode_datavalue_string(in_dict["strdata"])
     except KeyError:
         pass
     return FileOrString(**in_dict)