So far so good. Next what I want to do is loop all the children and return all the images
media = Media( some_id )
if _is_folder( media ):
for item in media.Children:
if item.ContentType.Text == 'Image':
pass
This will throw an Object reference not set to an instance of an object on the ContentType property.
It's a little weird because when I check the type of 'item' it says it's a Media object.
To fix this I can do:
for item in media.Children:
item = Media( item.Id )
So in other words instantiate a new Media object using the Id of an other Media object.
I find this weird and maybe it's a bug? I think I had the same with Node, that the nodes the .Children property returns aren't complete and are missing properties them self.
Children of Media node missing properties?
I know the title is a little weird but I'll try and explain the problem.
Lets say you have a property from a currentPage that returns and id from a media node.
First you check if it's a folder.
So far so good. Next what I want to do is loop all the children and return all the images
media = Media( some_id )
This will throw an Object reference not set to an instance of an object on the ContentType property.
It's a little weird because when I check the type of 'item' it says it's a Media object.
To fix this I can do:
So in other words instantiate a new Media object using the Id of an other Media object.
I find this weird and maybe it's a bug? I think I had the same with Node, that the nodes the .Children property returns aren't complete and are missing properties them self.
Hi! Is this happening on v 4.52?
Regards
Jonas
Yep.
is working on a reply...