Mike Posted July 7, 2016 Report Share Posted July 7, 2016 So I'm starting to build out my custom folder structure using Lucidity. I have a recursive function that creates data dictionary chunks for each folder path and stores them in a list to be iterated over (much like in the create folders example hook). This is working great, but I'm running into issues with asset builds. When I try to get the object type of an asset build using this: item_type = item['object_type']['name'].lower() It returns a string: 'asset build' This is causing an issue with the Lucidity templates because they don't like spaces apparently. So when I'm creating my data dictionary chunk: templates_dict[item_type] = {'name': item['name']} And go to format the data: defregister_templates(self):='{project.name}/{folder.name}/3D/{asset build.name}/Production/{task.name}' returnTemplate('asset-maya',.join([,'Maya'])) I get an error that says 'Placeholder name contains invalid characters' If I do something like this: if item_type == 'asset build': item_type = 'assetbuild' It fixes the problem, is this an acceptable solution? Link to comment Share on other sites More sharing options...
Milan Kolar Posted July 11, 2016 Report Share Posted July 11, 2016 We just use a simple replace on all the keys to make sure, there are no unwanted characters in anything. key = key.replace(" ", '_').replace('\'', '') Link to comment Share on other sites More sharing options...
Mike Posted July 11, 2016 Author Report Share Posted July 11, 2016 Of course, so simple thanks! Link to comment Share on other sites More sharing options...
Martin Pengelly-Phillips Posted July 12, 2016 Report Share Posted July 12, 2016 For reference, the reason spaces are not supported for placeholders is because Lucidity uses the Python stdlib re module under the hood which also has this limitation. >>> re.compile("(?P<some group>.+)") error: bad character in group name 'some group' However, it should be possible to work around in Lucidity core if it is an issue for you folks. Just create a feature request at https://github.com/4degrees/lucidity/issues Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.