Ejemplo n.º 1
0
 def get_url(self, full_address = False):
     """
     Returns the component url (something like /storage/res_id.ext)
     """
     
     storage = Storage()
     url = None
     try:        
         file_name = self.uri
         if  storage.exists(file_name):
             url = os.path.join(STORAGE_SERVER_URL, file_name)
     
             if full_address:
                 url = SERVER_PUBLIC_ADDRESS + url
             
     except Exception, ex:
         logger.exception(ex)
         return url
Ejemplo n.º 2
0
def _get_resource_url(id):
    """
    Returns resource path
    """

    storage = Storage()

    if not id:
        return None

    try:
        
        if storage.exists(id):
            url = '/storage/' + id
        else:
            url = None
    except:
        url = None
    return url