launchpy 0.4.5.post3__tar.gz → 0.4.5.post5__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. {launchpy-0.4.5.post3/launchpy.egg-info → launchpy-0.4.5.post5}/PKG-INFO +1 -1
  2. {launchpy-0.4.5.post3 → launchpy-0.4.5.post5}/docs/releases.md +1 -0
  3. {launchpy-0.4.5.post3 → launchpy-0.4.5.post5}/docs/synchronizer.md +1 -0
  4. launchpy-0.4.5.post5/launchpy/__version__.py +1 -0
  5. {launchpy-0.4.5.post3 → launchpy-0.4.5.post5}/launchpy/synchronizer.py +59 -50
  6. {launchpy-0.4.5.post3 → launchpy-0.4.5.post5/launchpy.egg-info}/PKG-INFO +1 -1
  7. launchpy-0.4.5.post3/launchpy/__version__.py +0 -1
  8. {launchpy-0.4.5.post3 → launchpy-0.4.5.post5}/LICENSE +0 -0
  9. {launchpy-0.4.5.post3 → launchpy-0.4.5.post5}/README.md +0 -0
  10. {launchpy-0.4.5.post3 → launchpy-0.4.5.post5}/docs/admin.md +0 -0
  11. {launchpy-0.4.5.post3 → launchpy-0.4.5.post5}/docs/getstarted.md +0 -0
  12. {launchpy-0.4.5.post3 → launchpy-0.4.5.post5}/docs/library.md +0 -0
  13. {launchpy-0.4.5.post3 → launchpy-0.4.5.post5}/docs/main.md +0 -0
  14. {launchpy-0.4.5.post3 → launchpy-0.4.5.post5}/docs/property.md +0 -0
  15. {launchpy-0.4.5.post3 → launchpy-0.4.5.post5}/docs/translator.md +0 -0
  16. {launchpy-0.4.5.post3 → launchpy-0.4.5.post5}/launchpy/__init__.py +0 -0
  17. {launchpy-0.4.5.post3 → launchpy-0.4.5.post5}/launchpy/admin.py +0 -0
  18. {launchpy-0.4.5.post3 → launchpy-0.4.5.post5}/launchpy/config.py +0 -0
  19. {launchpy-0.4.5.post3 → launchpy-0.4.5.post5}/launchpy/configs.py +0 -0
  20. {launchpy-0.4.5.post3 → launchpy-0.4.5.post5}/launchpy/connector.py +0 -0
  21. {launchpy-0.4.5.post3 → launchpy-0.4.5.post5}/launchpy/launchpy.py +0 -0
  22. {launchpy-0.4.5.post3 → launchpy-0.4.5.post5}/launchpy/library.py +0 -0
  23. {launchpy-0.4.5.post3 → launchpy-0.4.5.post5}/launchpy/property.py +0 -0
  24. {launchpy-0.4.5.post3 → launchpy-0.4.5.post5}/launchpy.egg-info/SOURCES.txt +0 -0
  25. {launchpy-0.4.5.post3 → launchpy-0.4.5.post5}/launchpy.egg-info/dependency_links.txt +0 -0
  26. {launchpy-0.4.5.post3 → launchpy-0.4.5.post5}/launchpy.egg-info/requires.txt +0 -0
  27. {launchpy-0.4.5.post3 → launchpy-0.4.5.post5}/launchpy.egg-info/top_level.txt +0 -0
  28. {launchpy-0.4.5.post3 → launchpy-0.4.5.post5}/pyproject.toml +0 -0
  29. {launchpy-0.4.5.post3 → launchpy-0.4.5.post5}/requirements.txt +0 -0
  30. {launchpy-0.4.5.post3 → launchpy-0.4.5.post5}/setup.cfg +0 -0
  31. {launchpy-0.4.5.post3 → launchpy-0.4.5.post5}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: launchpy
3
- Version: 0.4.5.post3
3
+ Version: 0.4.5.post5
4
4
  Summary: Adobe Launch API wrapper
5
5
  Home-page: https://github.com/pitchmuc/launchpy
6
6
  Author: Julien Piccini
@@ -14,6 +14,7 @@ Patch:
14
14
  * Documentation improved in synchronizer
15
15
  * Support of extension added in `createTargetsLibrary`
16
16
  * Fixing dependency to `aepp` `som` module
17
+ * Fixing renaming path to use `renameComponent` and using `syncComponent`
17
18
 
18
19
  ## 0.4.4
19
20
  * adding a `getBuilds` method on the `Library` class instance
@@ -47,6 +47,7 @@ Arguments:
47
47
  * componentName : The name of the component to sync between template and target properties
48
48
  * componentId : The id of the component to sync
49
49
  * publishedVersion : Set to `False` by default. If set to True, takes the latest published version of the component.
50
+ * forceCreation : Set to `True` by default. It will create the element sync if it does not exist in the target property. Set to `False`, it will prevent that behavior.
50
51
 
51
52
  Either of these 2 can be used, but in the end, the name of the component is used to do the matching between properties.
52
53
  A component is either a Data Element or a Rule.
