Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Aaron Powell 1708 posts 3046 karma points c-trib
    Nov 23, 2010 @ 06:40
    Aaron Powell
    0

    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:

    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?

    I'm using 4.5.2

  • Aaron Powell 1708 posts 3046 karma points c-trib
    Nov 23, 2010 @ 07:34
    Aaron Powell
    0

    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

Please Sign in or register to post replies

Write your reply to:

Draft