Is it possible to disable all title/body validations?

(Martin Eriksson) #1

I am working on a script for importing large numbers of posts into Discourse. I have been spending a lot of time managing problems like title or body fields being too short, titles being all-caps, titles consisting of unusual characters etc. For some I have found settings, e.g. allowing all-caps titles. But I still have some special cases causing trouble, like posts with this body: “?” Despite setting min_post_length to 1, this is rejected and if I understand correctly this has to do with it being specifically a question mark. In any case, I have run into several of these cases with no obvious way of dealing with them by changing a setting.

My question is if it is possible to disable all similar validations, e.g. the Sentinel features and related things, and instead simply accept any string for the one-off purpose of running a batch importing job. If not, is there a list of all individual settings which are relevant to this? I have spent some time searching this forum and elsewhere but have had no luck so far. Sorry if this is old hat to you guys, in that case I would be very grateful for a pointer to where this has been explained.

Note that writing posts differently is not an option for me since I am importing tens of thousands of posts which are like they are. I certainly want to have those features, just not during the initial import. I also can not skip posts just because the are weird (e.g. consist of “?”) since this would cause other issues, e.g. in some cases such posts have replies made to them and I need to import the parent to properly import the children etc.

PS. I will be publishing an extensive update to an import script which I know will be useful to many who are in a similar situation, I just need to iron out a few more kinks first. The deadline for the stuff I am working on for my own project is December 31 and I plan to make a pull request to an existing but not well updated importer project in January.

(Sam Saffron) #2

Most importers skip validations by using the base importer.

(Martin Eriksson) #3

Brilliant! Looks like exactly the thing I am after. Thank you very much, @sam!

(Robin Ward) #4