From ebf1f121e754b95ae059ba5262445c19e283c7fe Mon Sep 17 00:00:00 2001 From: CoprDistGit Date: Fri, 5 May 2023 04:56:07 +0000 Subject: automatic import of python-django-upload-validator --- .gitignore | 1 + python-django-upload-validator.spec | 265 ++++++++++++++++++++++++++++++++++++ sources | 1 + 3 files changed, 267 insertions(+) create mode 100644 python-django-upload-validator.spec create mode 100644 sources diff --git a/.gitignore b/.gitignore index e69de29..6895e2f 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/django-upload-validator-1.1.6.tar.gz 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 `__: + +.. 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 `__: + +.. 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 `__: + +.. 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 - 1.1.6-1 +- Package Spec generated diff --git a/sources b/sources new file mode 100644 index 0000000..e651e5e --- /dev/null +++ b/sources @@ -0,0 +1 @@ +80af737ece530ebf8c382cbca66f778c django-upload-validator-1.1.6.tar.gz -- cgit v1.2.3