Пример #1
0
def patch_django():
    """earlier versions of Django do not have
    csrf token and function called import_library
    (the latter is needed by coffin)
    """
    (major, minor, micro) = package_utils.get_django_version()
    if major == 1 and minor < 2:
        django_patches.add_import_library_function()
        django_patches.add_csrf_protection()
        django_patches.add_available_attrs_decorator()

    if major == 1 and minor <= 2:
        django_patches.add_render_shortcut()

    if major == 1 and minor > 4:
        # This shouldn't be required with django < 1.4.x
        # And not after kee_lazy lands in django.utils.functional
        try:
            from django.utils.functional import keep_lazy
        except ImportError:
            django_patches.fix_lazy_double_escape()

    if major == 1 and minor > 5:
        django_patches.add_hashcompat()
        django_patches.add_simplejson()
Пример #2
0
def patch_django():
    """earlier versions of Django do not have
    csrf token and function called import_library
    (the latter is needed by coffin)
    """
    (major, minor, micro) = package_utils.get_django_version()
    if major == 1 and minor < 2:
        django_patches.add_import_library_function()
        django_patches.add_csrf_protection()
        django_patches.add_available_attrs_decorator()

    if major == 1 and minor <= 2:
        django_patches.add_render_shortcut()

    if major == 1 and minor > 4:
        # This shouldn't be required with django < 1.4.x
        # And not after kee_lazy lands in django.utils.functional
        try:
            from django.utils.functional import keep_lazy
        except ImportError:
            django_patches.fix_lazy_double_escape()

    if major == 1 and minor > 5:
        django_patches.add_hashcompat()
        django_patches.add_simplejson()

    if major == 1 and minor == 8:
        django_patches.patch_django_template()
Пример #3
0
def assert_package_compatibility():
    """raises an exception if any known incompatibilities
    are found
    """
    (django_major, django_minor, django_micro) = \
        package_utils.get_django_version()
    if django_major < 1:
        raise DeploymentError('Django version < 1.0 is not supported by askbot')
Пример #4
0
def patch_django():
    """earlier versions of Django do not have
    csrf token and function called import_library
    (the latter is needed by coffin)
    """
    (major, minor, micro) = package_utils.get_django_version()
    if major == 1 and minor < 2:
        django_patches.add_import_library_function()
        django_patches.add_csrf_protection()
Пример #5
0
def patch_django():
    """earlier versions of Django do not have
    csrf token and function called import_library
    (the latter is needed by coffin)
    """
    (major, minor, micro) = package_utils.get_django_version()
    if major == 1 and minor < 2:
        django_patches.add_import_library_function()
        django_patches.add_csrf_protection()
Пример #6
0
    def handle(self, *arguments, **options):
        self.parse_positional_arguments(*arguments)

        django_version = package_utils.get_django_version()

        for rel in User._meta.get_all_related_objects():
            self.process_relation(rel)

        for rel in User._meta.get_all_related_many_to_many_objects():
            self.process_m2m(rel)

        self.process_custom_user_fields()
        self.cleanup()
Пример #7
0
    def handle(self, *arguments, **options):
        self.parse_positional_arguments(*arguments)

        django_version = package_utils.get_django_version()

        for rel in User._meta.get_all_related_objects():
            self.process_relation(rel)

        for rel in User._meta.get_all_related_many_to_many_objects():
            self.process_m2m(rel)

        self.process_custom_user_fields()
        self.cleanup()
def assert_package_compatibility():
    """raises an exception if any known incompatibilities 
    are found
    """
    (django_major, django_minor, django_micro) = package_utils.get_django_version()
    if django_major < 1:
        raise DeploymentError('Django version < 1.0 is not supported by askbot')

    coffin_version = package_utils.get_coffin_version()
    if coffin_version == (0, 3, 0) and django_major == 1 and django_minor > 1:
        raise DeploymentError(
            'Coffin package version 0.3 is not compatible '
            'with the current version of Django, please upgrade '
            'coffin to at least 0.3.3'
        )
Пример #9
0
def assert_package_compatibility():
    """raises an exception if any known incompatibilities 
    are found
    """
    (django_major, django_minor, django_micro) = \
        package_utils.get_django_version()
    if django_major < 1:
        raise DeploymentError(
            'Django version < 1.0 is not supported by askbot')

    coffin_version = package_utils.get_coffin_version()
    if coffin_version == (0, 3, 0) and django_major == 1 and django_minor > 1:
        raise DeploymentError(
            'Coffin package version 0.3 is not compatible '
            'with the current version of Django, please upgrade '
            'coffin to at least 0.3.3')
Пример #10
0
def patch_django():
    (major, minor, micro) = package_utils.get_django_version()

    if major == 1 and minor > 4:
        # This shouldn't be required with django < 1.4.x
        # And not after kee_lazy lands in django.utils.functional
        try:
            from django.utils.functional import keep_lazy
        except ImportError:
            django_patches.fix_lazy_double_escape()

    if major == 1 and minor > 5:
        django_patches.add_hashcompat()
        django_patches.add_simplejson()

    if major == 1 and minor == 8:
        django_patches.patch_django_template()
Пример #11
0
    def handle(self, *arguments, **options):
        self.parse_arguments(*arguments)

        django_version = package_utils.get_django_version()

        for rel in User._meta.get_all_related_objects():
            if django_version < (1, 6):
                self.process_relation_legacy(rel)
            else:
                self.process_relation(rel)

        for rel in User._meta.get_all_related_many_to_many_objects():
            if django_version < (1, 6):
                self.process_m2m_legacy(rel)
            else:
                self.process_m2m(rel)

        self.process_custom_user_fields()
        self.cleanup()
        transaction.commit()
Пример #12
0
    def handle(self, *arguments, **options):
        self.parse_arguments(*arguments)

        django_version = package_utils.get_django_version()

        for rel in User._meta.get_all_related_objects():
            if django_version < (1, 6):
                self.process_relation_legacy(rel)
            else:
                self.process_relation(rel)

        for rel in User._meta.get_all_related_many_to_many_objects():
            if django_version < (1, 6):
                self.process_m2m_legacy(rel)
            else:
                self.process_m2m(rel)

        self.process_custom_user_fields()
        self.cleanup()
        transaction.commit()