예제 #1
0
파일: forms.py 프로젝트: aricha/zamboni
def verify_app_domain(manifest_url):
    if waffle.switch_is_active('webapps-unique-by-domain'):
        domain = Webapp.domain_from_url(manifest_url)
        if Addon.objects.filter(app_domain=domain).exists():
            raise forms.ValidationError(
                _('An app already exists on this domain, '
                  'only one app per domain is allowed.'))
예제 #2
0
def verify_app_domain(manifest_url):
    if waffle.switch_is_active('webapps-unique-by-domain'):
        domain = Webapp.domain_from_url(manifest_url)
        if Addon.objects.filter(app_domain=domain).exists():
            raise forms.ValidationError(
                _('An app already exists on this domain, '
                  'only one app per domain is allowed.'))
예제 #3
0
def verify_app_domain(manifest_url, exclude=None, packaged=False):
    if packaged or waffle.switch_is_active('webapps-unique-by-domain'):
        domain = Webapp.domain_from_url(manifest_url)
        qs = Webapp.objects.filter(app_domain=domain)
        if exclude:
            qs = qs.exclude(pk=exclude.pk)
        if qs.exists():
            raise forms.ValidationError(
                _('An app already exists on this domain; '
                  'only one app per domain is allowed.'))
예제 #4
0
파일: forms.py 프로젝트: rtilder/zamboni
def verify_app_domain(manifest_url, exclude=None):
    if waffle.switch_is_active('webapps-unique-by-domain'):
        domain = Webapp.domain_from_url(manifest_url)
        qs = Webapp.objects.filter(app_domain=domain)
        if exclude:
            qs = qs.exclude(pk=exclude.pk)
        if qs.exists():
            raise forms.ValidationError(
                _('An app already exists on this domain; '
                  'only one app per domain is allowed.'))
예제 #5
0
 def test_normalize_case(self):
     eq_(Webapp.domain_from_url('httP://mOzIllA.com/'),
         'http://mozilla.com')
예제 #6
0
 def test_none(self):
     Webapp.domain_from_url(None)
예제 #7
0
 def test_normalize_www(self):
     eq_(Webapp.domain_from_url("http://www.mozilla.com/super/rad.webapp"), "mozilla.com")
예제 #8
0
 def test_https(self):
     eq_(Webapp.domain_from_url('https://mozilla.com/'),
         'https://mozilla.com')
예제 #9
0
 def test_none(self):
     Webapp.domain_from_url(None)
예제 #10
0
파일: test_models.py 프로젝트: at13/zamboni
 def test_empty_or_none(self):
     eq_(Webapp.domain_from_url(None, allow_none=True), None)
예제 #11
0
 def test_with_port(self):
     eq_(Webapp.domain_from_url('http://mozilla.com:9000/'),
         'http://mozilla.com:9000')
예제 #12
0
 def test_long_path(self):
     eq_(Webapp.domain_from_url("http://mozilla.com/super/rad.webapp"), "http://mozilla.com")
예제 #13
0
 def test_empty_or_none(self):
     eq_(Webapp.domain_from_url(None, allow_none=True), None)
예제 #14
0
 def test_long_path(self):
     eq_(Webapp.domain_from_url('http://mozilla.com/super/rad.webapp'),
         'http://mozilla.com')
예제 #15
0
 def test_https(self):
     eq_(Webapp.domain_from_url("https://mozilla.com/"), "https://mozilla.com")
예제 #16
0
 def test_subdomains(self):
     eq_(Webapp.domain_from_url("http://apps.mozilla.com/"), "http://apps.mozilla.com")
예제 #17
0
 def test_with_port(self):
     eq_(Webapp.domain_from_url("http://mozilla.com:9000/"), "http://mozilla.com:9000")
예제 #18
0
 def test_empty(self):
     Webapp.domain_from_url('')
예제 #19
0
 def test_https(self):
     eq_(Webapp.domain_from_url('https://mozilla.com/'),
         'https://mozilla.com')
예제 #20
0
 def test_simple(self):
     eq_(Webapp.domain_from_url('http://mozilla.com/'),
         'http://mozilla.com')
예제 #21
0
 def test_simple(self):
     eq_(Webapp.domain_from_url("http://mozilla.com/"), "http://mozilla.com")
예제 #22
0
 def test_no_normalize_www(self):
     eq_(Webapp.domain_from_url('http://www.mozilla.com/super/rad.webapp'),
         'http://www.mozilla.com')
예제 #23
0
 def test_simple(self):
     eq_(Webapp.domain_from_url('http://mozilla.com/'),
         'http://mozilla.com')
예제 #24
0
 def test_subdomains(self):
     eq_(Webapp.domain_from_url('http://apps.mozilla.com/'),
         'http://apps.mozilla.com')
예제 #25
0
 def test_long_path(self):
     eq_(Webapp.domain_from_url('http://mozilla.com/super/rad.webapp'),
         'http://mozilla.com')
예제 #26
0
 def test_normalize_case(self):
     eq_(Webapp.domain_from_url('httP://mOzIllA.com/'),
         'http://mozilla.com')
예제 #27
0
 def test_no_normalize_www(self):
     eq_(Webapp.domain_from_url('http://www.mozilla.com/super/rad.webapp'),
         'http://www.mozilla.com')
예제 #28
0
 def test_empty(self):
     Webapp.domain_from_url('')
예제 #29
0
 def test_with_port(self):
     eq_(Webapp.domain_from_url('http://mozilla.com:9000/'),
         'http://mozilla.com:9000')
예제 #30
0
 def test_subdomains(self):
     eq_(Webapp.domain_from_url('http://apps.mozilla.com/'),
         'http://apps.mozilla.com')
예제 #31
0
def run():
    for app in Webapp.objects.all():
        if app.manifest_url:
            app.update(app_domain=Webapp.domain_from_url(app.manifest_url))