geonode.upload.files
An incomplete replacement for the various file support functions currently scattered over the codebase
@todo complete and use
Attributes
Classes
A more or less complete user-defined wrapper around list objects. |
|
Functions
|
|
|
return True if the list of names contains a bad one |
|
Replaces a string that matches the regex with the replacement. |
|
|
|
Returns files that end with the given extension from a list of file names. |
|
Returns the files sans anything in a __MACOSX directory |
|
Provide hint on the type of file being handled in the upload session. |
|
get a list of SpatialFiles for the provided file |
|
Perform sanity checks on uploaded zip file |
|
|
|
|
|
Module Contents
- class geonode.upload.files.SpatialFiles(dirname, data, archive=None)[source]
Bases:
collections.UserListA more or less complete user-defined wrapper around list objects.
- class geonode.upload.files.SpatialFile(base_file, file_type, auxillary_files, sld_files, xml_files)[source]
- class geonode.upload.files.FileType(name, code, dataset_type, aliases=None, auxillary_file_exts=None)[source]
- geonode.upload.files._contains_bad_names(file_names)[source]
return True if the list of names contains a bad one
- geonode.upload.files._clean_string(str, regex='(^[^a-zA-Z\\._]+)|([^a-zA-Z\\._0-9]+)', replace='_')[source]
Replaces a string that matches the regex with the replacement.
- geonode.upload.files._find_file_type(file_names, extension)[source]
Returns files that end with the given extension from a list of file names.
- geonode.upload.files.clean_macosx_dir(file_names)[source]
Returns the files sans anything in a __MACOSX directory
- geonode.upload.files.get_scan_hint(valid_extensions)[source]
Provide hint on the type of file being handled in the upload session.
This function is useful mainly for those file types that can carry either vector or raster formats, like the KML type.
- geonode.upload.files.scan_file(file_name, scan_hint=None, charset=None)[source]
get a list of SpatialFiles for the provided file
- geonode.upload.files._process_zip(zip_path, destination_dir, scan_hint=None, charset=None)[source]
Perform sanity checks on uploaded zip file
This function will check if the zip file’s contents have legal names. If they do the zipfile remains compressed. Otherwise, it is extracted and the files are renamed.
It will also check if an .sld file exists inside the zip and extract it