The following logic could be shared among Python scrapers for handling description and long_description length and the distinction between user-provided and default values:
three parameters are provided to the function:
a default description (typically retrieved online from some metadata)
an optional user-defined description (typically a CLI arg)
an optional user-defined long_description (typically a CLI arg)
the function returns:
a description
an optional long_description
if set, the two user-defined values are checked to not exceed ZIM maximum length ; an error is thrown otherwise ; if ok, they are returned
if user-defined description is not set, it is computed based on the default description (truncated if needed)
if user-defined long_description is not set and default description has been truncated (because it was too long for the description field), the long_description is computed based on the default description (truncated if needed), otherwise it is not set
The following logic could be shared among Python scrapers for handling
description
andlong_description
length and the distinction between user-provided and default values:description
(typically retrieved online from some metadata)description
(typically a CLI arg)long_description
(typically a CLI arg)description
long_description
description
is not set, it is computed based on the default description (truncated if needed)long_description
is not set and default description has been truncated (because it was too long for the description field), thelong_description
is computed based on the default description (truncated if needed), otherwise it is not setCode is almost already ready in kolibri