plone / guillotina

Python AsyncIO data API to manage billions of resources
https://guillotina.readthedocs.io/en/latest/
Other
187 stars 51 forks source link

Add IFileNameGenerator adapter #1001

Closed Qiwn closed 3 years ago

Qiwn commented 3 years ago

For GCould we can do something like this:

@configure.adapter(for_=(IResource, IGCloudFileField), provides=IFileNameGenerator)
class GCloudFileNameGenerator():

    def __init__(self, context, field):
        self.context = context
        self.field = field

    def __call__(self):
        return self.context.__uuid__

close https://github.com/plone/guillotina/issues/862

codecov-commenter commented 3 years ago

Codecov Report

Merging #1001 into master will decrease coverage by 0.1%. The diff coverage is 100.0%.

Impacted file tree graph

@@           Coverage Diff            @@
##           master   #1001     +/-   ##
========================================
- Coverage    94.6%   94.6%   -0.0%     
========================================
  Files         316     316             
  Lines       28049   28065     +16     
========================================
+ Hits        26534   26549     +15     
- Misses       1515    1516      +1     
Impacted Files Coverage Δ
guillotina/files/adapter.py 97.0% <100.0%> (+0.2%) :arrow_up:
guillotina/interfaces/__init__.py 100.0% <100.0%> (ø)
guillotina/interfaces/files.py 100.0% <100.0%> (ø)
guillotina/test_package.py 96.8% <100.0%> (+0.1%) :arrow_up:
guillotina/db/storages/pg.py 89.1% <0.0%> (-0.1%) :arrow_down:
Qiwn commented 3 years ago

ok! great! thank you!