def getUser(string): """Return the user which has created the post.""" user = string.rpartition('-')[2] if user == 'None': return None else: return user
def get_object_from_string(string): """ Given a string identifying an object (as returned by the get_class_string method) load and return the actual object. """ import importlib the_module, _, the_name = string.rpartition('.') return getattr(importlib.import_module(the_module), the_name)
def getTime(string): """Return the time a post was created.""" return string.rpartition('-')[0].rpartition('-')[0].rpartition('-')[2]
def getTitle(string): """Return the title of a post.""" return string.rpartition('-')[0].rpartition('-')[0].rpartition( '-')[0].partition('-')[2]
def getDisplayMode(string): """Return the display mode of a post.""" return string.rpartition('-')[0].rpartition('-')[2]
def convert_pastesite_url(string): """ Convert the pastesite URL to downloadable format """ head, sep, tail = string.rpartition('/') return_url = head + '/plain/' + tail + '.txt' return return_url
def convert_privatepaste_url(string): """ Convert the privatepate URL to downloadable format """ head, sep, tail = string.rpartition('/') return_url = head + '/download/' + tail return return_url
def getTitle(string): """Return the title of a post.""" return string.rpartition('-')[0].rpartition('-')[0].rpartition('-')[0].partition('-')[2]
def convert_pastesite_url(string): """ Convert the pastesite URL to downloadable format """ head, sep, tail = string.rpartition("/") return_url = head + "/plain/" + tail + ".txt" return return_url