Esempio n. 1
0
 def clean(self):
     cleaned_data = super(LinkCreate, self).clean()
     profile = self.cleaned_data["profile"]
     site = self.cleaned_data["site"]
     if control.site_link_exists(self.account, site):
         raise ValidationError(_("ERROR_LINK_PROFILE_FOR_SITE_EXISTS"))
     if not link_control.valid_profile_format(profile, site):
         raise ValidationError(_("ERROR_BAD_PROFILE_FORMAT"))
     if not control.can_create_link(self.account, site, profile):
         raise ValidationError(_("ERROR_CANNOT_CREATE_LINK"))
     return cleaned_data
Esempio n. 2
0
 def clean(self):
     cleaned_data = super(LinkCreate, self).clean()
     profile = self.cleaned_data["profile"]
     site = self.cleaned_data["site"]
     if control.site_link_exists(self.team, site):
         raise ValidationError(_("ERROR_LINK_PROFILE_FOR_SITE_EXISTS"))
     if not link_control.valid_profile_format(profile, site):
         raise ValidationError(_("ERROR_BAD_PROFILE_FORMAT"))
     if not control.can_create_link(self.account, self.team, site, profile):
         raise ValidationError(_("ERROR_CANNOT_CREATE_LINK"))
     return cleaned_data
Esempio n. 3
0
def can_create_link(account, team, site, profile):
    return (link_control.valid_profile_format(profile, site)
            and not site_link_exists(team, site) and is_member(account, team))
Esempio n. 4
0
def can_create_link(account, team, site, profile):
    return (link_control.valid_profile_format(profile, site) and 
            not site_link_exists(team, site) and is_member(account, team))
Esempio n. 5
0
 def test_couchsurfing_com_links(self):
     """
     Tests that .com urls are accepted
     """
     self.assertEqual(True, link_control.valid_profile_format("https://couchsurfing.com/people/deivid_rodriguez", "COUCHSURFING"))
Esempio n. 6
0
def can_create_link(account, site, profile):
    exists = site_link_exists(account, site)
    return link_control.valid_profile_format(profile, site) and not exists
Esempio n. 7
0
def can_create_link(account, site, profile):
    exists = site_link_exists(account, site)
    return link_control.valid_profile_format(profile, site) and not exists