def validate_created_args(self, hackathon, args):
    self.log.debug(('create_register: %r' % args))
    user_id = args['user_id']
    register = self.get_registration_by_user_and_hackathon(user_id, hackathon.id)
    if ((register is not None) and (register.deleted == 0)):
        self.log.debug(('user %d already registered on hackathon %d' % (user_id, hackathon.id)))
        return (False, register.dic())
    if (hackathon.registration_start_time > self.util.get_now()):
        return (False, precondition_failed('hackathon registration not opened', friendly_message='报名尚未开始'))
    if (hackathon.registration_end_time < self.util.get_now()):
        return (False, precondition_failed('hackathon registration has ended', friendly_message='报名已经结束'))
    if (not self.check_register_enrollment(hackathon)):
        return (False, precondition_failed('hackathon registers reach the upper threshold', friendly_message='报名人数已满'))
    return (True, '')
def validate_created_args(self, hackathon, args):
    self.log.debug(('create_register: %r' % args))
    user_id = args['user_id']
    register = self.get_registration_by_user_and_hackathon(user_id, hackathon.id)
    if ((register is not None) and (register.deleted == 0)):
        self.log.debug(('user %d already registered on hackathon %d' % (user_id, hackathon.id)))
        return (False, register.dic())
    if (hackathon.registration_start_time > self.util.get_now()):
        return (False, precondition_failed('hackathon registration not opened', friendly_message='报名尚未开始'))
    if (hackathon.registration_end_time < self.util.get_now()):
        return (False, precondition_failed('hackathon registration has ended', friendly_message='报名已经结束'))
    if (not self.check_register_enrollment(hackathon)):
        return (False, precondition_failed('hackathon registers reach the upper threshold', friendly_message='报名人数已满'))
    return (True, )