Exemplo n.º 1
0
func verifyProject(projectObj project.Project, err error, context appengine.Context) (int, error) {
	if err != nil {
		log.Warnf(context, "Error polling graphite %v ", err.Error())
		return http.StatusInternalServerError, err
	} else if projectObj.GetConfig()["graphite.baseurl"] == "" {
		log.Warnf(context, "Error polling graphite, property graphite.base missing for project ")
		return http.StatusInternalServerError, errors.New("Property graphite.base missing for project")
	} else if projectObj.GetConfig()["graphite.lookback"] == "" {
		log.Warnf(context, "Error polling graphite, property graphite.lookback missing for project ")
		return http.StatusInternalServerError, errors.New("Property graphite.lookback missing for project")
	} else {
		return 0, nil
	}
}
Exemplo n.º 2
0
func IsUsernameAvailable(userName string, context appengine.Context) bool {
	var user UserData
	err := datastore.Get(context, datastore.NewKey(context,
		USER_KEY, userName, 0, nil), &user)

	if err == nil {
		return false
	} else if !strings.Contains(err.Error(), "no such entity") {
		log.Warnf(context, "Error checking for username availability %s", err.Error())
		return false
	} else {
		return true
	}
}