def get_image_db_tuple(self, image_element, node_id): """From image element to db tuple""" offset = image_element[0] pixbuf = image_element[1] justification = image_element[2] pixbuf_attrs = dir(pixbuf) if "anchor" in pixbuf_attrs: filename = "" link = "" anchor = (pixbuf.anchor).decode(cons.STR_UTF8) png_blob = None time = 0 elif "filename" in pixbuf_attrs: filename = (pixbuf.filename).decode(cons.STR_UTF8) link = "" anchor = "" png_blob = buffer(pixbuf.embfile) time = pixbuf.time else: filename = "" try: link = (pixbuf.link).decode(cons.STR_UTF8) except: link = "" anchor = "" png_blob = machines.get_blob_buffer_from_pixbuf(pixbuf) time = 0 return (node_id, offset, justification, anchor, png_blob, filename, link, time)
def get_image_db_tuple(self, image_element, node_id): """From image element to db tuple""" offset = image_element[0] pixbuf = image_element[1] justification = image_element[2] if not "anchor" in dir(pixbuf): anchor = "" png_blob = machines.get_blob_buffer_from_pixbuf(pixbuf) else: anchor = (pixbuf.anchor).decode(cons.STR_UTF8) png_blob = None return (node_id, offset, justification, anchor, png_blob)