Bug fixes, clean up, stuff
This commit is contained in:
@@ -56,6 +56,8 @@ class Archive_Content_Base(BaseModel):
|
||||
# xxxx_red: str = Field(default='xxx')
|
||||
# xxxx_blue: str = Field(default_factory=testing)
|
||||
hosted_file_path: str = None # '/testing/test-test'
|
||||
api_hosted_file_path_download: str = None # '/testing/test-test'
|
||||
api_hosted_file_path_stream: str = None # '/testing/test-test'
|
||||
|
||||
original_datetime: Optional[datetime.datetime]
|
||||
original_datetime_timezone: Optional[str]
|
||||
@@ -105,7 +107,7 @@ class Archive_Content_Base(BaseModel):
|
||||
|
||||
@validator('hosted_file_path', always=True)
|
||||
def hosted_file_path_lookup(cls, v, values, **kwargs):
|
||||
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.setLevel(logging.INFO) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(v)
|
||||
log.debug(values)
|
||||
|
||||
@@ -116,7 +118,43 @@ class Archive_Content_Base(BaseModel):
|
||||
if filename := values.get('filename'):
|
||||
path_str = f'{path_str}?filename={filename}'
|
||||
|
||||
log.debug(path_str)
|
||||
log.info(f'Path: {path_str}')
|
||||
return path_str
|
||||
log.debug('NOT Found hosted_file_id_random...')
|
||||
return v
|
||||
|
||||
@validator('api_hosted_file_path_download', always=True)
|
||||
def api_hosted_file_path_download_lookup(cls, v, values, **kwargs):
|
||||
log.setLevel(logging.INFO) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(v)
|
||||
log.debug(values)
|
||||
|
||||
if hosted_file_id_random := values.get('hosted_file_id_random'):
|
||||
log.debug('Found hosted_file_id_random...')
|
||||
path_str = f'/hosted_file/{hosted_file_id_random}/download'
|
||||
|
||||
if filename := values.get('filename'):
|
||||
path_str = f'{path_str}?filename={filename}'
|
||||
|
||||
log.info(f'Path: {path_str}')
|
||||
return path_str
|
||||
log.debug('NOT Found hosted_file_id_random...')
|
||||
return v
|
||||
|
||||
@validator('api_hosted_file_path_stream', always=True)
|
||||
def api_hosted_file_path_stream_lookup(cls, v, values, **kwargs):
|
||||
log.setLevel(logging.INFO) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(v)
|
||||
log.debug(values)
|
||||
|
||||
if hosted_file_id_random := values.get('hosted_file_id_random'):
|
||||
log.debug('Found hosted_file_id_random...')
|
||||
path_str = f'/hosted_file/{hosted_file_id_random}/stream'
|
||||
|
||||
if filename := values.get('filename'):
|
||||
path_str = f'{path_str}?filename={filename}'
|
||||
|
||||
log.info(f'Path: {path_str}')
|
||||
return path_str
|
||||
log.debug('NOT Found hosted_file_id_random...')
|
||||
return v
|
||||
|
||||
@@ -61,6 +61,15 @@ class Hosted_File_Base(BaseModel):
|
||||
created_on: Optional[datetime.datetime] = None
|
||||
updated_on: Optional[datetime.datetime] = None
|
||||
|
||||
# Including convenience data
|
||||
# This is only for convenience. Probably going to keep unless it causes a problem.
|
||||
hosted_file_found_check: Optional[bool] = Field(
|
||||
alias = 'found_check'
|
||||
)
|
||||
hosted_file_size_check: Optional[int] = Field( # File size in bytes
|
||||
alias = 'size_check'
|
||||
)
|
||||
|
||||
# Including other related objects
|
||||
hosted_file_link_list: Optional[list] # Hosted_File_Base()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user