Closed sebbbastien closed 5 years ago
Elements returned with suffix 'Dynamic' are constructed dynamically and are generally considered immutable, however an objects mutability can change from SMC API version. In this case, Geolocation objects became mutable in 6.6 (btw, some versioning changes are going to be made soon to ensure pinning of smc-python vs. SMC API).
Create constructors are always unique as their base requirements are unique per element type. I just pushed a patch for Gelocation mutable elements to the dev branch, here is an example:
from smc.elements.other import Geolocation
mygeo = Geolocation.create(name='acoldplace', latitude='-90.0', longitude='120.0')
pprint(vars(mygeo.data))
# Get any user created geo objects
for geo in Geolocation.objects.all():
print(geo)
Signature is:
@classmethod
def create(cls, name, latitude, longitude, country_code='US', **kw)
The kwargs passed in can match the top level json kwarg if you need to add additional settings.
Hi David,
It works like a charm, thanks!
Best regards,
Hi David,
I have to create Geolocation objects.
I tried to mimic the
generic_element
approach with this codeDid I miss something? Is there a simple way to create un-implemented objects with smc-python, without writing a dedicated class? Geolocation is an "atomic" object, it does not refer to other objects unlike many others.
Best regards,