##// END OF EJS Templates
v2.9.2 :: Add 'resource_views' create function
eynilupu -
r3:ab4b435c96a4
parent child
Show More
1 NO CONTENT: modified file, binary diff hidden
@@ -35,6 +35,7 class JROAPI():
35 35 - action
36 36 - upload_file
37 37 - upload_multiple_files
38 - upload_multiple_files_advance
38 39 - show
39 40 - search
40 41 - create
@@ -378,7 +379,7 class JROAPI():
378 379 elif type_option == 'job':
379 380 return getattr(self.ckan.action, 'job_show')(id=id, **kwargs)
380 381 else:
381 return 'ERROR:: "%s" is not accepted' % (type_option)
382 return 'ERROR:: "type_option = %s" is not accepted' % (type_option)
382 383 except:
383 384 _, exc_value, _ = sys.exc_info()
384 385 return exc_value
@@ -513,7 +514,7 class JROAPI():
513 514 return getattr(self.ckan.action, 'tag_search')(**self.dict)
514 515
515 516 else:
516 return 'ERROR:: "%s" is not accepted' % (type_option)
517 return 'ERROR:: "type_option = %s" is not accepted' % (type_option)
517 518
518 519 except:
519 520 _, exc_value, _ = sys.exc_info()
@@ -521,7 +522,7 class JROAPI():
521 522 else:
522 523 return 'ERROR:: "type_option" must be <str>'
523 524
524 def create(self, type_option, **kwargs):
525 def create(self, type_option, select=None, **kwargs):
525 526 '''
526 527 FINALIDAD:
527 528 Funcion personalizada para crear.
@@ -548,8 +549,19 class JROAPI():
548 549 return getattr(self.ckan.action, 'tag_create')(**kwargs)
549 550 elif type_option == 'user':
550 551 return getattr(self.ckan.action, 'user_create')(**kwargs)
552 elif type_option == 'views':
553 if 'resource' == select:
554 self.list = ['package']
555 for key1, value1 in kwargs.items():
556 if not key1 in self.list:
557 self.dict[key1] = value1
558 return getattr(self.ckan.action, 'resource_create_default_resource_views')(**self.dict)
559 elif 'dataset' == select:
560 return getattr(self.ckan.action, 'package_create_default_resource_views')(**kwargs)
561 else:
562 return 'ERROR:: "select = %s" is not accepted' % (select)
551 563 else:
552 return 'ERROR:: "%s" is not accepted' % (type_option)
564 return 'ERROR:: "type_option = %s" is not accepted' % (type_option)
553 565 except:
554 566 _, exc_value, _ = sys.exc_info()
555 567 return exc_value
@@ -580,7 +592,7 class JROAPI():
580 592 elif type_option == 'collaborator':
581 593 return getattr(self.ckan.action, 'package_collaborator_create')(**kwargs)
582 594 else:
583 return 'ERROR:: "%s" is not accepted' % (type_option)
595 return 'ERROR:: "type_option = %s" is not accepted' % (type_option)
584 596 except:
585 597 _, exc_value, _ = sys.exc_info()
586 598 return exc_value
@@ -609,7 +621,7 class JROAPI():
609 621 elif 'purge' == select:
610 622 return getattr(self.ckan.action, 'dataset_purge')(**kwargs)
611 623 else:
612 return 'ERROR:: "%s" is not accepted' % (select)
624 return 'ERROR:: "select = %s" is not accepted' % (select)
613 625 elif type_option == 'project':
614 626 if select is None:
615 627 return 'ERROR:: "select" must not be "None"'
@@ -619,7 +631,7 class JROAPI():
619 631 elif 'purge' == select:
620 632 return getattr(self.ckan.action, 'organization_purge')(**kwargs)
621 633 else:
622 return 'ERROR:: "%s" is not accepted' % (select)
634 return 'ERROR:: "select = %s" is not accepted' % (select)
623 635 elif type_option == 'resource':
624 636 return getattr(self.ckan.action, 'resource_delete')(**kwargs)
625 637 elif type_option == 'vocabulary':
@@ -629,7 +641,7 class JROAPI():
629 641 elif type_option == 'user':
630 642 return getattr(self.ckan.action, 'user_delete')(**kwargs)
631 643 else:
632 return 'ERROR:: "%s" is not accepted' % (type_option)
644 return 'ERROR:: "type_option = %s" is not accepted' % (type_option)
633 645 except:
634 646 _, exc_value, _ = sys.exc_info()
635 647 return exc_value
General Comments 0
You need to be logged in to leave comments. Login now