Hicham Benjelloun 7 years ago
parent
commit
1eb20f794d

+ 3
- 6
lodel/leapi/datahandlers/base_classes.py View File

@@ -391,14 +391,11 @@ class Reference(DataHandler):
391 391
             logger.warning('Class of the back_reference given is not an allowed class')
392 392
             return False
393 393
         value = datas[fname]
394
-        if not target_class.is_exist(value):
394
+        target_uidfield = target_class.uid_fieldname()[0]  # multi uid broken here
395
+        obj = target_class.get([(target_uidfield, '=', value)])
396
+        if len(obj) == 0:
395 397
             logger.warning('Object referenced does not exist')
396 398
             return False
397
-        # target_uidfield = target_class.uid_fieldname()[0] #multi uid broken here
398
-        # obj = target_class.get([(target_uidfield, '=', value)])
399
-        # if len(obj) == 0:
400
-        #    logger.warning('Object referenced does not exist')
401
-        #    return False
402 399
         return True
403 400
 
404 401
     # @brief Utility method designed to fetch referenced objects

+ 0
- 9
lodel/leapi/leobject.py View File

@@ -654,12 +654,3 @@ object ! For class %s with uid value = %s" % (cls, uid))
654 654
         elif len(res) == 0:
655 655
             return None
656 656
         return res[0]
657
-
658
-    # @brief Checks if an object exists
659
-    @classmethod
660
-    def is_exist(cls, uid):
661
-        if cls.uid_fieldname() is None:
662
-            raise LodelFatalError(
663
-                "No uid defined for class %s" % cls.__name__)
664
-        from .query import is_exist
665
-        return is_exist(cls, uid)

+ 19
- 33
lodel/leapi/query.py View File

@@ -7,27 +7,15 @@ import warnings
7 7
 
8 8
 from lodel.context import LodelContext
