Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
account_key_file_le_reg = FieldStorageUploadConverter(
not_empty=False, if_missing=None
)
acme_account_provider_id = Int(not_empty=False, if_missing=None)
private_key_option = OneOf(model_utils.PrivateKey_options_a, not_empty=True,)
private_key_existing = UnicodeString(not_empty=False, if_missing=None)
private_key_file_pem = FieldStorageUploadConverter(not_empty=False, if_missing=None)
class _form_AcmeAccount_PrivateKey_reuse(_form_AcmeAccount_PrivateKey_core):
"""this is a mix of two forms, because FormEncode doesn't support multiple class inheritance
"""
account_key_option = OneOf(model_utils.AcmeAccontKey_options_b, not_empty=True,)
account_key_reuse = UnicodeString(not_empty=False, if_missing=None)
private_key_option = OneOf(model_utils.PrivateKey_options_b, not_empty=True,)
private_key_reuse = UnicodeString(not_empty=False, if_missing=None)
class Form_AcmeAccount_edit(_Form_Schema_Base):
# this is the `private_key_cycle` of the AcmeAccount
account__private_key_cycle = OneOf(
model_utils.PrivateKeyCycle._options_AcmeAccount_private_key_cycle,
not_empty=True,
)
class Form_AcmeAccount_new__auth(_Form_Schema_Base):
acme_account_provider_id = Int(not_empty=True, if_missing=None)
account__contact = Email(not_empty=True, if_missing=None) # use it or don't
def _to_python(self, value, state):
return [self.subvalidator.to_python(v)
for v in str(value).split(self.separator)]
class PlatformValidator(formencode.FancyValidator):
def _to_python(self, value, state):
return platformList[str(value)]
class BaseLimit(object):
"""A base class which validates date/branch/product/version/buildid conditions for
multiple searches."""
datetime_validator = formencode.validators.Regex(
'^\\d{4}-\\d{2}-\\d{2}( \\d{2}:\\d{2}(:\\d{2})?)?$', strip=True
)
range_unit_validator = formencode.validators.OneOf(
rangeTypes.keys()
)
version_validator = ListValidator(ProductVersionValidator())
stringlist_validator = ListValidator(formencode.validators.String(strip=True))
platform_validator = ListValidator(PlatformValidator())
query_validator = formencode.validators.OneOf(['signature', 'stack'])
type_validator = formencode.validators.OneOf(['exact', 'startswith', 'contains'])
signature_validator = formencode.validators.String(strip=True, if_empty=None)
@staticmethod
def limit_range(range):
(num, unit) = range
num = min(num * rangeTypes[unit], maxSearchHours) / rangeTypes[unit]
return (num, unit)
def __init__(self, date=None, range=None,
class _form_AcmeAccount_PrivateKey_reuse(_form_AcmeAccount_PrivateKey_core):
"""this is a mix of two forms, because FormEncode doesn't support multiple class inheritance
"""
account_key_option = OneOf(model_utils.AcmeAccontKey_options_b, not_empty=True,)
account_key_reuse = UnicodeString(not_empty=False, if_missing=None)
private_key_option = OneOf(model_utils.PrivateKey_options_b, not_empty=True,)
private_key_reuse = UnicodeString(not_empty=False, if_missing=None)
class Form_AcmeAccount_edit(_Form_Schema_Base):
# this is the `private_key_cycle` of the AcmeAccount
account__private_key_cycle = OneOf(
model_utils.PrivateKeyCycle._options_AcmeAccount_private_key_cycle,
not_empty=True,
)
class Form_AcmeAccount_new__auth(_Form_Schema_Base):
acme_account_provider_id = Int(not_empty=True, if_missing=None)
account__contact = Email(not_empty=True, if_missing=None) # use it or don't
# this is the `private_key_cycle` of the AcmeAccount
account__private_key_cycle = OneOf(
model_utils.PrivateKeyCycle._options_AcmeAccount_private_key_cycle,
not_empty=True,
)
# these are via Form_AcmeAccount_new__file
account_key_file_pem = FieldStorageUploadConverter(not_empty=False, if_missing=None)
account_key_file_le_meta = FieldStorageUploadConverter(
not_empty=False, if_missing=None
)
account_key_file_le_pkey = FieldStorageUploadConverter(
not_empty=False, if_missing=None
)
account_key_file_le_reg = FieldStorageUploadConverter(
not_empty=False, if_missing=None
)
acme_account_provider_id = Int(not_empty=False, if_missing=None)
class _form_PrivateKey_core(_Form_Schema_Base):
private_key_option = OneOf(model_utils.PrivateKey_options_a, not_empty=True,)
private_key_existing = UnicodeString(not_empty=False, if_missing=None)
private_key_file_pem = FieldStorageUploadConverter(not_empty=False, if_missing=None)
class _form_AcmeAccount_reuse(_form_AcmeAccount_core):
account_key_option = OneOf(model_utils.AcmeAccontKey_options_b, not_empty=True,)
account_key_reuse = UnicodeString(not_empty=False, if_missing=None)
class _form_PrivateKey_reuse(_form_PrivateKey_core):
private_key_option = OneOf(model_utils.PrivateKey_options_b, not_empty=True)
private_key_reuse = UnicodeString(not_empty=False, if_missing=None)
class _form_AcmeAccount_PrivateKey_core(_Form_Schema_Base):
"""this is a mix of two forms, because FormEncode doesn't support multiple class inheritance
class ImportForm(formencode.Schema):
"""
Validate for Import Connectivity Form
"""
server_ip = validators.IPAddress(not_empty=True)
username = validators.UnicodeString(not_empty=True)
password = validators.UnicodeString()
threads_number = validators.Number()
dti_scans = FileUploadValidator()
subject_name = validators.UnicodeString()
subject_sex = validators.OneOf(['Any', 'Male', 'Female'])
subject_age = validators.Number()
subject_race = validators.UnicodeString()
subject_nationality = validators.UnicodeString()
subject_education = validators.UnicodeString()
subject_health = validators.UnicodeString()
for xi in letsencrypt_info.CA_AUTH_X:
Form_CACertificate_UploadBundle__file.add_field(
"le_%s_auth_file" % xi,
FieldStorageUploadConverter(not_empty=False, if_missing=None),
)
class Form_Certificate_Upload__file(_Form_Schema_Base):
private_key_file_pem = FieldStorageUploadConverter(not_empty=True)
certificate_file = FieldStorageUploadConverter(not_empty=True)
chain_file = FieldStorageUploadConverter(not_empty=True)
class Form_CoverageAssuranceEvent_mark(_Form_Schema_Base):
action = OneOf(("resolution"), not_empty=True,)
resolution = OneOf(
model_utils.CoverageAssuranceResolution.OPTIONS_ALL, not_empty=True
)
class Form_Domain_new(_Form_Schema_Base):
domain_name = UnicodeString(not_empty=True)
class Form_Domain_mark(_Form_Schema_Base):
action = OneOf(("active", "inactive"), not_empty=True)
class Form_Domain_search(_Form_Schema_Base):
domain = UnicodeString(not_empty=True)
for xi in letsencrypt_info.CA_AUTH_X:
Form_CACertificate_UploadBundle__file.add_field(
"le_%s_auth_file" % xi,
FieldStorageUploadConverter(not_empty=False, if_missing=None),
)
class Form_Certificate_Upload__file(_Form_Schema_Base):
private_key_file_pem = FieldStorageUploadConverter(not_empty=True)
certificate_file = FieldStorageUploadConverter(not_empty=True)
chain_file = FieldStorageUploadConverter(not_empty=True)
class Form_CoverageAssuranceEvent_mark(_Form_Schema_Base):
action = OneOf(("resolution"), not_empty=True,)
resolution = OneOf(
model_utils.CoverageAssuranceResolution.OPTIONS_ALL, not_empty=True
)
class Form_Domain_new(_Form_Schema_Base):
domain_name = UnicodeString(not_empty=True)
class Form_Domain_mark(_Form_Schema_Base):
action = OneOf(("active", "inactive"), not_empty=True)
class Form_Domain_search(_Form_Schema_Base):
domain = UnicodeString(not_empty=True)
class Form_AcmeOrder_new_freeform(_form_AcmeAccount_PrivateKey_core):
domain_names = UnicodeString(not_empty=True)
processing_strategy = OneOf(
model_utils.AcmeOrder_ProcessingStrategy.OPTIONS_ALL, not_empty=True,
)
# this is the `private_key_cycle` of the AcmeOrder renewals
private_key_cycle__renewal = OneOf(
model_utils.PrivateKeyCycle._options_AcmeOrder_private_key_cycle,
not_empty=True,
)
class Form_AcmeOrder_renew_quick(_Form_Schema_Base):
processing_strategy = OneOf(
model_utils.AcmeOrder_ProcessingStrategy.OPTIONS_ALL, not_empty=True,
)
class Form_AcmeOrder_renew_custom(_form_AcmeAccount_PrivateKey_reuse):
processing_strategy = OneOf(
model_utils.AcmeOrder_ProcessingStrategy.OPTIONS_ALL, not_empty=True,
)
# this is the `private_key_cycle` of the AcmeOrder renewals
private_key_cycle__renewal = OneOf(
model_utils.PrivateKeyCycle._options_AcmeOrder_private_key_cycle,
not_empty=True,
)
def _modify_schema(schema):
convert_from_tags = get_converter('convert_to_tags')
convert_to_extras = get_converter('convert_to_extras')
# Required fields
schema['title'] = [not_empty, string_max_length(255), unicode]
schema['notes'] = [not_empty, string_max_length(4000), unicode]
schema['author'] = [not_empty, unicode]
schema['resources']['name'] = [not_empty, string_max_length(255), unicode]
# Add new fields
schema[DATASET_TYPE_VOCABULARY] = [not_empty, convert_from_tags(DATASET_TYPE_VOCABULARY)]
schema['temporal_extent'] = [ignore_missing, unicode, convert_to_extras]
schema['affiliation'] = [ignore_missing, unicode, convert_to_extras]
schema['contributors'] = [ignore_missing, unicode, convert_to_extras]
schema['update_frequency'] = [ignore_missing, OneOf([v[0] for v in UPDATE_FREQUENCIES]), convert_to_extras, unicode]
schema['promoted'] = [ignore_missing, convert_to_extras, boolean_validator]
schema['spatial'] = [ignore_missing, convert_to_extras]