#####################################################################
#####################################################################
## Copyright 2005 Steven R. Newcomb                                ##
##                                                                 ##
## This software is licensed under the Apache License, Version 2.0 ##
## (the "License"); you may not use this file except in compliance ##
## with the License.  Copies of the License are available at       ##
##        http://www.apache.org/licenses/LICENSE-2.0               ##
##                                                                 ##
## Unless required by applicable law or agreed to in writing,      ##
## software distributed under the License is distributed on an "AS ##
## IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either ##
## express or implied.  See the License for the specific language  ##
## governing permissions and limitations under the License.        ##
##                                                                 ##
## Copies of the source code and the license are available at      ##
##        http://www.versavant.org                                 ##
#####################################################################
#####################################################################

####################################
cvsRevision = "$Revision: 1.2 $" ##
####################################


import sys


#######################################################
def ValueIsInvalidFor_role_name_Property( vsv, propertyValue, propertyClass, propertyInstance = None, **args):
    if vsv.looksLikeProxyId( propertyValue):
        bool, proxyIdLookalikeREString = vsv.looksLikeProxyId( propertyValue)
        if propertyInstance:
            vsv.errMsg( 'value ("%s") of %s property is bad because it looks like a proxyId.  Role names cannot match the regular expression "%s".' % ( propertyValue, propertyInstance.propertyInstanceKey, proxyIdLookalikeREString))
        else:
            vsv.errMsg( 'presumptive value ("%s") of %s property is bad because it looks like a proxyId.  Role names cannot match the regular expression "%s".' % ( propertyValue, vsv.catKey( propertyClass.TMA.TMAName, propertyClass.propertyClassName), proxyIdLookalikeREString))
        return True
    return False
