Commit Graph

16 Commits

Author SHA1 Message Date
Benjamin Dauvergne 46f56b3808 misc: move AddIndex to end of 0002 migration (#39544)
Automatic generation does not sort AddIndex for manual indexes correctly
with respect to Remove/AddField.
2020-04-15 11:02:53 +02:00
Benjamin Dauvergne c8de0807ac misc: add proper 0002 migration (#39544)
0001 should never be modified apart from cosmetic changes.
2020-04-15 10:47:26 +02:00
Benjamin Dauvergne d02c2dc884 misc: remove explicit byte string in migrations for py3 (#39544) 2020-04-15 10:40:53 +02:00
Benjamin Dauvergne 8cd865d3f9 misc: fix package path in migration (#39544) 2020-04-15 10:40:36 +02:00
Benjamin Dauvergne da8822e821 misc: restore initial 0001 migration (#39544) 2020-04-15 10:31:37 +02:00
Emmanuel Cazenave 671afb17ec migration: use text instead of bytes (#39533) 2020-02-04 17:01:46 +01:00
Michael Bideau a739371cef Features: adding verbose name to all fields (mainly ForwardFile ones) 2019-08-22 16:41:28 +00:00
Michael Bideau 2786bc29e7 License: prepended license text to most files 2019-08-21 15:02:33 +00:00
Michael Bideau 35fe3e7411 Setup.py: added locales compilation; Locales: added 'fr' PO file; Fixes: semantics and typos 2019-08-21 14:22:35 +00:00
Michael Bideau 990f1fb7bc Added 'guichet' (planned availability), added CRUD views for each entity, many fixes and refactoring
Features:
    * A connector now can be associated with 'collectivites',
      and each of them can have one 'guichet'.
      A 'collectivite' have a name and an openADS technical identifier
      A 'guichet' allow to define hours and days for when its 'collectivite' is "open"
    * Each of those entities have a view to CRUD it

    * For entity ForwardFile:
       - Added association with a connector, and eventually a 'collectivite'
       - Added ForwardFiles 'size' field
       - Added updating fields 'content_type', 'file_hash' and 'size' on save()
       - Added custom validation on save()

    * For entity AtrealOpenads:
       - Added permissions on each endpoint
       - Added 'email' field support for each type of 'demandeur'
       - 'numero_dossier' is now required in the url for some endpoints (previously was a GET param)
       - Added 'upload_user_files' as an endpoint (but can still be used as a method with request=None)
       - The 'upload_user_files()' method now only handle forward file that have status='pending'

Fixes:
    * Added "*args" and "**kwargs" arguments to some connector endpoint methods
    * Added 'verbose_name' and 'ordering' on each entity META
    * Added decorator '@force_encoded_string_output' to prevent utf-8 issues with python2
    * Added __repr__, __str__ and __unicode__ functions to each entities
    * Added database indexes for each entity
    * Commented out useless JSON schema imports
    * Removed unused variable assignations

Refactoring:
    * Moved utilities functions to utils.py file
    * Added a BaseModel to provide some default functions for Models
    * Added enum/translations of hard-coded values for ForwardFile 'upload_status' field

Tests:
    * Added test for each entity
    * Added tests files specific to utilities, forms and views
    * Total code coverage is 99% with only 10 statement missed
2019-08-20 17:00:12 +00:00
Michael Bideau 62dae769d6 Refactoring: remove 'extra_debug' field and replaced all 'self.debug' calls by 'self.logger.debug' 2019-07-18 22:54:50 +02:00
Michael Bideau 02f4a071fc Use HTTPResource, JSON schema for inputs, JSON lazy logging, added ForwardFile.attempt, and more
Features:
    * class AtrealOpenads now extends HTTPResource for HTTP Basic credentials
    * check_status is now also an endpoint (endpoint 'test_openads_connexion' deleted)
    * added JSON schema to validate POST request input (ouput schemas are defined too but unused for now)
    * added class 'LogJsonPayloadWithFileContent' to lazy log a json payload with content file filtered
    * added 'attempt' field to class 'ForwardFile' that count the attempt of uploading to openADS.API
    * added more controls over response data received

Refactoring:
    * removed the file content in function 'get_fwd_files_status()' and added content size instead
    * splitted the function 'get_fwd_files_status()' in two: one that retrieve detailed files, one only the summary
    * added function 'log_json_payload()' to help to log json payloads
    * added 2 functions to factorize the process of getting files from json payload
    * added function 'check_file_dict()' to factorize the process of checking a file dictionary

Fixes:
    * Default filename are now under 50 chars
    * Make the function 'get_fwd_files_status()' consistent in its return

Tests:
    * updated the test to reflect the use of HTTPResource and the split of 'get_fwd_files_status()'

More:
    * Added a lot of comments
    * Added endpoint anotation to validate response body, but its commented as the 'get' helper is not defined (not like the 'post' one)
2019-07-18 21:47:38 +02:00
Michael Bideau 8593779954 Added testing with tox, added AGPLv3 license, replaced namespace, and more
Packaging:
    * added author, description, classifiers, scripts and requirements in 'setup.py'

Tests:
    * added support for 'tox.ini'
    * moved 'tests' directory outside main python module

Fixes:
    * namespace is 'atreal_openads' instead of 'passerelle.apps.atreal_openads'
    * increased timeout removed from 'get' requests
    * fixed timeout typo on 'self.openADS_API_timeout'
2019-07-16 11:27:19 +02:00
Michael Bideau 522634d564 Added 'extra_debug' field and a function to only log debug message if extra_debug is enabled 2019-07-11 18:22:47 +02:00
Michael Bideau ce44b0a733 Added HTTP Basic authentication, ForwardFiles content deleted on success, plus logging and cleaning
Features:
    * added HTTP Basic authentication (+ login/password fields, - token field)
    * ForwardFiles content deleted on upload success (object/status kept)

Logging:
    * added debuging and warning messages
    * replaced the python interpolation '%' by function args ','

Cleaning:
    * removed functions 'ajob', 'afile'
    * removed unused imports

Fixes:
    * function 'get_upload_path()' returns unique names
    * added missing imports
    * using string in dictionary keys
2019-07-10 18:23:31 +02:00
Michael Bideau 0d4b51e9ba Initial import of source code (new models: AtrealOpenads, ForwardFile) 2019-04-30 12:21:06 +00:00