summaryrefslogtreecommitdiff
path: root/python-django-upload-validator.spec
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2023-05-05 04:56:07 +0000
committerCoprDistGit <infra@openeuler.org>2023-05-05 04:56:07 +0000
commitebf1f121e754b95ae059ba5262445c19e283c7fe (patch)
treeca54136bc47443113901de60bf23fafd20e7a61c /python-django-upload-validator.spec
parenta886bb9c7a21ed3a6621ac80bf87521eea43ca03 (diff)
automatic import of python-django-upload-validatoropeneuler20.03
Diffstat (limited to 'python-django-upload-validator.spec')
-rw-r--r--python-django-upload-validator.spec265
1 files changed, 265 insertions, 0 deletions
diff --git a/python-django-upload-validator.spec b/python-django-upload-validator.spec
new file mode 100644
index 0000000..b6a88ef
--- /dev/null
+++ b/python-django-upload-validator.spec
@@ -0,0 +1,265 @@
+%global _empty_manifest_terminate_build 0
+Name: python-django-upload-validator
+Version: 1.1.6
+Release: 1
+Summary: A simple Django file type validator using python-magic
+License: MIT
+URL: https://github.com/naeem91/django-upload-validator
+Source0: https://mirrors.nju.edu.cn/pypi/web/packages/ed/99/f4476cb7350ea6fef1f037a6346be635754ff4e870b323a562a5151fe2a9/django-upload-validator-1.1.6.tar.gz
+BuildArch: noarch
+
+Requires: python3-magic
+
+%description
+***********************
+Django Upload Validator
+***********************
+.. image:: https://circleci.com/gh/naeem91/django-upload-validator/tree/master.svg?style=svg
+ :target: https://circleci.com/gh/naeem91/django-upload-validator/tree/master
+
+
+Django Upload Validator is a simple utility for validating file types and extensions using `python-magic` library.
+
+Installation
+############
+
+Install the `current PyPI release <https://pypi.python.org/pypi/django-upload-validator>`__:
+
+.. code:: bash
+
+ pip install django-upload-validator
+
+Usage
+#####
+General usage
+::
+
+ from upload_validator import FileTypeValidator
+
+ validator = FileTypeValidator(
+ allowed_types=['application/msword'],
+ allowed_extensions=['.doc', '.docx']
+ )
+
+ file_resource = open('sample.doc')
+
+ # ValidationError will be raised in case of invalid type or extension
+ validator(file_resource)
+
+Usage as a FileField validator in Django forms
+::
+
+ from upload_validator import FileTypeValidator
+
+ profile_image = forms.FileField(
+ label='', help_text="Formats accepted: JPEG nd PNG", required=False,
+ validators=[FileTypeValidator(
+ allowed_types=[ 'image/jpeg','image/png']
+ )]
+ )
+
+Wildcard character specification is also supported. e.g; for accepting only images:
+::
+
+ profile_image = forms.FileField(
+ label='', help_text="Only image formats are accepted.", required=False,
+ validators=[FileTypeValidator(
+ allowed_types=[ 'image/*']
+ )]
+ )
+
+
+Running Tests
+#############
+#. Install testing requirements :code:`pip install -r tests/requirements.txt`
+#. Run :code:`python runtests.py` inside the root directory of package
+
+
+
+
+%package -n python3-django-upload-validator
+Summary: A simple Django file type validator using python-magic
+Provides: python-django-upload-validator
+BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+BuildRequires: python3-pip
+%description -n python3-django-upload-validator
+***********************
+Django Upload Validator
+***********************
+.. image:: https://circleci.com/gh/naeem91/django-upload-validator/tree/master.svg?style=svg
+ :target: https://circleci.com/gh/naeem91/django-upload-validator/tree/master
+
+
+Django Upload Validator is a simple utility for validating file types and extensions using `python-magic` library.
+
+Installation
+############
+
+Install the `current PyPI release <https://pypi.python.org/pypi/django-upload-validator>`__:
+
+.. code:: bash
+
+ pip install django-upload-validator
+
+Usage
+#####
+General usage
+::
+
+ from upload_validator import FileTypeValidator
+
+ validator = FileTypeValidator(
+ allowed_types=['application/msword'],
+ allowed_extensions=['.doc', '.docx']
+ )
+
+ file_resource = open('sample.doc')
+
+ # ValidationError will be raised in case of invalid type or extension
+ validator(file_resource)
+
+Usage as a FileField validator in Django forms
+::
+
+ from upload_validator import FileTypeValidator
+
+ profile_image = forms.FileField(
+ label='', help_text="Formats accepted: JPEG nd PNG", required=False,
+ validators=[FileTypeValidator(
+ allowed_types=[ 'image/jpeg','image/png']
+ )]
+ )
+
+Wildcard character specification is also supported. e.g; for accepting only images:
+::
+
+ profile_image = forms.FileField(
+ label='', help_text="Only image formats are accepted.", required=False,
+ validators=[FileTypeValidator(
+ allowed_types=[ 'image/*']
+ )]
+ )
+
+
+Running Tests
+#############
+#. Install testing requirements :code:`pip install -r tests/requirements.txt`
+#. Run :code:`python runtests.py` inside the root directory of package
+
+
+
+
+%package help
+Summary: Development documents and examples for django-upload-validator
+Provides: python3-django-upload-validator-doc
+%description help
+***********************
+Django Upload Validator
+***********************
+.. image:: https://circleci.com/gh/naeem91/django-upload-validator/tree/master.svg?style=svg
+ :target: https://circleci.com/gh/naeem91/django-upload-validator/tree/master
+
+
+Django Upload Validator is a simple utility for validating file types and extensions using `python-magic` library.
+
+Installation
+############
+
+Install the `current PyPI release <https://pypi.python.org/pypi/django-upload-validator>`__:
+
+.. code:: bash
+
+ pip install django-upload-validator
+
+Usage
+#####
+General usage
+::
+
+ from upload_validator import FileTypeValidator
+
+ validator = FileTypeValidator(
+ allowed_types=['application/msword'],
+ allowed_extensions=['.doc', '.docx']
+ )
+
+ file_resource = open('sample.doc')
+
+ # ValidationError will be raised in case of invalid type or extension
+ validator(file_resource)
+
+Usage as a FileField validator in Django forms
+::
+
+ from upload_validator import FileTypeValidator
+
+ profile_image = forms.FileField(
+ label='', help_text="Formats accepted: JPEG nd PNG", required=False,
+ validators=[FileTypeValidator(
+ allowed_types=[ 'image/jpeg','image/png']
+ )]
+ )
+
+Wildcard character specification is also supported. e.g; for accepting only images:
+::
+
+ profile_image = forms.FileField(
+ label='', help_text="Only image formats are accepted.", required=False,
+ validators=[FileTypeValidator(
+ allowed_types=[ 'image/*']
+ )]
+ )
+
+
+Running Tests
+#############
+#. Install testing requirements :code:`pip install -r tests/requirements.txt`
+#. Run :code:`python runtests.py` inside the root directory of package
+
+
+
+
+%prep
+%autosetup -n django-upload-validator-1.1.6
+
+%build
+%py3_build
+
+%install
+%py3_install
+install -d -m755 %{buildroot}/%{_pkgdocdir}
+if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
+if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
+if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
+if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
+pushd %{buildroot}
+if [ -d usr/lib ]; then
+ find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/lib64 ]; then
+ find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/bin ]; then
+ find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/sbin ]; then
+ find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+touch doclist.lst
+if [ -d usr/share/man ]; then
+ find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
+fi
+popd
+mv %{buildroot}/filelist.lst .
+mv %{buildroot}/doclist.lst .
+
+%files -n python3-django-upload-validator -f filelist.lst
+%dir %{python3_sitelib}/*
+
+%files help -f doclist.lst
+%{_docdir}/*
+
+%changelog
+* Fri May 05 2023 Python_Bot <Python_Bot@openeuler.org> - 1.1.6-1
+- Package Spec generated