Subtemplates in bobtemplates plone or the way to plonecli
CC Attribution 3.0 Germany:
You are free to use, adapt and copy, distribute and transmit the work or content in adapted or unchanged form for any legal purpose as long as the work is attributed to the author in the manner specified by the author or licensor.
Derstappen, Maik
I'll show new bobtemplates.plone features such as subtemplates and the new, more modular structure. We also plan to create a plonecli (command line interface) which will use bobtemplates.plone but will be easier to use. It will make the process of learning to develop with Plone easier than ever before.
 My name is Mike Derstappen. I'm from Germany from Leipzig. Also half of living in Bucharest. I just wanted to show the current state of my work on Bob templates, Plone, and also I recently started to work on Bob templates itself. Once upon a time, there was a time when starting with Plone and creating Plone add-ons was a little bit easier than it was in the last few years. When I started with Plone, I did something like this. I was inserting SoapSkell. I was not textivity back then, but I just did something like that to create a package. Then inside the package, I created content types. I had some content types and then I had some documentation when I could just fill out some pieces and I had a working add-on. This usually didn't take more than 15 minutes or something, but SoapSkell is not really maintained anymore. It had some issues and maintenance. Also, it was basing on paste scripts and this is not really a good paste. That's why the Plone community moved to Mr. Bob and created the Bob templates Plone. This was supposed to be the new way of doing things. It is smaller, the templates are easier to build and easier to test. The existing templates were really basic. No real option to add content types or other pieces like vocabulary or theme. It was really like take it or leave it and then you could head a starting point and customize. You also have no list of available templates. In SoapSkell, you could just show the templates you have. If the community provided new templates, you just see them and try them out. This is also a thing I was missing in Mr. Bob. Also, who can really remember that? I mean, now I can because I used it a lot and also had some variations, but it was always hard to remember. I had to go to the Bob templates Plone documentation to copy and paste this crazy command. I had to fix that. I had a project like, I don't know, half a year ago where I wanted to create a lot of textivity types and then it was like, no, I fix that now. My vision, give me a tool which helps. I want to create different packages. I want to create an add-on. We already could. I also want things like we had in SoapSkell, like give me a build out skeleton for development, for developing a project and maybe other things. More important, I want to extend the package with content types, vocabularies, scene and whatnot. Also, I want to have, when I started with new skeletons and creating new package, I want to use best practice. I also want that when people creating the stuff using the tools we gave them, that they have already a really good practice. Of course, they can change it, but they have a good starting point. When I use the tools, I want already a lot of basic tests. Tests we usually have in all our packages, like testing if I can actually install this add-on and check if I can use the content type under certain conditions and stuff like that. When I create a content type, the template should provide me already tests for that. I want, of course, easy usage on the command line. I want to install clone CLI with pip, like everybody else. I want to say, it should give me a list of templates. This is also nested, so there's an add-on template. It has some sub templates, which I can use to extend it. Then I have another template build out. Then I want to use it like this, clone CLI, create add-on, collectee, to do something like that. I also want to use it to extend. I go into the call of duty package I just created. Then I do again list templates. It just shows me the sub templates, because it doesn't make sense to create the standalone template, like an add-on in and out. We only care about the sub templates here. Then I just use the sub templates to create one or more content types, one or more vocabularies, and also maybe a scene. It could be handy if I just want one package, which is a scene, but also needs some content types, probably, to provide some structure and data, which I want to use. That would be nice, wouldn't it? When can we have it? Most of it is actually done. The current state of opt-templates-plone in the free version is we have these standalone templates. We have free currently. We have some sub templates, which we can use to gradually extend a package. We also have some basic test structure inside the single packages, the single template. The add-on template itself has some tests. The content type part has some additional tests, which will be added when you add a content type and the scene and stuff like that. We have to extend this, so it's not like rock solid. The structure is there. We can use it. We can extend it, make it better. But it will be already tested. We currently run all the tests on Travis with talks. Alexander helped me a lot with that. What we are doing is we are actually using this stuff. We are creating an add-on. We are creating content type in the add-on. We also add a scene and vocabulary. Then we run the test on it from the package. We build the package, run build-out and all the stuff. As you would use it, you would create a package, you would create a virtual amp and build-out, and then you would run the test, and they should pass. That's what we are doing on Travis. Basically, the packages should work if the tests are enough. We have this and a lone template. These are currently this free. We have the basic add-on, which was before when you answered the first question of type like basic. There was a textivity and there was also a scene, but this was just a variation inside the template. We have a build-out, which is really a basic build-out to start. I use this stuff usually for project build-out when I have some packages for this project. We have a scene package. There is also a sub-template scene later. You can get confused, but the scene package is what we had before. It's a full standalone scene package. It's based on Baselneta. It has also a grant setup, so this is the whole stack. That's one way to go. I can show you another way. The sub-template content type, this gives you some options. You can use the XML model, so the supermodel, which is the default because it's extendable through the web. You also can decide, no, I don't want that. I'm a Python programmer. I don't want to write XML. I don't need through the web, so I just go with the schema and you're fine. You also have vocabularies, which will basically create a structure. You have a vocabulary and all the registration. You just have to fill out the Python method, which actually collects your data, whatever this is. You can use it like a static list or you do a catalog call and create your terms. This is really handy then. The scene. The scene is like what Asco was showing us. He built this really nice packages, the scene setup and the scene fragment. When you add the scene, it will add these dependencies to your Python package. When you deploy it with a zip file, of course, you have to have it on the server, too. Whoever maintains the server should provide this. The examples already have some basic data set up, really basic index, HTML, and some basic rules. There's a rule also in it, which gives you the clone toolbar. But when you first use it and install it, you will have the toolbar and you will have completely the clone content. We just pull everything over, but it's unseen. Usually, you will just remove this rule and then you have a bunch of uncomment rules, which you have to adjust to your scene. Usually, with this approach, you will go to a scene force or whatever or to your SEMA and they will give you just a bunch of static HTML. You will put it inside and then you just map it. You have examples in it and you can use this. What you also got inside the scene package is some of these registry configuration examples so that you can say, I don't want anything else than folders in the portal navigation and also I don't want news items and images and files in the normal navigation, which I always find stupid, but it's your decision. So you need some configuration of clone in your SEMA and as we have these options now, you can build your SEMA. So we have examples in it. The future, we can of course extend that. I'm pretty sure that there will come more soon. I started already with behavior, tile, portlet, whatever these pieces are, I think useful and we can extend that. So I think that's the structure there. I also refactored the Python code for that before we had in the Bob templates just one file which was called hooks. There was basically everything in it and this was more like handling the questions we answered before. I want the textivity type so okay. Mr. Bob is just pushing and rolling out the structure we gave them. And with Python, after that we can adjust that and before it was more like cleaning up like if it's not the SEME, then remove the SEME folder and stuff like that. As we are now more modular, we don't have this need. So we have single Python files for the single modules. We have also a base file which has some base stuff like finding the package route and stuff like that. So extending that should be really easy. You can just follow the existing stuff and the work you have to do for adding that is usually providing the structure like files and folders you want to create and then probably update some files and this is the most hard part depending on what you want to do. But there are examples like updating the XML files or the types XML. So it's not magic. This is an example of how you can currently create this. You might notice the Bob template dot plon colon add-on if you ever used Bob templates before. That was actually a back before because even though the name was showing us a name space, there was no name space inside. So actually it was conflicting with other Bob templates dot something and there are also some of them which also don't have a name space. So if you call a template Bob templates dot add-on and the pyramid guys do the same, then you will not get your add-on probably because it's the same name space. This is now fixed so you have the dot plon before the colon as we don't need, we are done in our focus, we can just call it add-on in our case and not clone add-on as before. And the rest is the same like before. Then you go into your package and you call Bob templates, a MrBob Bob template colon content type or colon seam or colon vocabulary. That basically works. I just realized that there's an alpha version already released but there's an arrow in one of the things. But I will spend on that so yeah, to MrBob itself, as I mentioned, I want to have a list of existing templates. So I have a fork where I'm working on this and if that goes upstream then we have an option like I showed before in my vision. So we are actually not that far from the whole plon CLI which is basically, yeah, it installs Bob templates plon and MrBob and maybe some other packages which will provide Bob templates. Because now we have a central registry in MrBob so you can actually, to your package as in Bob templates plon, you add an entry point, this will register your templates to MrBob so MrBob can list them and can use them. So that is, we're really handy then. On plon CLI we want even shorter commands as an example and also I want auto completion on the command line so that I not even have to use the list template. I just do this and it will show me what I can use. And I think we can reach that on the weekend. Yeah, we will spend on that. So please join if you just have ideas, just want to work on the command line client. I will use this probably with the click module but yeah, I will see. But also contribute to the templates. I mean this is really easy. If you think templates should do something else like you read some of the 100,000 perhaps clips whatever and you say this has to be like this then just get in touch or make a pull request. So let's just let discuss on that pull request and it should be easy. Yeah, that's basically it. So I hope it's interesting and I will see some of you at the screen. Thank you. Yeah, we can think about that. It's probably more complicated. I mean one feature I want to have in Mr. Bob itself is the option to not override files. I mean by now if you use a some template it will warn you and you have to actually say yes I know what I'm doing. The reason for that is if you use this it will just pull out the files and generate the stuff. So if you have already files because you added it manually or whatever it will override your files. So the way now you should use it is work with a clean repository state. So if Git status says everything is checked in you're fine you use the templates and you do Git diff and you see the differences. You can fix if you have like overriding stuff. It would be nice if we have an override option or not override option. That would be the first thing and updating that's more like an audit. So we could do or add some functionalities in Bob templates which gives you a command which checks your structure. Something like that. But it will totally like fit in. So I mean we have to write the Python functionality for that because I mean we will update the templates. So we have to template always in the past shape and communities like Aurelia, for example, they say OK just use the template and then compare it. I mean this is easy. You have different you can just see what what did that change. But I can imagine that we create the Python command for that or whatever to point on that. Thank you.
 My name is Mike Derstappen. I'm from Germany from Leipzig. Also half of living in Bucharest.  I just wanted to show the current state of my work on Bob templates, Plone, and also I recently started to work on Bob templates itself.  Once upon a time, there was a time when starting with Plone and creating Plone add-ons was a little bit easier than it was in the last few years.  When I started with Plone, I did something like this. I was inserting SoapSkell. I was not textivity back then, but I just did something like that to create a package.  Then inside the package, I created content types. I had some content types and then I had some documentation when I could just fill out some pieces and I had a working add-on.  This usually didn't take more than 15 minutes or something, but SoapSkell is not really maintained anymore. It had some issues and maintenance.  Also, it was basing on paste scripts and this is not really a good paste.  That's why the Plone community moved to Mr. Bob and created the Bob templates Plone. This was supposed to be the new way of doing things.  It is smaller, the templates are easier to build and easier to test.  The existing templates were really basic. No real option to add content types or other pieces like vocabulary or theme.  It was really like take it or leave it and then you could head a starting point and customize.  You also have no list of available templates. In SoapSkell, you could just show the templates you have.  If the community provided new templates, you just see them and try them out. This is also a thing I was missing in Mr. Bob.  Also, who can really remember that? I mean, now I can because I used it a lot and also had some variations, but it was always hard to remember.  I had to go to the Bob templates Plone documentation to copy and paste this crazy command.  I had to fix that. I had a project like, I don't know, half a year ago where I wanted to create a lot of textivity types and then it was like, no, I fix that now.  My vision, give me a tool which helps. I want to create different packages. I want to create an add-on. We already could.  I also want things like we had in SoapSkell, like give me a build out skeleton for development, for developing a project and maybe other things.  More important, I want to extend the package with content types, vocabularies, scene and whatnot.  Also, I want to have, when I started with new skeletons and creating new package, I want to use best practice.  I also want that when people creating the stuff using the tools we gave them, that they have already a really good practice.  Of course, they can change it, but they have a good starting point.  When I use the tools, I want already a lot of basic tests. Tests we usually have in all our packages, like testing if I can actually install this add-on and check if I can use the content type under certain conditions and stuff like that.  When I create a content type, the template should provide me already tests for that.  I want, of course, easy usage on the command line.  I want to install clone CLI with pip, like everybody else. I want to say, it should give me a list of templates.  This is also nested, so there's an add-on template. It has some sub templates, which I can use to extend it.  Then I have another template build out. Then I want to use it like this, clone CLI, create add-on, collectee, to do something like that.  I also want to use it to extend. I go into the call of duty package I just created.  Then I do again list templates. It just shows me the sub templates, because it doesn't make sense to create the standalone template, like an add-on in and out.  We only care about the sub templates here. Then I just use the sub templates to create one or more content types, one or more vocabularies, and also maybe a scene.  It could be handy if I just want one package, which is a scene, but also needs some content types, probably, to provide some structure and data, which I want to use.  That would be nice, wouldn't it?  When can we have it?  Most of it is actually done. The current state of opt-templates-plone in the free version is we have these standalone templates.  We have free currently. We have some sub templates, which we can use to gradually extend a package. We also have some basic test structure inside the single packages, the single template.  The add-on template itself has some tests. The content type part has some additional tests, which will be added when you add a content type and the scene and stuff like that.  We have to extend this, so it's not like rock solid. The structure is there. We can use it. We can extend it, make it better. But it will be already tested.  We currently run all the tests on Travis with talks. Alexander helped me a lot with that. What we are doing is we are actually using this stuff. We are creating an add-on.  We are creating content type in the add-on. We also add a scene and vocabulary. Then we run the test on it from the package.  We build the package, run build-out and all the stuff. As you would use it, you would create a package, you would create a virtual amp and build-out, and then you would run the test, and they should pass.  That's what we are doing on Travis. Basically, the packages should work if the tests are enough.  We have this and a lone template. These are currently this free. We have the basic add-on, which was before when you answered the first question of type like basic.  There was a textivity and there was also a scene, but this was just a variation inside the template. We have a build-out, which is really a basic build-out to start. I use this stuff usually for project build-out when I have some packages for this project.  We have a scene package. There is also a sub-template scene later. You can get confused, but the scene package is what we had before. It's a full standalone scene package. It's based on Baselneta.  It has also a grant setup, so this is the whole stack. That's one way to go. I can show you another way. The sub-template content type, this gives you some options.  You can use the XML model, so the supermodel, which is the default because it's extendable through the web. You also can decide, no, I don't want that. I'm a Python programmer. I don't want to write XML. I don't need through the web, so I just go with the schema and you're fine.  You also have vocabularies, which will basically create a structure. You have a vocabulary and all the registration. You just have to fill out the Python method, which actually collects your data, whatever this is.  You can use it like a static list or you do a catalog call and create your terms. This is really handy then. The scene. The scene is like what Asco was showing us. He built this really nice packages, the scene setup and the scene fragment.  When you add the scene, it will add these dependencies to your Python package. When you deploy it with a zip file, of course, you have to have it on the server, too. Whoever maintains the server should provide this.  The examples already have some basic data set up, really basic index, HTML, and some basic rules. There's a rule also in it, which gives you the clone toolbar.  But when you first use it and install it, you will have the toolbar and you will have completely the clone content. We just pull everything over, but it's unseen.  Usually, you will just remove this rule and then you have a bunch of uncomment rules, which you have to adjust to your scene.  Usually, with this approach, you will go to a scene force or whatever or to your SEMA and they will give you just a bunch of static HTML. You will put it inside and then you just map it.  You have examples in it and you can use this. What you also got inside the scene package is some of these registry configuration examples so that you can say, I don't want anything else than folders in the portal navigation  and also I don't want news items and images and files in the normal navigation, which I always find stupid, but it's your decision.  So you need some configuration of clone in your SEMA and as we have these options now, you can build your SEMA. So we have examples in it.  The future, we can of course extend that. I'm pretty sure that there will come more soon. I started already with behavior, tile, portlet, whatever these pieces are, I think useful and we can extend that.  So I think that's the structure there. I also refactored the Python code for that before we had in the Bob templates just one file which was called hooks.  There was basically everything in it and this was more like handling the questions we answered before. I want the textivity type so okay. Mr. Bob is just pushing and rolling out the structure we gave them.  And with Python, after that we can adjust that and before it was more like cleaning up like if it's not the SEME, then remove the SEME folder and stuff like that.  As we are now more modular, we don't have this need. So we have single Python files for the single modules. We have also a base file which has some base stuff like finding the package route and stuff like that.  So extending that should be really easy. You can just follow the existing stuff and the work you have to do for adding that is usually providing the structure like files and folders you want to create and then probably update some files and this is the most hard part depending on what you want to do.  But there are examples like updating the XML files or the types XML. So it's not magic.  This is an example of how you can currently create this. You might notice the Bob template dot plon colon add-on if you ever used Bob templates before. That was actually a back before because even though the name was showing us a name space, there was no name space inside.  So actually it was conflicting with other Bob templates dot something and there are also some of them which also don't have a name space.  So if you call a template Bob templates dot add-on and the pyramid guys do the same, then you will not get your add-on probably because it's the same name space.  This is now fixed so you have the dot plon before the colon as we don't need, we are done in our focus, we can just call it add-on in our case and not clone add-on as before.  And the rest is the same like before. Then you go into your package and you call Bob templates, a MrBob Bob template colon content type or colon seam or colon vocabulary.  That basically works. I just realized that there's an alpha version already released but there's an arrow in one of the things.  But I will spend on that so yeah, to MrBob itself, as I mentioned, I want to have a list of existing templates.  So I have a fork where I'm working on this and if that goes upstream then we have an option like I showed before in my vision.  So we are actually not that far from the whole plon CLI which is basically, yeah, it installs Bob templates plon and MrBob and maybe some other packages which will provide Bob templates.  Because now we have a central registry in MrBob so you can actually, to your package as in Bob templates plon, you add an entry point, this will register your templates to MrBob so MrBob can list them and can use them.  So that is, we're really handy then. On plon CLI we want even shorter commands as an example and also I want auto completion on the command line so that I not even have to use the list template.  I just do this and it will show me what I can use. And I think we can reach that on the weekend. Yeah, we will spend on that.  So please join if you just have ideas, just want to work on the command line client. I will use this probably with the click module but yeah, I will see.  But also contribute to the templates. I mean this is really easy. If you think templates should do something else like you read some of the 100,000 perhaps clips whatever and you say this has to be like this then just get in touch or make a pull request.  So let's just let discuss on that pull request and it should be easy. Yeah, that's basically it. So I hope it's interesting and I will see some of you at the screen.  Thank you.  Yeah, we can think about that. It's probably more complicated. I mean one feature I want to have in Mr. Bob itself is  the option to not override files. I mean by now if you use a some template it will warn you and you have to actually say yes I know what I'm doing.  The reason for that is if you use this it will just pull out the files and generate the stuff. So if you have already files because you added it manually or whatever it will override your files.  So the way now you should use it is work with a clean repository state. So if Git status says everything is checked in you're fine you use the templates and you do Git diff and you see the differences.  You can fix if you have like overriding stuff. It would be nice if we have an override option or not override option. That would be the first thing and updating that's more like an audit.  So we could do or add some functionalities in Bob templates which gives you a command which checks your structure. Something like that.  But it will totally like fit in. So I mean we have to write the Python functionality for that because I mean we will update the templates.  So we have to template always in the past shape and communities like Aurelia, for example, they say OK just use the template and then compare it.  I mean this is easy. You have different you can just see what what did that change. But I can imagine that we create the Python command for that or whatever to point on that.  Thank you.
