Ejemplo n.º 1
0
def getUser(string):
    """Return the user which has created the post."""
    user = string.rpartition('-')[2]
    if user == 'None':
        return None
    else:
        return user
Ejemplo n.º 2
0
def getUser(string):
    """Return the user which has created the post."""
    user = string.rpartition('-')[2]
    if user == 'None':
        return None
    else:
        return user
Ejemplo n.º 3
0
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)
Ejemplo n.º 4
0
def getTime(string):
    """Return the time a post was created."""
    return string.rpartition('-')[0].rpartition('-')[0].rpartition('-')[2]
Ejemplo n.º 5
0
def getTitle(string):
    """Return the title of a post."""
    return string.rpartition('-')[0].rpartition('-')[0].rpartition(
        '-')[0].partition('-')[2]
Ejemplo n.º 6
0
def getDisplayMode(string):
    """Return the display mode of a post."""
    return string.rpartition('-')[0].rpartition('-')[2]
Ejemplo n.º 7
0
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
Ejemplo n.º 8
0
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
Ejemplo n.º 9
0
def getTime(string):
    """Return the time a post was created."""
    return string.rpartition('-')[0].rpartition('-')[0].rpartition('-')[2]
Ejemplo n.º 10
0
def getTitle(string):
    """Return the title of a post."""
    return string.rpartition('-')[0].rpartition('-')[0].rpartition('-')[0].partition('-')[2]
Ejemplo n.º 11
0
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