Beispiel #1
0
def add(name, description, image):
    """ 

        Preferred way to add a game. 

        Fixes up the image link, if http:// is missing, so you don't 
        accidentally link internally.

    """

    if not "http://" in image:
        image_fixed = "http://" + image
    else:
        image_fixed = image

    if gjms.util.url.validate(image_fixed):
        game = Game(name=name, description=description, image=image_fixed)
        return game
    else:
        raise gjms.core.exceptions.InvalidURL("URL not valid.")