Day_3__Maik_Derstappen_-_Subtemplates_in_bobtempla_IO2BjkO7KHI_0_47.png Day_3__Maik_Derstappen_-_Subtemplates_in_bobtempla_IO2BjkO7KHI_48_131.png Day_3__Maik_Derstappen_-_Subtemplates_in_bobtempla_IO2BjkO7KHI_132_203.png Day_3__Maik_Derstappen_-_Subtemplates_in_bobtempla_IO2BjkO7KHI_204_251.png Day_3__Maik_Derstappen_-_Subtemplates_in_bobtempla_IO2BjkO7KHI_252_935.png Day_3__Maik_Derstappen_-_Subtemplates_in_bobtempla_IO2BjkO7KHI_936_1007.png Day_3__Maik_Derstappen_-_Subtemplates_in_bobtempla_IO2BjkO7KHI_1008_2315.png Day_3__Maik_Derstappen_-_Subtemplates_in_bobtempla_IO2BjkO7KHI_2316_2807.png Day_3__Maik_Derstappen_-_Subtemplates_in_bobtempla_IO2BjkO7KHI_2808_3299.png Day_3__Maik_Derstappen_-_Subtemplates_in_bobtempla_IO2BjkO7KHI_3300_4487.png Day_3__Maik_Derstappen_-_Subtemplates_in_bobtempla_IO2BjkO7KHI_4488_5123.png Day_3__Maik_Derstappen_-_Subtemplates_in_bobtempla_IO2BjkO7KHI_5124_5591.png Day_3__Maik_Derstappen_-_Subtemplates_in_bobtempla_IO2BjkO7KHI_5592_8363.png Day_3__Maik_Derstappen_-_Subtemplates_in_bobtempla_IO2BjkO7KHI_8364_8411.png Day_3__Maik_Derstappen_-_Subtemplates_in_bobtempla_IO2BjkO7KHI_8412_8999.png Day_3__Maik_Derstappen_-_Subtemplates_in_bobtempla_IO2BjkO7KHI_9000_9047.png Day_3__Maik_Derstappen_-_Subtemplates_in_bobtempla_IO2BjkO7KHI_9048_9167.png Day_3__Maik_Derstappen_-_Subtemplates_in_bobtempla_IO2BjkO7KHI_9168_9863.png Day_3__Maik_Derstappen_-_Subtemplates_in_bobtempla_IO2BjkO7KHI_9864_10403.png Day_3__Maik_Derstappen_-_Subtemplates_in_bobtempla_IO2BjkO7KHI_10404_10487.png Day_3__Maik_Derstappen_-_Subtemplates_in_bobtempla_IO2BjkO7KHI_10488_10691.png Day_3__Maik_Derstappen_-_Subtemplates_in_bobtempla_IO2BjkO7KHI_10692_13547.png Day_3__Maik_Derstappen_-_Subtemplates_in_bobtempla_IO2BjkO7KHI_13548_13715.png Day_3__Maik_Derstappen_-_Subtemplates_in_bobtempla_IO2BjkO7KHI_13716_15275.png Day_3__Maik_Derstappen_-_Subtemplates_in_bobtempla_IO2BjkO7KHI_15276_23483.png Day_3__Maik_Derstappen_-_Subtemplates_in_bobtempla_IO2BjkO7KHI_23484_23951.png Day_3__Maik_Derstappen_-_Subtemplates_in_bobtempla_IO2BjkO7KHI_23952_25379.png Day_3__Maik_Derstappen_-_Subtemplates_in_bobtempla_IO2BjkO7KHI_25380_25631.png Day_3__Maik_Derstappen_-_Subtemplates_in_bobtempla_IO2BjkO7KHI_25632_25895.png Day_3__Maik_Derstappen_-_Subtemplates_in_bobtempla_IO2BjkO7KHI_25896_26699.png Day_3__Maik_Derstappen_-_Subtemplates_in_bobtempla_IO2BjkO7KHI_26700_27287.png Day_3__Maik_Derstappen_-_Subtemplates_in_bobtempla_IO2BjkO7KHI_27288_28895.png Day_3__Maik_Derstappen_-_Subtemplates_in_bobtempla_IO2BjkO7KHI_28896_29483.png Day_3__Maik_Derstappen_-_Subtemplates_in_bobtempla_IO2BjkO7KHI_29484_30167.png Day_3__Maik_Derstappen_-_Subtemplates_in_bobtempla_IO2BjkO7KHI_30168_35639.png Day_3__Maik_Derstappen_-_Subtemplates_in_bobtempla_IO2BjkO7KHI_35640_35757.png