{ "info": { "author": "Bridge", "author_email": "info@bridgecorp.com", "bugtrack_url": null, "classifiers": [], "description": "# workfront-bridge\n\nWorkfront Bridge is a library that make the creation of bridge projects in\nworkfront easily.\n\n## Design\n\nProjects and tasks in workfront have custom forms. Those custom forms have\nseveral parameters which are fullfill when the project is created(some other\nparameters are being fullfilled while the project is developed and task are\nbeing excetuted).\n\nThe library tries to divide and group logical blocks of tasks that can be\nconvined to build a workfront project.\nSo, in order to achieve this, two main abstractions are provided:\n\n* Project Containers\n* Blocks\n\n### Workfront Blocks\n\nA Block is a group of one or more task that live inside a workfront template\nproject.\nEach particular block must knows its tasks, the parameters of them and the\ndependencies among them so it can instantiate and configure them without\ndifficulties.\nThe fact that the tasks live inside a workfront template project is just a\nconvinient way of storing them(workfront does not allow to define a group of\ntemplate task out of a template project).\n\n### Workfront Project Containers\n\nProject Containers represents empty workfront project templates associated with\none or more custom forms that can allocate different blocks.\nThe idea of these project containers is to build different project types by\nadding different type of blocks to it.\nSo, basically a workfront project will be constructed by creating a project\ncontainer, setting the corresponding parameters to it and appending blocks to\nthe project container according to the behaviour that is needed for that\nproject. In this process, the parameters for the different blocks will be also\nset.\n\n## Creating Blocks\n\nInherit from **WFBlock** class to create a new specific block. A Workfront\nservice and a template id needs to be provided to the WFBlock constructor. The\ntemplate id must have only the tasks that belongs to this block.\nAlso fields can be marked as optional and required to be automatically validated\nwhen a new project is being constructed with this block.\n\nFor example, supose you want to add a block with 1 task:\n* My task : which has 2 parameters; name (required) and age (optional)\n\nHere it is an example of how you would make the block representing that task:\n\n```python\nclass MyWFBlock(WFBlock):\n def __init__(self, wf):\n template_id = template_id_from_name(wf, \"My block template\")\n super(WFEmailTestSeedBlock, self).__init__(wf, template_id)\n self._set_required_fields([\"name\"])\n self._set_optional_fields([\"age\"])\n```\n\nIn order to set the concrete values for those parameters the\n**set_task_param_value** method must be used.\nThe **set_task_param_value** receives a **task identifier** (that can be an\ninteger, indicating the number of the task in the template project, or a string\nfor the name of the task).\nProperties can be utilize for a clean design:\n\n```python\n@property\ndef name(self):\n return self._name\n\n@name.setter\ndef name(self, value):\n self.name = value\n self.set_task_param_value(\"My task\", \"name\", value)\n```\n\nThe purpose of using the **set_task_param_value** is that when the block is used\ninside a project container and a workfront project is build, the block knows\nhow to configure the value in the group of task represented by this block.\n\n### Starter task\n\nEach block has as default starter task the first task. However this can be\nchanged by using the **_set_starter_task(task_identifier)** method when\ninheriting from WFBlock.\nThis can be handy when having indentation task that only organize task. So, for\nexample if you have the following tasks in the block:\n\n* Grouping Task\n * Task 1\n * Task 2\n\nYou should set the Task 1 as a starter task skipping the Grouping Task that only\ngives some visual clarity indenting Task 1 and 2.\nWhy ? This is required when for example Task 1 is Automatic. The workfront proxy\nonly starts Automatic tasks when they are a direct predecessor of a completed\ntask.\nSo, in this case, when the predecessor of Grouping task is complete (and\nstarter task is the Grouping Task), Task 1 will not start (because Grouping Task\npredecessor is an indirect predecessor of Task 1). So to avoid that, Task 1\nmust be set as starter task.\nThis can be achieved in the constructor of the block like this :\n\n```python\n def __init(...)\n # Other blcok stuff...\n self._set_starter_task(2) # Task 1 is the second task\n # or you can set it by name\n self._set_starter_task(\"Task 1\")\n```\n\n## Creating Project Containers\n\nTo create a project container the new block should inherit from\n**WFProjectContainer**.\nAfter that, the template id of the workfront template project and the required\nand optional parameters should be provided. This can be done calling the parent\nconstructor and the methods **_set_required_fields** and\n**_set_optional_fields** (you can make use of the **template_id_from_name**\nfunction to get the template id):\n\n```python\nclass MyWFProjectContainer(WFProjectContainer)\n def __init__(self, wf, prj_name):\n tid = template_id_from_name(wf, \"My WF Template\")\n super(MyWFProjectContainer, self).__init__(wf, tid, prj_name)\n self._set_required_fields([\"workfront_param_value_req\"])\n self._set_optional_fields([\"workfront_param_value_optional\"])\n```\n\nThen you can set the variables that will fullfill the parameter values of the\nproject calling the **set_param_value** method. For example:\n\n```python\n@property\ndef my_param_value(self):\n return self._my_param_value\n\n@email_subject.setter\ndef my_param_value(self, v):\n self._my_param_value = v\n self.set_param_value(\"workfront_param_value_req\", v)\n```\n\nYou can check the **WFProjectEmailContainer** in workfront_bridge.projects.email\nfor a complete example.\n\n### Using Blocks inside a Project Container\n\nBlocks are made to be appended to a project container. A project container can\nhave one or more blocks of the same type.\nWhen adding a block to a project container, the block is appended to the project\nmaking this new block, dependent of the last added block. So for example, if\nblock1, block2, block3 are appended to the same project block in that order,\nthe workfront project will be created so that the starter task in block2 will\nonly be excetuted when the last task in block1 is completed. The same happens to\nblock3; the starter task created that belongs to block3 will only start after\nthe last task from block2 finishes.\n\nThe project container does not have any restriction in the order that the blocks\nare added to the project block, it is the user responsability to add the blocks\nin an order that has some logic.\n\nWe recommend using project builders in order to make life easier for those who\nwant to create workfront projects using this library. This allows user to\nre-use the code logic used to create particular workfront projects.\n\n## Using Project Builders\n\nTo easily create projects you can use project builders. Project builders provide\na simple interface with setters to create different projects structures.\n\nSo for example, to create a simple email project with 2 test list and 1 seed\nlist you will do something similar to this:\n\n```python\nfrom workfront.workfront import Workfront\nfrom workfront_bridge.projects.email_builder import EmailProjectBuilder\n\n# Create a Workfront Service object (using the workfront-sdk)\nwf = Workfront(\"email@wf.bridgemarketing.com\", \"pass***\")\nwf.login()\n\n# A project builder needs a Workfront service and a name to be constructed\nbuilder = EmailProjectBuilder(wf, \"Project Test Name\")\n\n# Then, the subject and a html is needed to be validated:\nbuilder.set_html(\"s3://some/s3/path/creative.html\")\n .set_subject(\"This is the subject!\")\n# In the case of email builder you can use a zip to construct the html. In that\n# case you will use this:\n# b.set_html_zip(\"s3://some/s3/path/creative.zip\")\n\n# Then, add two test list and a live seed list\nbuilder.add_test_list(\"s3://some/s3/test_list1.csv\")\n .add_test_list(\"s3://some/s3/test_list2.csv\")\n .set_seed_list(\"s3://some/s3/live_seed_list.csv)\n\n# Finally, build and obtain the Workfront project\nwf_project = b.build()\n# When calling build a WFBrigeException can arise telling you if some\n# parameters are missing, or something is wrong.\n```\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/BridgeMarketing/workfront-bridge", "keywords": "", "license": "bridgecorp", "maintainer": "", "maintainer_email": "", "name": "workfront-bridge", "package_url": "https://pypi.org/project/workfront-bridge/", "platform": "", "project_url": "https://pypi.org/project/workfront-bridge/", "project_urls": { "Homepage": "https://github.com/BridgeMarketing/workfront-bridge" }, "release_url": "https://pypi.org/project/workfront-bridge/0.1/", "requires_dist": null, "requires_python": "", "summary": "Workfront Bridge Project Library for Python", "version": "0.1" }, "last_serial": 4223706, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "7a4179f2716c27641fc6da9bb2c5096b", "sha256": "153e0ca19a528bae3fcd65f8fe81d80e87fdfb3f90fb136a8fa73e0c1e6efd60" }, "downloads": -1, "filename": "workfront-bridge-0.1.tar.gz", "has_sig": false, "md5_digest": "7a4179f2716c27641fc6da9bb2c5096b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11543, "upload_time": "2018-08-30T19:17:47", "url": "https://files.pythonhosted.org/packages/9d/82/b2d23403caa87404522a5c402ebcf5b7c081b450aff52f3368965d420b35/workfront-bridge-0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "7a4179f2716c27641fc6da9bb2c5096b", "sha256": "153e0ca19a528bae3fcd65f8fe81d80e87fdfb3f90fb136a8fa73e0c1e6efd60" }, "downloads": -1, "filename": "workfront-bridge-0.1.tar.gz", "has_sig": false, "md5_digest": "7a4179f2716c27641fc6da9bb2c5096b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11543, "upload_time": "2018-08-30T19:17:47", "url": "https://files.pythonhosted.org/packages/9d/82/b2d23403caa87404522a5c402ebcf5b7c081b450aff52f3368965d420b35/workfront-bridge-0.1.tar.gz" } ] }