app/soc/logic/validate.py
changeset 533 ba3309b2fd30
parent 513 3c1e16637ad7
child 1307 091a21cf3627
equal deleted inserted replaced
532:3a50bdfb75a9 533:ba3309b2fd30
    25 
    25 
    26 import feedparser
    26 import feedparser
    27 
    27 
    28 from google.appengine.api import urlfetch
    28 from google.appengine.api import urlfetch
    29 
    29 
    30 from soc.logic import path_link_name
    30 from soc.models import linkable
    31 
    31 
    32 
    32 
    33 def isFeedURLValid(feed_url=None):
    33 def isFeedURLValid(feed_url=None):
    34   """Returns True if provided url is valid ATOM or RSS.
    34   """Returns True if provided url is valid ATOM or RSS.
    35 
    35 
    49   """Returns True if link_id is in a valid format.
    49   """Returns True if link_id is in a valid format.
    50 
    50 
    51   Args:
    51   Args:
    52     link_id: link ID used in URLs for identification
    52     link_id: link ID used in URLs for identification
    53   """
    53   """
    54   if path_link_name.LINK_ID_REGEX.match(link_id):
    54   if linkable.LINK_ID_REGEX.match(link_id):
    55     return True
    55     return True
    56   return False
    56   return False
    57 
    57 
    58 
    58 
    59 def isScopePathFormatValid(scope_path):
    59 def isScopePathFormatValid(scope_path):
    62   Args:
    62   Args:
    63     scope_path: scope path prepended to link ID
    63     scope_path: scope path prepended to link ID
    64       used for identification.
    64       used for identification.
    65   """
    65   """
    66    
    66    
    67   if path_link_name.SCOPE_PATH_REGEX.match(scope_path):
    67   if linkable.SCOPE_PATH_REGEX.match(scope_path):
    68     return True
    68     return True
    69   
    69   
    70   return False
    70   return False