Esempio n. 1
0
 def is_slug_valid(self):
     slug = request.params.get('slug') or ''
     slugtype = request.params.get('type') or ''
     if slugtype == u'package':
         response_data = dict(valid=not bool(package_exists(slug)))
         return self._finish_ok(response_data)
     if slugtype == u'group':
         response_data = dict(valid=not bool(group_exists(slug)))
         return self._finish_ok(response_data)
     return self._finish_bad_request('Bad slug type: %s' % slugtype)
Esempio n. 2
0
 def is_slug_valid(self):
     slug = request.params.get('slug') or ''
     slugtype = request.params.get('type') or ''
     if slugtype==u'package':
         response_data = dict(valid=not bool(package_exists(slug)))
         return self._finish_ok(response_data)
     if slugtype==u'group':
         response_data = dict(valid=not bool(group_exists(slug)))
         return self._finish_ok(response_data)
     return self._finish_bad_request(gettext('Bad slug type: %s') % slugtype)
Esempio n. 3
0
 def is_slug_valid(self):
     slug = request.params.get("slug") or ""
     slugtype = request.params.get("type") or ""
     if slugtype == u"package":
         response_data = dict(valid=not bool(package_exists(slug)))
         return self._finish_ok(response_data)
     if slugtype == u"group":
         response_data = dict(valid=not bool(group_exists(slug)))
         return self._finish_ok(response_data)
     return self._finish_bad_request("Bad slug type: %s" % slugtype)
Esempio n. 4
0
    def create_slug(self):

        title = request.params.get('title') or ''
        name = munge_title_to_name(title)
        if package_exists(name):
            valid = False
        else:
            valid = True
        #response.content_type = 'application/javascript'
        response_data = dict(name=name.replace('_', '-'), valid=valid)
        return self._finish_ok(response_data)
Esempio n. 5
0
    def create_slug(self):

        title = request.params.get('title') or ''
        name = munge_title_to_name(title)
        if package_exists(name):
            valid = False
        else:
            valid = True
        #response.content_type = 'application/javascript'
        response_data = dict(name=name.replace('_', '-'), valid=valid)
        return self._finish_ok(response_data)
Esempio n. 6
0
 def is_slug_valid(self):
     slug = request.params.get('slug') or ''
     slugtype = request.params.get('type') or ''
     disallowed = ['new', 'edit', 'search']
     if slugtype==u'package':
         response_data = dict(valid=not bool(common.package_exists(slug)
                              or slug in disallowed ))
         return self._finish_ok(response_data)
     if slugtype==u'group':
         response_data = dict(valid=not bool(common.group_exists(slug) or
                             slug in disallowed ))
         return self._finish_ok(response_data)
     return self._finish_bad_request('Bad slug type: %s' % slugtype)