Allura/allura/lib/plugin.py
def validate_project(self, neighborhood, shortname, project_name, user, user_project, private_project):
        '''
        Validate that a project can be registered, before it is
        '''
        from allura import model as M

        # Check for private project rights
        if neighborhood.features['private_projects'] is False and private_project:
            raise ValueError(
                "You can't create private projects for %s neighborhood" %
                neighborhood.name)

        # Check for project limit creation
        nb_max_projects = neighborhood.get_max_projects()
        if nb_max_projects is not None:
            count = M.Project.query.find(dict(
                neighborhood_id=neighborhood._id,
                deleted=False,
                is_nbhd_project=False,
            )).count()
            if count >= nb_max_projects:
                log.exception('Error registering project %s' % project_name)
                raise forge_exc.ProjectOverlimitError()

        self.rate_limit(user, neighborhood)

        if not self.phone_verified(user, neighborhood) and not user_project:
            raise forge_exc.ProjectPhoneVerificationError()

        if user_project and shortname.startswith('u/'):
            check_shortname = shortname.replace('u/', '', 1)
        else:
            check_shortname = shortname
        self.shortname_validator.to_python(check_shortname, neighborhood=neighborhood)

        p = M.Project.query.get(shortname=shortname, neighborhood_id=neighborhood._id)
        if p:
            raise forge_exc.ProjectConflict(
                '%s already exists in nbhd %s' % (shortname, neighborhood._id))

        Validate that a project can be registered, before it is
        
Validate that a project can be registered, before it is
Validate that a project can be registered before it is
def validate_project(self, neighborhood, shortname, project_name, user, user_project, private_project):
        from allura import model as M
        if neighborhood.features['private_projects'] is False and private_project:
            raise ValueError(
                "You can't create private projects for %s neighborhood" %
                neighborhood.name)
        nb_max_projects = neighborhood.get_max_projects()
        if nb_max_projects is not None:
            count = M.Project.query.find(dict(
                neighborhood_id=neighborhood._id,
                deleted=False,
                is_nbhd_project=False,
            )).count()
            if count >= nb_max_projects:
                log.exception('Error registering project %s' % project_name)
                raise forge_exc.ProjectOverlimitError()
        self.rate_limit(user, neighborhood)
        if not self.phone_verified(user, neighborhood) and not user_project:
            raise forge_exc.ProjectPhoneVerificationError()
        if user_project and shortname.startswith('u/'):
            check_shortname = shortname.replace('u/', '', 1)
        else:
            check_shortname = shortname
        self.shortname_validator.to_python(check_shortname, neighborhood=neighborhood)
        p = M.Project.query.get(shortname=shortname, neighborhood_id=neighborhood._id)
        if p:
            raise forge_exc.ProjectConflict(
                '%s already exists in nbhd %s' % (shortname, neighborhood._id))
def validate_project ( self , neighborhood , shortname , project_name , user , user_project , private_project ) : from allura import model as M if neighborhood . features [ 'private_projects' ] is False and private_project : raise ValueError ( "You can't create private projects for %s neighborhood" % neighborhood . name ) nb_max_projects = neighborhood . get_max_projects ( ) if nb_max_projects is not None : count = M . Project . query . find ( dict ( neighborhood_id = neighborhood . _id , deleted = False , is_nbhd_project = False , ) ) . count ( ) if count >= nb_max_projects : log . exception ( 'Error registering project %s' % project_name ) raise forge_exc . ProjectOverlimitError ( ) self . rate_limit ( user , neighborhood ) if not self . phone_verified ( user , neighborhood ) and not user_project : raise forge_exc . ProjectPhoneVerificationError ( ) if user_project and shortname . startswith ( 'u/' ) : check_shortname = shortname . replace ( 'u/' , '' , 1 ) else : check_shortname = shortname self . shortname_validator . to_python ( check_shortname , neighborhood = neighborhood ) p = M . Project . query . get ( shortname = shortname , neighborhood_id = neighborhood . _id ) if p : raise forge_exc . ProjectConflict ( '%s already exists in nbhd %s' % ( shortname , neighborhood . _id ) )
Validate that a project can be registered, before it is
Validate that a project can be registered before it is
'''
        Validate that a project can be registered, before it is
        ''' # Check for private project rights # Check for project limit creation
self
neighborhood
shortname
project_name
user
user_project
private_project