wuttafarm.app¶
Custom app handler for WuttaFarm
- class wuttafarm.app.WuttaFarmAppHandler(config)[source]¶
Custom app handler for WuttaFarm.
- auto_sync_from_farmos(obj, model_name, client=None, require=True)[source]¶
Import the given object from farmOS, using configured handler.
- Parameters:
obj – Any data record from farmOS.
model_name' – Model name for the importer to use, e.g.
"AnimalAsset".client – Existing farmOS API client to use. If not specified, a new one will be instantiated.
require – If true, this will require the import handler to support objects of the given type. If false, then nothing will happen / import is silently skipped when there is no such importer.
- auto_sync_to_farmos(obj, model_name=None, client=None, require=True)[source]¶
Export the given object to farmOS, using configured handler.
This should ensure the given object is also updated with the farmOS UUID and Drupal ID, when new record is created in farmOS.
- Parameters:
obj – Any data object in WuttaFarm, e.g. AnimalAsset instance.
client – Existing farmOS API client to use. If not specified, a new one will be instantiated.
require – If true, this will require the export handler to support objects of the given type. If false, then nothing will happen / export is silently skipped when there is no such exporter.
- display_format_datetime = '%a, %m/%d/%Y - %H:%M'¶
Format string to use when displaying
python:datetime.datetimeobjects. See alsorender_datetime().
- get_farmos_client(*args, **kwargs)[source]¶
Get a farmOS client. This is a convenience wrapper around
get_farmos_client().
- get_farmos_handler()[source]¶
Get the configured farmOS integration handler.
- Return type:
FarmOSHandler
- get_farmos_integration_mode()[source]¶
Returns the integration mode for farmOS, i.e. to control the app’s behavior regarding that.
- get_farmos_url(*args, **kwargs)[source]¶
Get a farmOS URL. This is a convenience wrapper around
get_farmos_url().
- get_normalizer(farmos_client=None)[source]¶
Get the configured farmOS integration handler.
- Return type:
FarmOSHandler
- is_farmos_3x(*args, **kwargs)[source]¶
Check if the farmOS version is 3.x. This is a convenience wrapper around
is_farmos_3x().
- is_farmos_4x(*args, **kwargs)[source]¶
Check if the farmOS version is 4.x. This is a convenience wrapper around
is_farmos_4x().
- is_farmos_mirror()[source]¶
Returns
Trueif the app is configured in “mirror” integration mode with regard to farmOS.
- class wuttafarm.app.WuttaFarmAppProvider(config)[source]¶
The app provider for WuttaFarm.