9 9
 LodelContext.expose_modules(globals(), {
10
-    'lodel.leapi.exceptions': ['LeApiError', 'LeApiErrors', 
10
+    'lodel.leapi.exceptions': ['LeApiError', 'LeApiErrors',
11 11
         'LeApiDataCheckError', 'LeApiDataCheckErrors', 'LeApiQueryError',
12 12
         'LeApiQueryErrors'],
13 13
     'lodel.plugin.hooks': ['LodelHook'],
14 14
     'lodel.logger': ['logger']})
15 15
 
16
-##@brief Tool to check if a target_class's object exists and is stored
17
-#@param target_class : class where the object is supposed to be
18
-#@param uid : a unique id in target_class
19
-#@returns true if an object with unique id uid exists in target_class, false if not
20
-def is_exist(target_class, uid):
21
-	from .leobject import LeObject
22
-	if not inspect.isclass(target_class) or not issubclass(target_class, LeObject):
23
-		raise TypeError("target class has to be a child class of LeObject but %s was given"% target_class)
24
-	datasource = target_class._ro_datasource
25
-	return datasource.is_exist(target_class,uid)
26
-
27
-
28 16
 ##@todo check datas when running query
29 17
 class LeQuery(object):
30
-    
18
+
31 19
     ##@brief Hookname prefix
32 20
     _hook_prefix = None
33 21
     ##@brief arguments for the LeObject.check_data_value()
@@ -73,7 +61,7 @@ class LeQuery(object):
73 61
     #@return query result
74 62
     def _query(self, **datas):
75 63
         raise NotImplementedError("Asbtract method")
76
-    
64
+
77 65
     ##@return a dict with query infos
78 66
     def dump_infos(self):
79 67
         return {'target_class': self._target_class}
@@ -118,7 +106,7 @@ class LeFilteredQuery(LeQuery):
118 106
         self.subqueries = None
119 107
         query_filters = [] if query_filters is None else query_filters
120 108
         self.set_query_filter(query_filters)
121
-    
109
+
122 110
     ##@brief Abstract FilteredQuery execution method
123 111
     #
124 112
     # This method takes care to execute subqueries before calling super execute
@@ -439,7 +427,7 @@ field to use for the relational filter"
439 427
     #<pre>contributeur IN (1,2,3,5)</pre> will be transformed into :
440 428
     #<pre>(
441 429
     #       (
442
-    #           contributeur, 
430
+    #           contributeur,
443 431
     #           {
444 432
     #               auteur: 'lodel_id',
445 433
     #               traducteur: 'lodel_id'
@@ -494,7 +482,7 @@ class LeInsertQuery(LeQuery):
494 482
             raise LeApiQueryError("Trying to create an insert query on an \
495 483
 abstract LeObject : %s" % target_class)
496 484
         super().__init__(target_class)
497
-    
485
+
498 486
     ## @brief Implements an insert query operation, with only one insertion
499 487
     # @param datas : datas to be inserted
500 488
     def _query(self, datas):
@@ -536,7 +524,7 @@ class LeUpdateQuery(LeFilteredQuery):
536 524
     #@todo change strategy with instance update. We have to accept datas for
537 525
     #the execute method
538 526
     def __init__(self, target, query_filters=None):
539
-        ##@brief This attr is set only if the target argument is an 
527
+        ##@brief This attr is set only if the target argument is an
540 528
         #instance of a LeObject subclass
541 529
         self.__leobject_instance_datas = None
542 530
         target_class = target
@@ -565,8 +553,8 @@ target to LeUpdateQuery constructor"
565 553
             #Instance update
566 554
             #Building query_filter
567 555
             filters = [(
568
-                uid_name, 
569
-                '=', 
556
+                uid_name,
557
+                '=',
570 558
                 str(self.__leobject_instance_datas[uid_name]))]
571 559
             res = self._rw_datasource.update(
572 560
                 self._target_class, filters, [],
@@ -712,22 +700,22 @@ class LeGetQuery(LeFilteredQuery):
712 700
         l_datas=self._ro_datasource.select(
713 701
             target = self._target_class,
714 702
             field_list = fl,
715
-            filters = self._query_filter[0], 
716
-            relational_filters = self._query_filter[1], 
717
-            order = self._order, 
718
-            group = self._group, 
719
-            limit = self._limit, 
703
+            filters = self._query_filter[0],
704
+            relational_filters = self._query_filter[1],
705
+            order = self._order,
706
+            group = self._group,
707
+            limit = self._limit,
720 708
             offset = self._offset)
721 709
         return l_datas
722 710
 
723 711
     ##@return a dict with query infos
724 712
     def dump_infos(self):
725 713
         ret = super().dump_infos()
726
-        ret.update({  'field_list' : self._field_list, 
727
-                        'order' : self._order, 
728
-                        'group' : self._group, 
729
-                        'limit' : self._limit, 
730
-                        'offset': self._offset, 
714
+        ret.update({  'field_list' : self._field_list,
715
+                        'order' : self._order,
716
+                        'group' : self._group,
717
+                        'limit' : self._limit,
718
+                        'offset': self._offset,
731 719
        })
732 720
         return ret
733 721
 
@@ -742,5 +730,3 @@ offset={offset}"
742 730
                 res %= (n, subq)
743 731
         res += ">"
744 732
         return res
745
-
746
-

+ 44
- 46
lodel/plugin/plugins.py View File

@@ -33,7 +33,7 @@ LodelContext.expose_modules(globals(), {
33 33
 #
34 34
 #@todo Check if the symlink in the lodelcontext dir is obsolete !!!
35 35
 #@warning The plugins dir is at two locations : in lodel package and in
36
-#instance directory. Some stuff seems to still needs plugins to be in 
36
+#instance directory. Some stuff seems to still needs plugins to be in
37 37
 #the instance directory but it seems to be a really bad idea...
38 38
 
39 39
 ##@defgroup plugin_init_specs Plugins __init__.py specifications
@@ -67,7 +67,7 @@ PLUGINS_PATH = os.path.join(LodelContext.context_dir(),'plugins')
67 67
 
68 68
 ##@brief List storing the mandatory variables expected in a plugin __init__.py
69 69
 #file
70
-MANDATORY_VARNAMES = [PLUGIN_NAME_VARNAME, LOADER_FILENAME_VARNAME, 
70
+MANDATORY_VARNAMES = [PLUGIN_NAME_VARNAME, LOADER_FILENAME_VARNAME,
71 71
     PLUGIN_VERSION_VARNAME]
72 72
 
73 73
 ##@brief Default plugin type
@@ -122,7 +122,7 @@ version number" % arg)
122 122
         elif len(args) > 3:
123 123
             raise PluginError("Expected between 1 and 3 positional arguments \
124 124
 but %d arguments found" % len(args))
125
-        else: 
125
+        else:
126 126
             for i,v in enumerate(args):
127 127
                 self.__version[i] = int(v)
128 128
         #Checks that version numbering is correct
@@ -144,7 +144,7 @@ but %d arguments found" % len(args))
144 144
     @property
145 145
     def revision(self):
146 146
         return self.__version[2]
147
-    
147
+
148 148
     ##@brief Check and prepare comparisoon argument
149 149
     #@return A PluginVersion instance
150 150
     #@throw PluginError if invalid argument provided
@@ -157,7 +157,7 @@ but %d arguments found" % len(args))
157 157
                 raise PluginError("Cannot compare argument '%s' with \
158 158
 a PluginVerison instance" % other)
159 159
         return other
160
-    
160
+
161 161
     ##@brief Allow accessing to versions parts using interger index
162 162
     #@param key int : index
163 163
     #@return major for key == 0, minor for key == 1, revision for key == 2
@@ -213,7 +213,7 @@ a PluginVerison instance" % other)
213 213
 #
214 214
 #Automatic script registration on child class declaration
215 215
 class MetaPlugType(type):
216
-        
216
+
217 217
     ##@brief Dict storing all plugin types
218 218
     #
219 219
     #key is the _type_conf_name and value is the class
@@ -227,20 +227,20 @@ class MetaPlugType(type):
227 227
             return
228 228
         #Regitering a new plugin type
229 229
         MetaPlugType._all_ptypes[self._type_conf_name] = self
230
-    
230
+
231 231
     ##@brief Accessor to the list of plugin types
232 232
     #@return A copy of _all_ptypes attribute (a dict with typename as key
233 233
     #and the class as value)
234 234
     @classmethod
235 235
     def all_types(cls):
236 236
         return copy.copy(cls._all_ptypes)
237
-    
237
+
238 238
     ##@brief Accessor to the list of plugin names
239 239
     #@return a list of plugin name
240 240
     @classmethod
241 241
     def all_ptype_names(cls):
242 242
         return list(cls._all_ptypes.keys())
243
-    
243
+
244 244
     ##@brief Given a plugin type name return a Plugin child class
245 245
     #@param ptype_name str : a plugin type name
246 246
     #@return A Plugin child class
@@ -250,13 +250,13 @@ class MetaPlugType(type):
250 250
         if ptype_name not in cls._all_ptypes:
251 251
             raise PluginError("Unknown plugin type '%s'" % ptype_name)
252 252
         return cls._all_ptypes[ptype_name]
253
-    
253
+
254 254
     ##@brief Call the clear classmethod on each child classes
255 255
     @classmethod
256 256
     def clear_cls(cls):
257 257
         for pcls in cls._all_ptypes.values():
258 258
             pcls.clear_cls()
259
-        
259
+
260 260
 
261 261
 ##@brief Handle plugins
262 262
 #@ingroup lodel2_plugins
@@ -269,17 +269,17 @@ class MetaPlugType(type):
269 269
 # 2. Settings fetch all confspecs
270 270
 # 3. the loader call load_all to register hooks etc
271 271
 class Plugin(object, metaclass=MetaPlugType):
272
-    
272
+
273 273
     ##@brief Stores Plugin instances indexed by name
274 274
     _plugin_instances = dict()
275
-    
275
+
276 276
     ##@brief Attribute used by load_all and load methods to detect circular
277 277
     #dependencies
278 278
     _load_called = []
279 279
 
280 280
     ##@brief Attribute that stores plugins list from discover cache file
281 281
     _plugin_list = None
282
-    
282
+
283 283
     #@brief Designed to store, in child classes, the confspec indicating \
284 284
     #where plugin list is stored
285 285
     _plist_confspecs = None
@@ -303,12 +303,12 @@ class Plugin(object, metaclass=MetaPlugType):
303 303
     # @param plugin_name str : plugin name
304 304
     # @throw PluginError
305 305
     def __init__(self, plugin_name):
306
-        
306
+
307 307
         ##@brief The plugin name
308 308
         self.name = plugin_name
309 309
         ##@brief The plugin package path
310 310
         self.path = self.plugin_path(plugin_name)
311
-        
311
+
312 312
         ##@brief Stores the plugin module
313 313
         self.module = None
314 314
         ##@brief Stores the plugin loader module
@@ -317,7 +317,7 @@ class Plugin(object, metaclass=MetaPlugType):
317 317
         self.__confspecs = dict()
318 318
         ##@brief Boolean flag telling if the plugin is loaded or not
319 319
         self.loaded = False
320
-        
320
+
321 321
         # Importing __init__.py infos in it
322 322
         plugin_module = self.module_name()
323 323
         self.module = LodelContext.module(plugin_module)
@@ -398,7 +398,7 @@ name differ from the one found in plugin's init file"
398 398
     #@throw PluginError if the filename was not valid
399 399
     #@todo Some strange things append :
400 400
     #when loading modules in test self.module.__name__ does not contains
401
-    #the package... but in prod cases the self.module.__name__ is 
401
+    #the package... but in prod cases the self.module.__name__ is
402 402
     #the module fullname... Just a reminder note to explain the dirty
403 403
     #if on self_modname
404 404
     def _import_from_init_var(self, varname):
@@ -428,14 +428,12 @@ name differ from the one found in plugin's init file"
428 428
         base_mod = '.'.join(filename.split('.')[:-1])
429 429
         module_name = self_modname+"."+base_mod
430 430
         return importlib.import_module(module_name)
431
-   
431
+
432 432
     ##@brief Return associated module name
433 433
     def module_name(self):
434
-        path_array = self.path.split('/')
435
-        if not self.path.startswith('./plugins'):
436
-            raise PluginError("Bad path for plugin %s : %s" % (
437
-                self.name, self.path))
438
-        return '.'.join(['lodel'] + path_array[path_array.index('plugins'):])
434
+        #WOOT WE LOVE DIRTY WORKAROUNDS !!!
435
+        return "lodel.plugins."+os.path.basename(self.path)
436
+        #END OF DIRTY WORKAROUND
439 437
 
440 438
     ##@brief Check dependencies of plugin
441 439
     #@return A list of plugin name to be loaded before
@@ -455,7 +453,7 @@ name differ from the one found in plugin's init file"
455 453
             raise PluginError(  "Bad dependencie for '%s' :"%self.name,
456 454
                                 ', '.join(errors))
457 455
         return result
458
-    
456
+
459 457
     ##@brief Check if the plugin should be activated
460 458
     #
461 459
     #Try to fetch a function called @ref ACTIVATE_METHOD_NAME in __init__.py
@@ -473,10 +471,10 @@ name differ from the one found in plugin's init file"
473 471
             logger.debug(msg)
474 472
             test_fun = lambda:True
475 473
         return test_fun()
476
-        
474
+
477 475
     ##@brief Load a plugin
478 476
     #
479
-    #Loading a plugin means importing a file. The filename is defined in the 
477
+    #Loading a plugin means importing a file. The filename is defined in the
480 478
     #plugin's __init__.py file in a LOADER_FILENAME_VARNAME variable.
481 479
     #
482 480
     #The loading process has to take care of other things :
@@ -498,7 +496,7 @@ name differ from the one found in plugin's init file"
498 496
             raise PluginError("Circular dependencie in Plugin detected. Abording")
499 497
         else:
500 498
             self._load_called.append(self.name)
501
-        
499
+
502 500
         #Dependencie load
503 501
         for dependencie in self.check_deps():
504 502
             activable = dependencie.activable()
@@ -510,7 +508,7 @@ name differ from the one found in plugin's init file"
510 508
                     plugin_name = self.name,
511 509
                     dep_name = dependencie.name,
512 510
                     reason = activable)
513
-        
511
+
514 512
         #Loading the plugin
515 513
         try:
516 514
             self.__loader_module = self._import_from_init_var(LOADER_FILENAME_VARNAME)
@@ -524,7 +522,7 @@ name differ from the one found in plugin's init file"
524 522
             raise PluginError(msg)
525 523
         logger.debug("Plugin '%s' loaded" % self.name)
526 524
         self.loaded = True
527
-    
525
+
528 526
     ##@brief Returns the loader module
529 527
     #
530 528
     #Accessor for the __loader__ python module
@@ -559,7 +557,7 @@ name differ from the one found in plugin's init file"
559 557
             raise PluginError(msg)
560 558
         LodelHook.call_hook(
561 559
             "lodel2_plugins_loaded", cls, cls._plugin_instances)
562
-   
560
+
563 561
 
564 562
     ##@return a copy of __confspecs attr
565 563
     @property
@@ -593,7 +591,7 @@ name differ from the one found in plugin's init file"
593 591
         return res
594 592
 
595 593
     ##@brief Register a new plugin
596
-    # 
594
+    #
597 595
     #@param plugin_name str : The plugin name
598 596
     #@return a Plugin instance
599 597
     #@throw PluginError
@@ -627,7 +625,7 @@ name differ from the one found in plugin's init file"
627 625
             msg = "No plugin named '%s' loaded"
628 626
             msg %= plugin_name
629 627
             raise PluginError(msg)
630
-    
628
+
631 629
     ##@brief Given a plugin name returns the plugin path
632 630
     # @param plugin_name str : The plugin name
633 631
     # @return the plugin directory path
@@ -643,7 +641,7 @@ name differ from the one found in plugin's init file"
643 641
             pass
644 642
 
645 643
         return plist[plugin_name]['path']
646
-    
644
+
647 645
     ##@brief Return the plugin module name
648 646
     #
649 647
     #This module name is the "virtual" module where we imported the plugin.
@@ -659,7 +657,7 @@ name differ from the one found in plugin's init file"
659 657
         return "%s.%s" % (VIRTUAL_PACKAGE_NAME, plugin_name)
660 658
 
661 659
     ##@brief Start the Plugin class
662
-    # 
660
+    #
663 661
     # Called by Settings.__bootstrap()
664 662
     #
665 663
     # This method load path and preload plugins
@@ -667,7 +665,7 @@ name differ from the one found in plugin's init file"
667 665
     def start(cls, plugins):
668 666
         for plugin_name in plugins:
669 667
             cls.register(plugin_name)
670
-    
668
+
671 669
     ##@brief Attempt to "restart" the Plugin class
672 670
     @classmethod
673 671
     def clear(cls):
@@ -676,12 +674,12 @@ name differ from the one found in plugin's init file"
676 674
         if cls._load_called != []:
677 675
             cls._load_called = []
678 676
         MetaPlugType.clear_cls()
679
-    
677
+
680 678
     ##@brief Designed to be implemented by child classes
681 679
     @classmethod
682 680
     def clear_cls(cls):
683 681
         pass
684
-    
682
+
685 683
     ##@brief Reccursively walk throught paths to find plugin, then stores
686 684
     #found plugin in a static var
687 685
     #
@@ -699,7 +697,7 @@ name differ from the one found in plugin's init file"
699 697
         result = dict()
700 698
         for pinfos in tmp_res:
701 699
             pname = pinfos['name']
702
-            if (    pname in result 
700
+            if (    pname in result
703 701
                     and pinfos['version'] > result[pname]['version'])\
704 702
                 or pname not in result:
705 703
                 result[pname] = pinfos
@@ -708,7 +706,7 @@ name differ from the one found in plugin's init file"
708 706
                 pass
709 707
         cls._plugin_list = result
710 708
         return result
711
-    
709
+
712 710
     ##@brief Return discover result
713 711
     #@param refresh bool : if true invalidate all plugin list cache
714 712
     #@note If discover cache file not found run discover first
@@ -780,7 +778,7 @@ name differ from the one found in plugin's init file"
780 778
             'version': PluginVersion(pversion),
781 779
             'path': path,
782 780
             'type': ptype}
783
-    
781
+
784 782
     ##@brief Import init file from a plugin path
785 783
     #@param path str : Directory path
786 784
     #@return a tuple (init_module, module_name)
@@ -857,7 +855,7 @@ class CustomMethod(object):
857 855
     ##@brief Decorator constructor
858 856
     #@param component_name str : the name of the component to enhance
859 857
     #@param method_name str : the name of the method to inject (if None given
860
-    #@param method_type int : take value in one of 
858
+    #@param method_type int : take value in one of
861 859
     #CustomMethod::INSTANCE_METHOD CustomMethod::CLASS_METHOD or
862 860
     #CustomMethod::STATIC_METHOD
863 861
     #use the function name
@@ -875,7 +873,7 @@ class CustomMethod(object):
875 873
             raise ValueError("Excepted value for method_type was one of \
876 874
 CustomMethod::INSTANCE_METHOD CustomMethod::CLASS_METHOD or \
877 875
 CustomMethod::STATIC_METHOD, but got %s" % self._type)
878
-    
876
+
879 877
     ##@brief called just after __init__
880 878
     #@param fun function : the decorated function
881 879
     def __call__(self, fun):
@@ -891,7 +889,7 @@ another plugin : %s" % (
891 889
                 self._custom_methods[self._comp_name].__module__))
892 890
         self._fun = fun
893 891
         self._custom_methods[self._comp_name].append(self)
894
-    
892
+
895 893
     ##@brief Textual representation
896 894
     #@return textual representation of the CustomMethod instance
897 895
     def __repr__(self):
@@ -902,7 +900,7 @@ source={module_name}.{fun_name}>"
902 900
             classname = self._comp_name,
903 901
             module_name = self._fun.__module__,
904 902
             fun_name = self._fun.__name__)
905
-    
903
+
906 904
     ##@brief Return a well formed method
907 905
     #
908 906
     #@note the type of method depends on the _type attribute
@@ -924,7 +922,7 @@ CustomMethod::STATIC_METHOD")
924 922
 
925 923
     ##@brief Handle custom method dynamic injection in LeAPI dyncode
926 924
     #
927
-    #Called by lodel2_dyncode_loaded hook defined at 
925
+    #Called by lodel2_dyncode_loaded hook defined at
928 926
     #lodel.plugin.core_hooks.lodel2_plugin_custom_methods()
929 927
     #
930 928
     #@param cls

+ 1
- 2
lodel/plugins/Makefile.am View File

@@ -5,8 +5,7 @@ lodel2confdir=$(sysconfdir)/lodel2
5 5
 
6 6
 install-data-hook:
7 7
 	mkdir -p ${DESTDIR}$(pluginsdir); cp -R * ${DESTDIR}$(pluginsdir) && rm ${DESTDIR}$(pluginsdir)/Makefile* ;\
8
-	cd ${DESTDIR}; \
9
-	mkdir -p $(lodel2confdir); \
8
+	mkdir -p ${DESTDIR}$(lodel2confdir); \
10 9
 	if [ ! -d ${DESTDIR}$(lodel2confdir)/plugins ]; \
11 10
     then \
12 11
         ln -rs -t ${DESTDIR}$(lodel2confdir) $(pluginsdir); \

+ 19
- 17
lodel/plugins/webui/interface/controllers/admin.py View File

@@ -19,17 +19,17 @@ LIST_SEPARATOR = ','
19 19
 ##@brief These functions are called by the rules defined in ../urls.py
20 20
 ## To administrate the instance of the editorial model
21 21
 
22
-##@brief Controller's function to redirect on the home page of the admin 
22
+##@brief Controller's function to redirect on the home page of the admin
23 23
 # @param request : the request (get or post)
24 24
 # @note the response is given in a html page called in get_response_function
25 25
 def index_admin(request):
26 26
     # We have to be identified to admin the instance
27
-    # temporary, the acl will be more restrictive 
27
+    # temporary, the acl will be more restrictive
28 28
     #if WebUiClient.is_anonymous():
29 29
     #    return get_response('users/signin.html')
30 30
     return get_response('admin/admin.html')
31 31
 
32
-##@brief Controller's function to update an object of the editorial model 
32
+##@brief Controller's function to update an object of the editorial model
33 33
 # @param request : the request (get or post)
34 34
 # @note the response is given in a html page (in templates/admin) called in get_response_function
35 35
 def admin_update(request):
@@ -38,7 +38,7 @@ def admin_update(request):
38 38
     #if WebUiClient.is_anonymous():
39 39
     #    return get_response('users/signin.html')
40 40
     msg=''
41
-    
41
+
42 42
     datas = process_form(request)
43 43
     if not(datas is False):
44 44
         if 'lodel_id' not in datas:
@@ -55,8 +55,8 @@ def admin_update(request):
55 55
         except LeApiDataCheckErrors as e:
56 56
             raise HttpErrors(
57 57
                 title='Form validation errors', errors = e._exceptions)
58
-            
59
-            
58
+
59
+
60 60
 
61 61
     # Display of the form with the object's values to be updated
62 62
     if 'classname' in request.GET:
@@ -72,7 +72,7 @@ def admin_update(request):
72 72
             raise HttpException(400)
73 73
         logger.warning('Composed uids broken here')
74 74
         uid_field = target_leo.uid_fieldname()[0]
75
-    
75
+
76 76
     # We need the uid of the object
77 77
     test_valid = 'lodel_id' in request.GET \
78 78
         and len(request.GET['lodel_id']) == 1
@@ -91,11 +91,14 @@ def admin_update(request):
91 91
     else:
92 92
         # Check if the object actually exists
93 93
         # We get it from the database
94
-        if not target_leo.is_exist(lodel_id):
94
+        query_filters = list()
95
+        query_filters.append((uid_field,'=',lodel_id))
96
+        obj = target_leo.get(query_filters)
97
+        if len(obj) == 0:
95 98
             raise HttpException(404)
96 99
     return get_response('admin/admin_edit.html', target=target_leo, lodel_id =lodel_id)
97 100
 
98
-##@brief Controller's function to create an object of the editorial model 
101
+##@brief Controller's function to create an object of the editorial model
99 102
 # @param request : the request (get or post)
100 103
 # @note the response is given in a html page (in templates/admin) called in get_response_function
101 104
 def admin_create(request):
@@ -138,7 +141,7 @@ def admin_create(request):
138 141
         raise HttpException(400)
139 142
     return get_response('admin/admin_create.html', target=target_leo)
140 143
 
141
-##@brief Controller's function to delete an object of the editorial model 
144
+##@brief Controller's function to delete an object of the editorial model
142 145
 # @param request : the request (get)
143 146
 # @note the response is given in a html page (in templates/admin) called in get_response_function
144 147
 def admin_delete(request):
@@ -161,7 +164,7 @@ def admin_delete(request):
161 164
             raise HttpException(400)
162 165
         logger.warning('Composed uids broken here')
163 166
         uid_field = target_leo.uid_fieldname()[0]
164
-        
167
+
165 168
     # We also need the uid of the object to delete
166 169
     test_valid = 'lodel_id' in request.GET \
167 170
         and len(request.GET['lodel_id']) == 1
@@ -186,11 +189,11 @@ def admin_delete(request):
186 189
             msg = 'Object successfully deleted';
187 190
     else:
188 191
             msg = 'Oops something wrong happened...object still here'
189
-            
192
+
190 193
     return get_response('admin/admin_delete.html', target=target_leo, lodel_id =lodel_id, msg = msg)
191 194
 
192
-        
193
-        
195
+
196
+
194 197
 def admin_classes(request):
195 198
     # We have to be identified to admin the instance
196 199
     # temporary, the acl will be more restrictive
@@ -211,7 +214,7 @@ def delete_object(request):
211 214
     #if WebUiClient.is_anonymous():
212 215
     #    return get_response('users/signin.html')
213 216
     return get_response('admin/list_classes_delete.html', my_classes = dyncode.dynclasses)
214
-    
217
+
215 218
 def admin_class(request):
216 219
     # We have to be identified to admin the instance
217 220
     # temporary, the acl will be more restrictive
@@ -313,7 +316,7 @@ def process_form(request):
313 316
                 if hasattr(dh, 'default'):
314 317
                     value = dh.default
315 318
                 else:
316
-                    #if not explicit default value, enforcing default as 
319
+                    #if not explicit default value, enforcing default as
317 320
                     #an empty list
318 321
                     value = []
319 322
             else:
@@ -328,4 +331,3 @@ def process_form(request):
328 331
         del(res)
329 332
         raise HttpErrors(errors, title="Form validation error")
330 333
     return res
331
-

+ 11
- 5
lodel/plugins/webui/interface/controllers/listing.py View File

@@ -32,7 +32,7 @@ def collections(request):
32 32
 def issue(request):
33 33
     lodel_id = request.GET['lodel_id']
34 34
     return get_response('listing/issue.html', lodel_id=lodel_id[0], my_classes=dyncode )
35
-    
35
+
36 36
 ##@brief Controller's function to display a type (class) of the editorial model
37 37
 # @param request : the request (get or post)
38 38
 # @note the response is given in a html page called in get_response_function
@@ -65,7 +65,7 @@ def show_object(request):
65 65
             classname = None
66 66
     else:
67 67
         raise HttpException(400)
68
-    
68
+
69 69
     logger.warning('Composed uids broken here')
70 70
     uid_field = target_leo.uid_fieldname()[0]
71 71
 
@@ -82,7 +82,10 @@ def show_object(request):
82 82
     if not test_valid:
83 83
         raise HttpException(400)
84 84
     else:
85
-        if not target_leo.is_exist(lodel_id):
85
+        query_filters = list()
86
+        query_filters.append((uid_field,'=',lodel_id))
87
+        obj = target_leo.get(query_filters)
88
+        if len(obj) == 0:
86 89
             raise HttpException(404)
87 90
     return get_response('listing/show_object.html', lodel_id=lodel_id, classname=classname)
88 91
 
@@ -101,7 +104,7 @@ def show_object_detailled(request):
101 104
             classname = None
102 105
     else:
103 106
         raise HttpException(400)
104
-    
107
+
105 108
     logger.warning('Composed uids broken here')
106 109
     uid_field = target_leo.uid_fieldname()[0]
107 110
 
@@ -118,7 +121,10 @@ def show_object_detailled(request):
118 121
     if not test_valid:
119 122
         raise HttpException(400)
120 123
     else:
121
-        if not target_leo.is_exist(lodel_id):
124
+        query_filters = list()
125
+        query_filters.append((uid_field,'=',lodel_id))
126
+        obj = target_leo.get(query_filters)
127
+        if len(obj) == 0:
122 128
             raise HttpException(404)
123 129
 
124 130
     return get_response('listing/show_object_detailled.html', lodel_id=lodel_id, classname=classname)

+ 4
- 0
lodel/plugins/webui/templates/admin/editable_component.html View File

@@ -10,6 +10,10 @@
10 10
             <input id="{{fieldname}}" name="field_input_{{fieldname}}" class="form-control" type="password"  value="{{sval}}" >
11 11
     {% elif field.base_type == 'char' or field.base_type == 'int' %}
12 12
 		<input id="{{fieldname}}" class="form-control" name="field_input_{{fieldname}}" type="text" value="{{value}}" >
13
+		{% elif field.base_type == 'text' %}
14
+			<textarea class="form-control" name="field_input_{{fieldname}}">{{value}}</textarea>
15
+		{% elif field.base_type == 'datetime' %}
16
+			<input class="form-control" type="date" value="{{value}}" name="field_input_{{fieldname}}">
13 17
     {% elif field.base_type == 'ref' %}
14 18
         {% if value is iterable %}
15 19
             {% set sval=value|join(',') %}

progs/create_datas.sh → progs/create_data.sh View File


progs/create_datas_simpleem.sh → progs/create_data_simpleem.sh View File

@@ -2,8 +2,8 @@
2 2
 
3 3
 usage() {
4 4
     echo -e "Usage : $0 host_of_server instance_name host_of_db number_of_iterations >&2"
5
-    echo -e "Example : create_datas locahost instance_00001 localhost:28015 1000"
6
-    echo -e "Example : create_datas locahost instance_00001 localhost 1000"
5
+    echo -e "Example : create_data_simpleem locahost instance_00001 localhost:28015 1000"
6
+    echo -e "Example : create_data_simpleem locahost instance_00001 localhost 1000"
7 7
     exit 1
8 8
 }
9 9
 
@@ -18,7 +18,7 @@ instance=$2
18 18
 N=$4
19 19
 HOSTDB=$3
20 20
 dbname=lodel2_$instance
21
-dbuser=admin 
21
+dbuser=admin
22 22
 dbpwd=pass
23 23
 curl_options='--silent -o /dev/null -s -w %{url_effective};%{http_code};%{time_connect};%{time_starttransfer};%{time_total}\n'
24 24
 
@@ -30,12 +30,12 @@ do
30 30
     FN=$(lenmax=20;wcount=1; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
31 31
     LC=''
32 32
     curl -o /dev/null -s -d "field_input_lastname=$LN&field_input_firstname=$FN&field_input_linked_containers=$LC&classname=Person" http://$host/$instance/admin/create?classname=Person
33
-    
33
+
34 34
     # Classe User
35 35
     PWD='pwgen 10'
36 36
     LOGIN="${FN,,}$(printf "%d" $RANDOM)"
37 37
     curl -o /dev/null -s -d "field_input_lastname=$LN&field_input_firstname=$FN&field_input_password=$PWD&field_input_login=$LOGIN&classname=User" http://$host/$instance/admin/create?classname=User
38
-    
38
+
39 39
     # Classe Entry, champs à remplir : name, description, role, linked_texts
40 40
     ENLT='' #$(printf "use $dbname\nDBQuery.shellBatchSize = 30000\n db.Article.find({}, {lodel_id:1, _id:0})" | mongo  $HOSTDB/admin -u $dbuser -p $dbpwd | sed "1,3d" | sed -e "s/{ \"lodel_id\" : //g" | sed -e "s/ }//g" | shuf | head -n 3; )
41 41
     ENROLE=$(shuf -e 'geography' 'subject' 'keywords' | head -n 1)
@@ -62,11 +62,11 @@ do
62 62
         fi
63 63
     done
64 64
     COLLD=$tmp
65
-    COLT=$(lenmax=100;wcount=20; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/") 
66
-    COLST=$(lenmax=100;wcount=20; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/") 
65
+    COLT=$(lenmax=100;wcount=20; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
66
+    COLST=$(lenmax=100;wcount=20; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
67 67
     LG=$(shuf -e 'fr' 'en' 'es' 'ger' 'it'| head -n 1)
68
-    DESC=$(lenmax=500;wcount=100; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/") 
69
-    PBN=$(lenmax=500;wcount=100; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/") 
68
+    DESC=$(lenmax=500;wcount=100; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
69
+    PBN=$(lenmax=500;wcount=100; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
70 70
     ISSN=$(</dev/urandom tr -dc 0-9 | head -c8;echo;)
71 71
     curl $curl_options -d "field_input_title=$COLT&field_input_subtitle=$COLST&field_input_language=$LG&field_input_linked_directors=$COLLD&field_input_description=$DESC&field_input_publisher_note=$PBN&field_input_issn=$ISSN&classname=Collection" http://$host/$instance/admin/create?classname=Collection
72 72
     collection=$(printf "use $dbname\n db.Collection.find({}, {lodel_id:1, _id:0}).sort({_id:-1}).limit(1)" | mongo  $HOSTDB/admin -u $dbuser -p $dbpwd | sed "1,3d" | sed -e "s/{ \"lodel_id\" : //g" | sed -e "s/ }//g" | sed "\$d";)
@@ -77,7 +77,7 @@ do
77 77
         NB=$(shuf -e '25' '30' '35' '40' '45' '50' '55' '60' '65' | head -n 1) # Nombre de textes pour le numéro
78 78
         NBR=$(($NB/3)) # Nombre de reviews
79 79
         NBA=$(($NBR*2)) # Nombre d'articles
80
-        
80
+
81 81
         # Classe Issue, champs à remplir : title, subtitle, language, linked_directors, description, publisher_note, isbn, print_isbn, number, cover, print_pub_date, e_pub_date, abstract, collection, linked_parts, linked_texts
82 82
         NBLD=$(shuf -e '1' '2' '3' '4' | head -n 1)
83 83
         directors=$(printf "use $dbname\n DBQuery.shellBatchSize = 30000\n db.Person.find({}, {lodel_id:1, _id:0})" | mongo  $HOSTDB/admin -u $dbuser -p $dbpwd | sed "1,4d" | sed -e "s/{ \"lodel_id\" : //g" | sed -e "s/ }//g" | sed "\$d" | shuf | head -n $NBLD;)
@@ -92,15 +92,15 @@ do
92 92
             fi
93 93
         done
94 94
         ISSLD=$tmp
95
-        ISST=$(lenmax=100;wcount=20; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/") 
96
-        ISSST=$(lenmax=100;wcount=20; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/") 
95
+        ISST=$(lenmax=100;wcount=20; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
96
+        ISSST=$(lenmax=100;wcount=20; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
97 97
         LG=$(shuf -e 'fr' 'en' 'es' 'ger' 'it'| head -n 1)
98
-        DESC=$(lenmax=500;wcount=100; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/") 
99
-        PBN=$(lenmax=500;wcount=100; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/") 
98
+        DESC=$(lenmax=500;wcount=100; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
99
+        PBN=$(lenmax=500;wcount=100; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
100 100
         ISBN=$(</dev/urandom tr -dc 0-9 | head -c10;echo;)
101 101
         PISBN=$(</dev/urandom tr -dc 0-9 | head -c10;echo;)
102
-        ISSNU=$(lenmax=30;wcount=10; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/") 
103
-        ISSCOV=$(lenmax=100;wcount=15; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/") 
102
+        ISSNU=$(lenmax=30;wcount=10; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
103
+        ISSCOV=$(lenmax=100;wcount=15; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
104 104
         M=$(shuf -e '01' '02' '03' '04' '05' '06' '07' '08' '09' '10' '11' '12' | head -n 1)
105 105
         JJ=$(shuf -e '01' '02' '03' '04' '05' '06' '07' '08' '09' '10' '11' '12' '13' '14' '15' '16' '17' '18' '19' '20' '21' '22' '23' '24' '25' '26' '27' '28'  | head -n 1)
106 106
         AA=$(shuf -e '2012' '2005' '2010' '2015' '2016'| head -n 1)
@@ -115,7 +115,7 @@ do
115 115
         ISSLTXT=''
116 116
         curl $curl_options -d "field_input_title=$ISST&field_input_subtitle=$ISSST&field_input_language=$LG&field_input_linked_directors=$ISSLD&field_input_description=$DESC&field_input_publisher_note=$PBN&field_input_isbn=$ISBN&field_input_print_isbn=$PISBN&field_input_number=$ISSNU&field_input_cover=$ISSCOV&field_input_print_pub_date=$PPDATE&field_input_e_pub_date=$EPDATE&field_input_abstract=$ISSAB&field_input_collection=$collection&field_input_linked_parts=$ISSLPA&field_input_linked_texts=$ISSLTXT&classname=Issue" http://$host/$instance/admin/create?classname=Issue
117 117
         issue=$(printf "use $dbname\n db.Issue.find({}, {lodel_id:1, _id:0}).sort({_id:-1}).limit(1)" | mongo  $HOSTDB/admin -u $dbuser -p $dbpwd | sed "1,3d" | sed -e "s/{ \"lodel_id\" : //g" | sed -e "s/ }//g" | sed "\$d" )
118
-       
118
+
119 119
         # On entre les textes correspondants aux numéros indépendemment des parts
120 120
         NBT=$(shuf -e '2' '3' '4' '5' '6' '8' | head -n 1)
121 121
         for i in `eval echo {1..$NBT}`;
@@ -231,17 +231,17 @@ do
231 231
                 fi
232 232
             done
233 233
             PALD=$tmp
234
-            PAT=$(lenmax=100;wcount=20; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/") 
235
-            PAST=$(lenmax=100;wcount=20; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/") 
234
+            PAT=$(lenmax=100;wcount=20; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
235
+            PAST=$(lenmax=100;wcount=20; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
236 236
             LG=$(shuf -e 'fr' 'en' 'es' 'ger' 'it'| head -n 1)
237
-            DESC=$(lenmax=500;wcount=100; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/") 
238
-            PBN=$(lenmax=500;wcount=100; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/") 
237
+            DESC=$(lenmax=500;wcount=100; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
238
+            PBN=$(lenmax=500;wcount=100; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
239 239
             issue=$(printf "use $dbname\nDBQuery.shellBatchSize = 1000\n db.Issue.find({collection:$collection}, {lodel_id:1, _id:0})" | mongo  $HOSTDB/admin -u $dbuser -p $dbpwd | sed "1,4d" | sed -e "s/{ \"lodel_id\" : //g" | sed -e "s/ }//g" | sed "\$d" | shuf | head -n 1;)
240 240
             PALTXT=''
241 241
             PALP=''
242 242
             curl $curl_options -d "field_input_title=$PAT&field_input_subtitle=$PAST&field_input_language=$LG&field_input_linked_directors=$PALD&field_input_description=$DESC&field_input_publisher_note=$PBN&field_input_publication=$issue&field_input_linked_parts=$PALP&field_input_linked_texts=$PALTXT&classname=Part" http://$host/$instance/admin/create?classname=Part
243 243
             part=$(printf "use $dbname\n db.Part.find({}, {lodel_id:1, _id:0}).sort({_id:-1}).limit(1)" | mongo  $HOSTDB/admin -u $dbuser -p $dbpwd | sed "1,3d" | sed -e "s/{ \"lodel_id\" : //g" | sed -e "s/ }//g" | sed "\$d" )
244
-       
244
+
245 245
             # On entre les textes correspondants aux  parts
246 246
             NBPANBT=$(shuf -e '2' '3' '4' | head -n 1)
247 247
             for i in `eval echo {1..$NBPANBT}`;
@@ -357,11 +357,11 @@ do
357 357
                         fi
358 358
                 done
359 359
                 PALD=$tmp
360
-                PAT=$(lenmax=100;wcount=20; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/") 
361
-                PAST=$(lenmax=100;wcount=20; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/") 
360
+                PAT=$(lenmax=100;wcount=20; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
361
+                PAST=$(lenmax=100;wcount=20; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
362 362
                 LG=$(shuf -e 'fr' 'en' 'es' 'ger' 'it'| head -n 1)
363
-                DESC=$(lenmax=500;wcount=100; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/") 
364
-                PBN=$(lenmax=500;wcount=100; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/") 
363
+                DESC=$(lenmax=500;wcount=100; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
364
+                PBN=$(lenmax=500;wcount=100; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
365 365
                 PALTXT=''
366 366
                 PALP=''
367 367
                 curl $curl_options -d "field_input_title=$PAT
@@ -371,7 +371,7 @@ do
371 371
                 &field_input_description=$DESC&field_input_publisher_note=$PBN&field_input_publication=$part
372 372
                 &field_input_linked_parts=$PALP&field_input_linked_texts=$PALTXT&classname=Part" http://$host/$instance/admin/create?classname=Part
373 373
                 part=$(printf "use $dbname\n db.Part.find({}, {lodel_id:1, _id:0}).sort({_id:-1}).limit(1)" | mongo  $HOSTDB/admin -u $dbuser -p $dbpwd | sed "1,3d" | sed -e "s/{ \"lodel_id\" : //g" | sed -e "s/ }//g" | sed "\$d" )
374
-       
374
+
375 375
                 # On entre les textes correspondants aux numéros indépendemment des parts
376 376
                 for i in `eval echo {1..$NBA}`;
377 377
                 do
@@ -471,4 +471,4 @@ do
471 471
             done
472 472
         done
473 473
     done
474
-done
474
+done

Loading…
Cancel
Save