Custom Pie Menu B3D 2.72b I have the following code which is a modified version of the template for new pie menus however it doesn't function properly.

pie.operator("transform.select_orientation", text="Local").orientation='LOCAL'


should change the orientation to Local. However it doesn't, it opens a menu instead. Why is this?

import bpy
from bpy.types import Menu

# spawn an edit mode selection pie (run while object is in edit mode to get a valid output)


class VIEW3D_PIE_template(Menu):
    #label is displayed at the center of the pie menu.
    bl_label = "Select Mode"

    def draw(self, context):
        layout = self.layout

        pie = layout.menu_pie()
        pie.operator("transform.select_orientation", text="Global").orientation='GLOBAL'
        pie.operator("transform.select_orientation", text="Local").orientation='LOCAL'
addon_keymaps = []
def register():
    bpy.utils.register_class(VIEW3D_PIE_template)
    wm = bpy.context.window_manager

    if wm.keyconfigs.addon:
        km = wm.keyconfigs.addon.keymaps.new(name='Object Non-modal')
        kmi = km.keymap_items.new('wm.call_menu_pie', 'D', 'PRESS', ctrl=True,)
        addon_keymaps.append(km)

def unregister():
    bpy.utils.unregister_class(VIEW3D_PIE_template)

    wm = bpy.context.window_manager

    if wm.keyconfigs.addon:
        for km in addon_keymaps:
            for kmi in km.keymap_items:
                km.keymap_items.remove(kmi)

        wm.keyconfigs.addon.keymaps.remove(km)

    # clear the list
    del addon_keymaps[:]

if __name__ == "__main__":
    register()
    bpy.ops.wm.call_menu_pie(name="VIEW3D_PIE_template")
The invoke method of the operator is called which shows the menu. 

You might set the operator's context using UILayout.operator_context to EXEC_DEFAULT to directly call the operators execute method with the argument given:

pie.operator_context = 'EXEC_DEFAULT'
pie.operator("transform.select_orientation", text="Local").orientation='LOCAL'


You can also use the generic wm.context_set_enum operator to change the transform orientation:

op_props = pie.operator("wm.context_set_enum")
op_props.data_path = "space_data.transform_orientation"
op_props.value = 'LOCAL'