On 12/03/12 11:55, Michal Fojtik wrote:
> ACK.
>
> Small minor nit/suggestion below.
>
> -- Michal
>
> On Mar 9, 2012, at 6:42 PM, [email protected] wrote:
>
>> From: marios <[email protected]>
>>
>>
>> Signed-off-by: marios <[email protected]>
>> ---
>> .../drivers/mock/data/cimi/network/network1.json | 6 ++++
>> .../drivers/mock/data/cimi/network/network2.json | 6 ++++
>> .../network_configuration/network_config1.json | 15 ++++++++++++
>> .../network_configuration/network_config2.json | 15 ++++++++++++
>> server/lib/deltacloud/drivers/mock/mock_driver.rb | 25 ++++++++++++++-----
>> 5 files changed, 60 insertions(+), 7 deletions(-)
{snip---8<--------------}
>> - def convert_cimi_network(network, context)
>> - uri=context.network_url(network.name)
>> - network.uri=uri
>> - network.operations.each{|op| op.href=uri}
>> - network
>> + def convert_cimi_mock_urls(model_name, cimi_object, context)
>> + uri=context.send(:"#{model_name}_url", cimi_object.name)
>
> We should wrap this ^^ construction to some method, since I know
> we use this .send on many places. Some decent helper will prevent us
> from the pain when we change this 'url_for' in future:
ok, am going to push these as is for now - since I need to send fresh
patches to deal with new 'table' views for network index/show - I'll
include fixes in new patches. But not entirely sure what you mean here
though... like you want a new definition like cimi_url_for
in server/lib/sinatra/url_for.rb?
marios
>
> def url_for(model, id) # url_for model_name, cimi_object.name
>
>
>> + cimi_object.uri=uri
>> + cimi_object.operations.each{|op| op.href=uri}
>> + cimi_object
>> end
>>
>> exceptions do
>> --
>> 1.7.6.5
>>
>