# $SnapHashLicense:
#
# SnapLogic - Open source data services
#
# Copyright (C) 2009, SnapLogic, Inc. All rights reserved.
#
# See http://www.snaplogic.org for more information about
# the SnapLogic project.
#
# This program is free software, distributed under the terms of
# the GNU General Public License Version 2. See the LEGAL file
# at the top of the source tree.
#
# "SnapLogic" is a trademark of SnapLogic, Inc.
#
#
# $
# $Id: validation_utils1.py 7423 2009-04-28 18:54:56Z grisha $
from snaplogic.common.prop_err import FIELD_AND_VIEW_NAME_PATTERN
def validate_field_name(fname):
"""
Utility method to validate that a field name has valid characters in it.
@param fname: Name of the field to validate.
@type fname: str
@return: None if the name is valid, else an error string.
@rtype: str
"""
m = FIELD_AND_VIEW_NAME_PATTERN.search(fname)
if m is not None:
return "Field name '%s' has invalid character(s) '%s'" % (fname, m.group(0))
return None
|