-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
202 restore multiples organizaciones #221
Conversation
pydatajson/ckan_utils.py
Outdated
for theme in themes | ||
] | ||
|
||
package['groups'] = package.get('groups', []) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Esto se logra mejor con package.setdefault('groups', [])
- **apikey**: La apikey de un usuario con los permisos que le permitan crear o actualizar el dataset. | ||
- **dataset_list**: Los ids de los datasets a restaurar. Si no se pasa una lista, todos los datasests se restauran. | ||
- **owner_org**: La organización a la cual pertencen los datasets. | ||
- **download_strategy**: Una función (catálogo, distribución)->bool. Sobre las distribuciones que evalúa True, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cambio brusco: no podríamos pasar las ids de distribuciones a subir directamente? Simplificaría la firma de la función
docs/MANUAL.md
Outdated
parámetro. Toma los siguientes parámetros: | ||
- **catalog**: El catálogo de origen que se restaura. | ||
- **portal_url**: La URL del portal CKAN de destino. | ||
- **apikey**: La apikey de un usuario con los permisos que le permitan crear o actualizar el dataset. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"el dataset" -> los datasets
pydatajson/federation.py
Outdated
""" | ||
push_new_themes(catalog, portal_url, apikey) | ||
if dataset_list is None: | ||
dataset_list = [ds['identifier'] for ds in catalog.datasets] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Posible KeyError?
pydatajson/federation.py
Outdated
org_list = origin_portal.action.organization_list() | ||
except CKANAPIError as e: | ||
logger.exception( | ||
'Ocurrió un buscando las organizaciones del portal {}: {}' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"ocurrió un buscando", falta la palabra "error", asumo
file_name = dist.get('fileName') or \ | ||
dist['downloadURL'].split('/')[-1] | ||
os.rename(tmpfile.name, os.path.join(tmpdir, file_name)) | ||
tmpfile.name = os.path.join(tmpdir, file_name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Por qué todo el barullo de tempfile? Podés usar context managers para borrar el archivo en caso de un error
restore_catalog_to_ckan()
pasan a ser derestore_organization
.restore_catalog
se compone de varias llamadas arestore_organization