Ed Howland
2006-Nov-10 18:10 UTC
[Masterview-users] Failure to parse templates - user defined directives w/MV: 0.3.0
Jeff and Deb, Turns out I had a project with many user defined directives. I installed 0.3.0 and followed the instructions in your email. What I did was this (in a typical directive in <rails_app>/app/masterview/directives/text_field_tag.rb:) require ''masterview/deprecated/directive_base'' module MasterView module Directives class Text_field_tag < MasterView::DirectiveBaseOld ... # for testing this just redefines empty stag/etag methods Then I went into all .html files that had custom directives and changed the namespace from mv: to mvx: (Note: the errors below were unchanged before I switched namespaces to mvx) Running rake mv:parse results in : ERROR -- : Failure to parse template. Exception=undefined method `attribute_qname'' for MasterView::Directives::Text_field_tag:Class It also seems to be missing class method : namespace_name Now, some other directives complain about this: ERROR -- : Failure to parse template. Exception=undefined method `harden_metadata'' for MasterView::Directives::Link_to_remote_no_quote:Class These exist only in 0.3.0. So it seems that while it seems to be seeing my existing directives in the new namespace or using the new directive_base.rb instead of the old deprecated one. Have I missed a step? Ed -- Ed Howland http://greenprogrammer.blogspot.com
Ed Howland
2006-Nov-10 18:51 UTC
[Masterview-users] Failure to parse templates - user defined directives w/MV: 0.3.0
I wrote once upon a time:> These exist only in 0.3.0. So it seems that while it seems to be > seeing my existing directives in the new namespace or using the new > directive_base.rb instead of the old deprecated one. > > Have I missed a step? >I remember a previous upgrade had reset my settings.rb file, so I restored the settings there. Basically it was just adding config.directive_paths << ''app/masterview/directives'' Since that had no effect, and nothing else did, I still think MV is not finding my directives, since I can not effect the output of rake mv:parse no matter what I try. This leads me to believe these are really error messages that mean ''Failed to find a directive matching mvx:your_directive_name'' Ed -- Ed Howland http://greenprogrammer.blogspot.com
Jeff Barczewski
2006-Nov-10 19:17 UTC
[Masterview-devel] Failure to parse templates - user defined directives w/MV: 0.3.0
On 11/10/06, Ed Howland <ed.howland at gmail.com> wrote:> > Jeff and Deb, > > Turns out I had a project with many user defined directives. I > installed 0.3.0 and followed the instructions in your email. > > What I did was this (in a typical directive in > <rails_app>/app/masterview/directives/text_field_tag.rb:) > > require ''masterview/deprecated/directive_base'' > module MasterView > module Directives > class Text_field_tag < MasterView::DirectiveBaseOld > ... > # for testing this just redefines empty stag/etag methods > > Then I went into all .html files that had custom directives and > changed the namespace from mv: to mvx: (Note: the errors below were > unchanged before I switched namespaces to mvx) > > Running rake mv:parse results in : > ERROR -- : Failure to parse template. Exception=undefined method > `attribute_qname'' for MasterView::Directives::Text_field_tag:Class > It also seems to be missing class method : namespace_name > > Now, some other directives complain about this: > ERROR -- : Failure to parse template. Exception=undefined method > `harden_metadata'' for > MasterView::Directives::Link_to_remote_no_quote:Class > > These exist only in 0.3.0. So it seems that while it seems to be > seeing my existing directives in the new namespace or using the new > directive_base.rb instead of the old deprecated one. > > Have I missed a step?Sounds like you did all the right things. Let me take a look and see if I can figure out how to resolve this. Jeff -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/masterview-devel/attachments/20061110/26e0f006/attachment.html
Jeff Barczewski
2006-Nov-10 19:53 UTC
[Masterview-devel] Failure to parse templates - user defined directives w/MV: 0.3.0
On 11/10/06, Ed Howland <ed.howland at gmail.com> wrote:> > Jeff and Deb, > > Turns out I had a project with many user defined directives. I > installed 0.3.0 and followed the instructions in your email. > > What I did was this (in a typical directive in > <rails_app>/app/masterview/directives/text_field_tag.rb:) > > require ''masterview/deprecated/directive_base'' > module MasterView > module Directives > class Text_field_tag < MasterView::DirectiveBaseOld > ... > # for testing this just redefines empty stag/etag methods > > Then I went into all .html files that had custom directives and > changed the namespace from mv: to mvx: (Note: the errors below were > unchanged before I switched namespaces to mvx) > > Running rake mv:parse results in : > ERROR -- : Failure to parse template. Exception=undefined method > `attribute_qname'' for MasterView::Directives::Text_field_tag:Class > It also seems to be missing class method : namespace_name > > Now, some other directives complain about this: > ERROR -- : Failure to parse template. Exception=undefined method > `harden_metadata'' for > MasterView::Directives::Link_to_remote_no_quote:Class > > These exist only in 0.3.0. So it seems that while it seems to be > seeing my existing directives in the new namespace or using the new > directive_base.rb instead of the old deprecated one. > > Have I missed a step? > > Ed > > >Deb, I am out the door to get on a plane, will be back Wednesday. Can you take a look at Ed''s problem? It looks like we didn''t have good test coverage in this area. I added a test example_directive_base_old_test.rb into the trunk, so if you have time to test you can run that. Also sounds like he might have some other issues with it finding his directives. PS. Also we can upgrade his directives to the new API as well, but we should resolve the problems either way. Thanks, Jeff -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/masterview-devel/attachments/20061110/9fffaf71/attachment.html
Ed Howland
2006-Nov-10 20:30 UTC
[Masterview-devel] Failure to parse templates - user defined directives w/MV: 0.3.0
On 11/10/06, Jeff Barczewski <jeff.barczewski at gmail.com> wrote:> > Deb, > > I am out the door to get on a plane, will be back Wednesday. > > Can you take a look at Ed''s problem? > > It looks like we didn''t have good test coverage in this area. I added a test > example_directive_base_old_test.rb into the trunk, so if > you have time to test you can run that. > > Also sounds like he might have some other issues with it finding his > directives. > > PS. Also we can upgrade his directives to the new API as well, but we should > resolve the problems either way.I am starting to convert over the existing directives one by one to the new API. And examining what my internal need is for them is. So, if Deb can be available to help coach me on that if I need it, that will help. Ed Ed Howland http://greenprogrammer.blogspot.com
Deb Lewis
2006-Nov-10 20:40 UTC
[Masterview-users] Failure to parse templates - user defineddirectives w/MV: 0.3.0
ooh, ick - you did right; we missed something in our backwards compatibility for old directive implementations. The new directive architecture includes a mixin class called DirectiveMetadata that the loading and processing facilities rely on now. I''ll have to take a look and see if we can hook this directly into the old directive base class or whether we need to patch the necessary protocol back onto the old guy in a different fashion.>> went into all .html files that had custom directives and changed thenamespace from mv: to mvx: Alt. approach that would simplify upgrade would be to change the default value of the config setting namespace_prefix_extensions from mvx: to specify using old-style mv: prefix, or add .metadata file in your directives directory containing such a spec. The tactical options probably weren''t described well enough (we focused more on documenting the new architecture than on upgrade details, partly because we aren''t sure of the magnitude of the problem, i.e., how many directive impl''s are really out there in the field ) Preferred approach is [of course?!] to get old directive impl''s upgraded to the new framework as soon as possible (it''s WAY cleaner and easier to work with). We''ll be glad to work with you to help you with conversion if that''s useful; just seeing a few of your own classes in the new framework might help seeing what needs to be done. ~ Deb -----Original Message----- From: masterview-users-bounces at rubyforge.org [mailto:masterview-users-bounces at rubyforge.org] On Behalf Of Ed Howland Sent: Friday, November 10, 2006 10:51 AM To: masterview-users at rubyforge.org; masterview-devel at rubyforge.org Subject: Re: [Masterview-users] Failure to parse templates - user defineddirectives w/MV: 0.3.0 I wrote once upon a time:> These exist only in 0.3.0. So it seems that while it seems to be > seeing my existing directives in the new namespace or using the new > directive_base.rb instead of the old deprecated one. > > Have I missed a step? >
Deb Lewis
2006-Nov-10 20:45 UTC
[Masterview-devel] Failure to parse templates - user defined directives w/MV: 0.3.0
Jeff - yes, I''ll pursue. Ed - if it''d help to see a couple conversion examples, send me some.all of your impls and I''ll do an upgrade pass; once you get the hang of the changes it''s fairly straightforward, you get to dump a lot of clutter. ~ Deb -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/masterview-devel/attachments/20061110/170b3c5b/attachment.html
Ed Howland
2006-Nov-10 20:54 UTC
[Masterview-devel] Failure to parse templates - user defined directives w/MV: 0.3.0
On 11/10/06, Deb Lewis <djlewis at acm.org> wrote:> > > Jeff - yes, I''ll pursue. > > Ed - if it''d help to see a couple conversion examples, send me some.all of > your impls and I''ll do an upgrade pass; once you get the hang of the changes > it''s fairly straightforward, you get to dump a lot of clutter. >Deb, As I mentioned in the last email to the list and Jeff, I am converting them one by one to learn how to do it from the instructions on the page. My trouble is I did it so long ago, I''ve forgotten what my need was. However, I do have some more testing results that might be relevant. In prep for conversion, I moved all the old directives to old_directives (not in the path.) Running rake mv:parse now passes. (I guess it ignores the mvx directives.) Adding old_directives into the directives_paths in the config, the same error messages come back. So, since the complaints seem to be about missing stuff in the 0.3.0 classes, I now think that it has nothing to do with not finding the directives. It actually might have to do with something like the require deprecated/directive_base or OldDirectiveBase. Ed> ~ Deb-- Ed Howland http://greenprogrammer.blogspot.com
Deb Lewis
2006-Nov-11 00:43 UTC
[Masterview-users] Failure to parse templates - user defined directives w/MV: 0.3.0
Ed wrote:>> I remember a previous upgrade had reset my settings.rb file, >> so I restored the settings there. Basically it was just adding >> config.directive_paths << ''app/masterview/directives''Ed - some notes on directives and namespaces [separate from the compatibility problem you encountered, which is something we missed and need to correct] That actually should get picked up by default now, so you shouldn''t have to add to the load path unless you want to load directives from somewhere else. The standard startup processing configures the directives load path with masterview''s built-in directives and then checks to see if the rails app has an app/masterview/directives directory - if found, that automatically gets loaded as well. Namespace management tips: Although the namespace prefix for directives can be specified individually, the usual pattern is that a developer wants all directives loaded out of a directory to use a common namespace. This is specified by creating a text file in the directives directory named ''.metadata'' and providing the metadata defaults in yaml-notation. E.g.: # MasterView directive metadata specifications # Rails application directives # default metadata values for directives loaded from this directory default: namespace: mvx description: Rails app MasterView directives Individual directives can override their directory default [should be rare, tho]. The application developer can also override in their app config to handle the case when you''re including directives from someone else and want a diff namespace prefix used in your app templates than what the supplier originally specified. This is done by including hash with app-specific metadata defaults when appending a directive path entry. ~ Deb
Deb Lewis
2006-Nov-12 18:41 UTC
[Masterview-users] Fix for old directive impl compat framework in MV 0.3.0
A fix for the problem reported by Ed Howland on Friday that existing directive implementations using the compatibility framework of DirectiveBaseOld for the new MasterView 0.3.0 release aren''t handled correctly (resulting in template parsing errors) has been committed to the trunk. Fix is a one-line addition in deprecated/directive_base.rb to add mixin "include DirectiveMetadata" to class DirectiveBaseOld so that old directives support the new accessing protocol for metadata info now used by the template engine (attribute_name, namespace, etc) Additional test cases were also added to cover this aspect of the compatibility facilities, since we regrettably missed detecting the problem prior to release. Official bug fix release 0.3.1 with this correction will be posted in a few days. ~ Deb