@@ 3,12 3,12 @@ from django import forms
from django.conf import settings
from django.core.exceptions import PermissionDenied
-from .settings import FORM_GUARD_MIN_VALUE
+from .settings import FORM_GUARD_MIN_VALUE, FORM_GUARD_FORCE_VALIDATION
def clean_func(self):
antispam = self.cleaned_data.get(self.FORM_GUARD_FIELD_NAME)
- if settings.DEBUG:
+ if settings.DEBUG and not FORM_GUARD_FORCE_VALIDATION:
return antispam
try:
antispam = int(antispam)
@@ 3,3 3,8 @@ from django.conf import settings
FORM_GUARD_MIN_VALUE = getattr(settings, 'FORM_GUARD_MIN_VALUE', 5)
+FORM_GUARD_FORCE_VALIDATION = getattr(
+ settings,
+ 'FORM_GUARD_FORCE_VALIDATION',
+ False,
+)
@@ 1,53 1,24 @@
import os
-from distutils.core import setup
-
-project_name = 'form_guard'
-
-# Idea from django-registration setup.py
-packages, data_files = [], []
-root_dir = os.path.dirname(__file__)
-if root_dir:
- os.chdir(root_dir)
+from setuptools import setup, find_packages
-for dirpath, dirnames, filenames in os.walk(project_name):
- # Ignore dirnames that start with '.'
- for i, dirname in enumerate(dirnames):
- if dirname.startswith('.') or dirname == '__pycache__':
- del dirnames[i]
- if '__init__.py' in filenames:
- pkg = dirpath.replace(os.path.sep, '.')
- if os.path.altsep:
- pkg = pkg.replace(os.path.altsep, '.')
- packages.append(pkg)
- elif filenames:
- prefix = dirpath[(len(project_name) + 1):]
- for f in filenames:
- data_files.append(os.path.join(prefix, f))
setup(
name='django-form-guard',
- version=__import__(project_name).get_version(),
- package_dir={project_name: project_name},
- packages=packages,
- package_data={project_name: data_files},
- description='Django Form Guard',
+ version=__import__('form_guard').get_version(),
+ packages=find_packages(),
+ description='Django App To Protect Your Forms From Spam Bots',
author='Netlandish Inc.',
- author_email='geeks@netlandish.com',
- license='BSD License',
- url='http://bitbucket.org/netlandish/django-form-guard/',
- long_description='Django Form Guard',
- install_requires=['Django >= 1.7.0'],
+ author_email='hello@netlandish.com',
+ url='https://bitbucket.org/netlandish/django-form-guard/',
platforms=['any'],
classifiers=[
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
- 'License :: OSI Approved :: BSD License',
'Natural Language :: English',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 2.7',
- 'Programming Language :: Python :: 3.3',
- 'Programming Language :: Python :: 3.4',
'Environment :: Web Environment',
],
+ include_package_data=True,
)