I'm working on a simple macro which us being written in IronRuby but I seem to be hitting a snag with reading the properties of the object. This is the script:
container = nil
currentPage.Children.each do |c|
container = c if c.NodeTypeAlias == 'WhatIWant'
end
if container
puts '<h2>' + container.GetProperty("something").Value + '</h2>'
end
(Stripped down for the example but the above code fails in the same manner)
When ever I have the call to GetProperty I receive the oh-so-helpful exception about the attribute loading fail, etc. But if I remove the call to GetProperty and replace it with container.Name it works just fine.
Digging through the forum and the RSS I've seen the above code work, but only when the call to GetProperty is on something that has been created from NodeFactory.
Has anyone got an example of an IronRuby script which accesses a GetProperty and works just fine?
Ok, turns out that when you're running Umbraco 4.5.x in .NET 3.5 and wanting to use the DLR you need to include the assembly Microsoft.Scripting.ExtensionAttribute.dll, which isn't in the download package from CodePlex. You can grab it out of the source repo though (that's what I had to do), this issue pointed me in the right direction: http://umbraco.codeplex.com/releases/view/51165
IronRuby and GetProperty problem
I'm working on a simple macro which us being written in IronRuby but I seem to be hitting a snag with reading the properties of the object. This is the script:
(Stripped down for the example but the above code fails in the same manner)
When ever I have the call to GetProperty I receive the oh-so-helpful exception about the attribute loading fail, etc. But if I remove the call to GetProperty and replace it with container.Name it works just fine.
Digging through the forum and the RSS I've seen the above code work, but only when the call to GetProperty is on something that has been created from NodeFactory.
Has anyone got an example of an IronRuby script which accesses a GetProperty and works just fine?
I'm using 4.5.2
Ok, turns out that when you're running Umbraco 4.5.x in .NET 3.5 and wanting to use the DLR you need to include the assembly Microsoft.Scripting.ExtensionAttribute.dll, which isn't in the download package from CodePlex. You can grab it out of the source repo though (that's what I had to do), this issue pointed me in the right direction: http://umbraco.codeplex.com/releases/view/51165
is working on a reply...