@@ -0,0 +1 @@
1
+ __version__ = "0.4.5-5"
@@ -178,7 +178,7 @@ class Synchronizer:
178
178
  cmp_baseDict['copy'] = copySettings(publishedVersion)
179
179
  return cmp_baseDict
180
180
 
181
- def syncComponent(self,componentName:str=None,componentId:str=None,publishedVersion:bool=False,**kwargs)->None:
181
+ def syncComponent(self,componentName:str=None,componentId:str=None,publishedVersion:bool=False,forceCreation:bool=True,**kwargs)->None:
182
182
  """
183
183
  Synchronize a component from the base property to the different target properties.
184
184
  It will detect the component with the same name in target properties.
@@ -188,6 +188,7 @@ class Synchronizer:
188
188
  componentName : REQUIRED : the name of the component to sync
189
189
  componentID : REQUIRED : the id of the component to sync
190
190
  publishedVersion : OPTIONAL : if you want to take the version that has been published
191
+ forceCreation : OPTIONAL : If the component does not exist in the target property, create it. Default: True
191
192
  possible kwargs:
192
193
  timeout : OPTIONAL : The timeout to be used for the rule component. If not provided, the existing timeout will be used.
193
194
  """
@@ -211,22 +212,23 @@ class Synchronizer:
211
212
  translatedComponent = self.translator.translate(target,data_element=cmp_baseDict['copy'])
212
213
  ## if it does not exist
213
214
  if cmp_baseDict['name'] not in [de.get('attributes',{}).get('name') for de in self.targets[target]['dataElements']]:
214
- comp = self.targets[target]['api'].createDataElement(
215
- name=cmp_baseDict['name'],
216
- descriptor= translatedComponent['descriptor'],
217
- settings=translatedComponent['settings'],
218
- extension=translatedComponent['extension'],
219
- storage_duration = translatedComponent["storage_duration"],
220
- force_lower_case = translatedComponent["force_lower_case"],
221
- clean_text = translatedComponent["clean_text"],
222
- default_value= translatedComponent["default_value"]
223
- )
224
- if cmp_baseDict['component']['attributes']['enabled'] != comp['attributes']['enabled']:
225
- updateDE = self.targets[target]['api'].updateDataElement(
226
- dataElement_id=comp['id'],
227
- attr_dict=translatedComponent)
228
- self.targets[target]['libraryStack']['dataElements'].append(comp)
229
- self.targets[target]['dataElements'].append(comp)
215
+ if forceCreation:
216
+ comp = self.targets[target]['api'].createDataElement(
217
+ name=cmp_baseDict['name'],
218
+ descriptor= translatedComponent['descriptor'],
219
+ settings=translatedComponent['settings'],
220
+ extension=translatedComponent['extension'],
221
+ storage_duration = translatedComponent["storage_duration"],
222
+ force_lower_case = translatedComponent["force_lower_case"],
223
+ clean_text = translatedComponent["clean_text"],
224
+ default_value= translatedComponent["default_value"]
225
+ )
226
+ if cmp_baseDict['component']['attributes']['enabled'] != comp['attributes']['enabled']:
227
+ updateDE = self.targets[target]['api'].updateDataElement(
228
+ dataElement_id=comp['id'],
229
+ attr_dict=translatedComponent)
230
+ self.targets[target]['libraryStack']['dataElements'].append(comp)
231
+ self.targets[target]['dataElements'].append(comp)
230
232
  else:
231
233
  index,old_component = [(index,de) for index,de in enumerate(self.targets[target]['dataElements']) if de.get('attributes',{}).get('name') == cmp_baseDict['name']][0]
