Lucidity: How to deal with spaces in object types?
1 1

4 posts in this topic

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:


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?

Share this post

Link to post
Share on other sites

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



Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
1 1