232
234
  attributes = {
@@ -257,6 +259,7 @@ class Synchronizer:
257
259
  rc['rule_id'] = cmp_baseDict['id']
258
260
  for target in list(self.targets.keys()):
259
261
  flagAllowList = False
262
+ flagSkipCreation = False ## do not check for new rule config if rule has not been created
260
263
  ## check if the component is in the exclComponentList
261
264
  if any([bool(re.search(key,cmp_baseDict['name'])) for key in self.target_configs.get(target,{}).get('exclComponents',[])]):
262
265
  return {cmp_baseDict['name']:False}
@@ -268,34 +271,37 @@ class Synchronizer:
268
271
  if len(self.target_configs.get(target,{}).get('inclComponents',[]))==0 or flagAllowList:
269
272
  ## if rule does not exist
270
273
  if cmp_baseDict['name'] not in [rule['attributes']['name'] for rule in self.targets[target]['rules']]:
271
- targetRule = self.targets[target]['api'].createRule(
272
- name=cmp_baseDict['name']
273
- )
274
- targetRuleId = targetRule['id']
275
- self.translator.extendTargetRules(ruleName=cmp_baseDict['name'],ruleId=targetRuleId,property_name=target)
276
- self.targets[target]['rules'].append(targetRule)
277
- index = len(self.targets[target]['rules'])-1
278
- self.targets[target]['libraryStack']['rules'].append(targetRule)
279
- for rc in template_ruleComponents:
280
- try:
281
- translatedComponent = self.translator.translate(target,rule_component=copySettings(rc))
282
- except:
283
- raise KeyError("Could not translate the component. Please check if your extensions are aligned in the properties.")
284
- translatedComponent['rule_setting']['data'][0]['id'] = targetRuleId
285
- if timeout is not None:
286
- translatedComponent['timeout'] = timeout
287
- targetRuleComponent = self.targets[target]['api'].createRuleComponent(
288
- name=translatedComponent['name'],
289
- settings = translatedComponent['settings'],
290
- descriptor = translatedComponent['descriptor'],
291
- extension_infos = translatedComponent['extension'],
292
- rule_infos = translatedComponent['rule_setting'],
293
- rule_order=translatedComponent['rule_order'],
294
- order=translatedComponent['order'],
295
- negate=translatedComponent['negate'],
296
- delay_next=translatedComponent['delay_next'],
297
- timeout=translatedComponent['timeout'],
298
- )
274
+ if forceCreation:## creating the rule
275
+ targetRule = self.targets[target]['api'].createRule(
276
+ name=cmp_baseDict['name']
277
+ )
278
+ targetRuleId = targetRule['id']
279
+ self.translator.extendTargetRules(ruleName=cmp_baseDict['name'],ruleId=targetRuleId,property_name=target)
280
+ self.targets[target]['rules'].append(targetRule)
281
+ index = len(self.targets[target]['rules'])-1
282
+ self.targets[target]['libraryStack']['rules'].append(targetRule)
283
+ for rc in template_ruleComponents:
284
+ try:
285
+ translatedComponent = self.translator.translate(target,rule_component=copySettings(rc))
286
+ except:
287
+ raise KeyError("Could not translate the component. Please check if your extensions are aligned in the properties.")
288
+ translatedComponent['rule_setting']['data'][0]['id'] = targetRuleId
289
+ if timeout is not None:
290
+ translatedComponent['timeout'] = timeout
291
+ targetRuleComponent = self.targets[target]['api'].createRuleComponent(
292
+ name=translatedComponent['name'],
293
+ settings = translatedComponent['settings'],
294
+ descriptor = translatedComponent['descriptor'],
295
+ extension_infos = translatedComponent['extension'],
296
+ rule_infos = translatedComponent['rule_setting'],
297
+ rule_order=translatedComponent['rule_order'],
298
+ order=translatedComponent['order'],
299
+ negate=translatedComponent['negate'],
300
+ delay_next=translatedComponent['delay_next'],
301
+ timeout=translatedComponent['timeout'],
302
+ )
303
+ else:
304
+ flagSkipCreation = True
299
305
  else: ## if a rule exist with the same name
300
306
  index, targetRule = [(index,rule) for index, rule in enumerate(self.targets[target]['rules']) if rule['attributes']['name'] == cmp_baseDict['name']][0]
301
307
  self.targets[target]['libraryStack']['rules'].append(targetRule)
@@ -329,11 +335,12 @@ class Synchronizer:
329
335
  timeout=translatedComponent['timeout'],
330
336
  )
331
337
  ## updating rule attribute if difference between base and target
332
- if cmp_baseDict['component']['attributes']['enabled'] != targetRule['attributes']['enabled']:
333
- baseRuleAttr = copySettings(cmp_baseDict['component'])
334
- targetRule = self.targets[target]['api'].updateRule(rule_id=targetRuleId,attr_dict=baseRuleAttr) ## keeping in a var for debug
335
- del self.targets[target]['rules'][index]
336
- self.targets[target]['rules'].append(targetRule)
338
+ if not flagSkipCreation:
339
+ if cmp_baseDict['component']['attributes']['enabled'] != targetRule['attributes']['enabled']:
340
+ baseRuleAttr = copySettings(cmp_baseDict['component'])
341
+ targetRule = self.targets[target]['api'].updateRule(rule_id=targetRuleId,attr_dict=baseRuleAttr) ## keeping in a var for debug
342
+ del self.targets[target]['rules'][index]
343
+ self.targets[target]['rules'].append(targetRule)
337
344
 
338
345
  def syncComponents(self,componentsName:list=None,componentsId:list=None,publishedVersion:bool=False)->None:
339
346
  """
@@ -452,6 +459,8 @@ class Synchronizer:
452
459
  copy['name'] = new_name
453
460
  comp = self.targets[target]['api'].updateRule(rule_id=component['id'],attr_dict=copy)
454
461
  self.targets[target]['libraryStack']['rules'].append(comp)
462
+ self.targets[target]['rules'].append(comp)
463
+ self.translator.extendTargetRules(ruleName=new_name,ruleId=comp['id'],property_name=target)
455
464
 
456
465
 
457
466
  def checkComponentSync(self,componentName:str=None,componentId:str=None,publishedVersion:bool=False,excludeSimilar:bool=False,**kwargs)->bool:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: launchpy
3
- Version: 0.4.5.post3
3
+ Version: 0.4.5.post5
4
4
  Summary: Adobe Launch API wrapper
5
5
  Home-page: https://github.com/pitchmuc/launchpy
6
6
  Author: Julien Piccini
@@ -1 +0,0 @@
1
- __version__ = "0.4.5-3"
File without changes
File without changes
File without changes
File without changes