I know puts is there for defining helpers, but it doesn't work inside
of method of Haml::Buffer, not just doesn't print to $stdout but blows
up.  For instance, if you wanted to puts a debug puts inside of
Buffer::open_tag, this causes an error.  It's because puts calls
buffer.buffer << "string stuff", and buffer is defined differently in
Haml::Buffer and Haml::Helpers.  That's what I mean that there is
confusion because the helpers are included both into where code from
the template can use them, and directly into the _hamlout object,
where puts (probably others), doesn't work.  These methods intended to
be called as helpers in the template should not be being included into
the _hamlout Buffer object where they don't work.

-Tom

On Jun 7, 12:18 pm, "Nathan Weizenbaum" <[EMAIL PROTECTED]> wrote:
> @Tom: "puts" is meant to be available to the user for use in defining
> helpers. I use it all the time.
>
> @Russel: The reason I ask is so that I can figure out whether the error is
> caused by some peculiar setup of yours or if it's something else. It's
> helpful if you can find the simplest case in which this breaks; in all my
> attempts, I've been unable to reproduce the error.
>
> - Nathan
>
> On 6/7/07, Russell Norris <[EMAIL PROTECTED]> wrote:
>
>
>
> > Test suite fails with one error:
>
> > test_templates_should_render_correctly(TemplateTest)
> >     [./test/haml/template_test.rb:49:in `assert_renders_correctly'
> >      ./lib/haml/engine.rb:432:in `each_with_index'
> >      ./test/haml/template_test.rb:47:in `each'
> >      ./test/haml/template_test.rb:47:in `each_with_index'
> >      ./test/haml/template_test.rb:47:in `assert_renders_correctly'
> >      ./test/haml/template_test.rb:52:in `call'
> >      ./test/haml/template_test.rb:52:in `assert_renders_correctly'
> >      ./test/haml/template_test.rb:66:in
> > `test_templates_should_render_correctly'
> >      ./test/haml/template_test.rb:65:in `each'
> >      ./test/haml/template_test.rb:65:in
> > `test_templates_should_render_correctly']:
> > template: filters
> > line:     48.
> > <"<ul>"> expected but was
> > <"<p>*  Foo">.
>
> > That's mighty strange looking to me. As for failing with a non-partialized
> > template, I'm not even sure what's going on here. Looks like you're
> > expecting a hash but getting an empty string. I'll do some digging around
> > but I suspect you know more about this than I would. :/
>
> > RSL
>
> > On 6/7/07, Nathan Weizenbaum <[EMAIL PROTECTED]> wrote:
>
> > > Yikes! I can't reproduce this... does the test suite pass for you? Does
> > > the same thing happen when you just do a non-partialized template with
> > > something very simple? When you use bin/haml?
>
> > > - Nathan
>
> > > Russell Norris wrote:
> > > > This is happening all over my code. I tried a few puts but inspecting
> > > > the attributes or attributes_hash [which I suspect is the problem]
> > > > raises an error about undefined method 'buffer' for "":String. :/
> > > > Here's the backtrace without the puts...
>
> > > > ActionView::TemplateError: undefined method `merge!' for "":String
> > > >     On line #2 of app/views/categories/_form.haml
>
> > > >     1: %p
> > > >     2:   %label{:for => :category_title} Title
> > > >     3:   = f.text_field :title, :size => 50, :class => :text
> > > >     4: %p
> > > >     5:   %label{:for => :category_misc} Description
> > > <em>(optional)</em>
>
> > > >     app/views/categories/_form.haml:2
> > > >     vendor/plugins/haml/lib/haml/buffer.rb:121:in `merge_attrs'
> > > >     vendor/plugins/haml/lib/haml/buffer.rb:92:in `open_tag'
> > > >     (eval):12:in `_render_haml_2'
> > > >     vendor/plugins/haml/lib/haml/engine.rb:434:in `send'
> > > >     vendor/plugins/haml/lib/haml/engine.rb:434:in `compile'
> > > >     vendor/plugins/haml/lib/haml/engine.rb:186:in `to_html'
> > > >     vendor/plugins/haml/lib/haml/template.rb:69:in `render'
> > > >     vendor/rails/actionpack/lib/action_view/base.rb:502:in
> > > > `delegate_render'
> > > >     vendor/rails/actionpack/lib/action_view/base.rb:324:in
> > > > `render_template_old'
> > > >     vendor/plugins/haml/lib/haml/template.rb:96:in `render_template'
> > > >     vendor/rails/actionpack/lib/action_view/base.rb:286:in
> > > `render_file'
> > > >     vendor/rails/actionpack/lib/action_view/base.rb:301:in
> > > > `render_without_haml'
> > > >     vendor/plugins/haml/lib/haml/helpers/action_view_mods.rb:17:in
> > > > `render'
> > > >     vendor/rails/actionpack/lib/action_view/partials.rb:62:in
> > > > `render_partial'
>
> > > > vendor/rails/actionpack/lib/action_controller/benchmarking.rb:26:in
> > > > `benchmark'
> > > >     /usr/lib/ruby/1.8/benchmark.rb:293:in `measure'
> > > >     /usr/lib/ruby/1.8/benchmark.rb:307:in `realtime'
>
> > > > vendor/rails/actionpack/lib/action_controller/benchmarking.rb:26:in
> > > > `benchmark'
> > > >     vendor/rails/actionpack/lib/action_view/partials.rb:61:in
> > > > `render_partial'
> > > >     vendor/rails/actionpack/lib/action_view/base.rb:312:in
> > > > `render_without_haml'
> > > >     vendor/plugins/haml/lib/haml/helpers/action_view_mods.rb:17:in
> > > > `render'
> > > >     (eval):12:in `_render_haml_1'
> > > >     vendor/plugins/haml/lib/haml/helpers/action_view_mods.rb:82:in
> > > `call'
> > > >     vendor/plugins/haml/lib/haml/helpers/action_view_mods.rb:82:in
> > > > `form_for'
> > > >     vendor/plugins/haml/lib/haml/helpers.rb:284:in `call'
> > > >     vendor/plugins/haml/lib/haml/helpers.rb:284:in `bind_proc'
>
> > > > vendor/rails/actionpack/lib/action_view/helpers/form_helper.rb:220:in
> > > > `fields_for'
>
> > > > vendor/rails/actionpack/lib/action_view/helpers/form_helper.rb:180:in
> > > > `form_for_without_haml'
> > > >     vendor/plugins/haml/lib/haml/helpers/action_view_mods.rb:86:in
> > > > `form_for'
> > > >     (eval):10:in `_render_haml_1'
> > > >     vendor/plugins/haml/lib/haml/engine.rb:434:in `send'
> > > >     vendor/plugins/haml/lib/haml/engine.rb:434:in `compile'
> > > >     vendor/plugins/haml/lib/haml/engine.rb:186:in `to_html'
> > > >     vendor/plugins/haml/lib/haml/template.rb:69:in `render'
> > > >     vendor/rails/actionpack/lib/action_view/base.rb:502:in
> > > > `delegate_render'
> > > >     vendor/rails/actionpack/lib/action_view/base.rb:324:in
> > > > `render_template_old'
> > > >     vendor/plugins/haml/lib/haml/template.rb:96:in `render_template'
> > > >     vendor/rails/actionpack/lib/action_view/base.rb:286:in
> > > `render_file'
> > > >     vendor/rails/actionpack/lib/action_controller/base.rb:875:in
> > > > `render_file'
> > > >     vendor/rails/actionpack/lib/action_controller/base.rb:810:in
> > > > `render_with_no_layout'
> > > >     vendor/rails/actionpack/lib/action_controller/layout.rb:246:in
> > > > `render_without_benchmark'
>
> > > > vendor/rails/actionpack/lib/action_controller/benchmarking.rb:51:in
> > > > `render_without_query_stats'
> > > >     /usr/lib/ruby/1.8/benchmark.rb:293:in `measure'
>
> > > > vendor/rails/actionpack/lib/action_controller/benchmarking.rb:51:in
> > > > `render_without_query_stats'
> > > >     vendor/plugins/query_stats/lib/query_stats/labeler.rb:19:in
> > > `render'
> > > >     app/controllers/oyster_controller.rb:113:in `render_common_form'
> > > >     app/controllers/categories_controller.rb:12:in `new'
> > > >     vendor/rails/actionpack/lib/action_controller/base.rb:1132:in
> > > `send'
> > > >     vendor/rails/actionpack/lib/action_controller/base.rb:1132:in
> > > > `perform_action_without_filters'
> > > >     vendor/rails/actionpack/lib/action_controller/filters.rb:713:in
> > > > `call_filters'
> > > >     vendor/rails/actionpack/lib/action_controller/filters.rb:752:in
> > > > `perform_action_without_benchmark'
>
> > > > vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in
> > > > `perform_action_without_rescue'
> > > >     /usr/lib/ruby/1.8/benchmark.rb:293:in `measure'
>
> > > > vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in
> > > > `perform_action_without_rescue'
> > > >     vendor/rails/actionpack/lib/action_controller/rescue.rb:133:in
> > > > `perform_action_without_caching'
> > > >     vendor/rails/actionpack/lib/action_controller/caching.rb:661:in
> > > > `perform_action'
> > > >     vendor/rails/activerecord/lib/active_record/query_cache.rb:99:in
> > > > `cache'
> > > >     vendor/rails/actionpack/lib/action_controller/caching.rb:660:in
> > > > `perform_action'
> > > >     vendor/rails/actionpack/lib/action_controller/base.rb:494:in
> > > `send'
> > > >     vendor/rails/actionpack/lib/action_controller/base.rb:494:in
> > > > `process_without_filters'
> > > >     vendor/rails/actionpack/lib/action_controller/filters.rb:747:in
> > > > `process_without_session_management_support'
>
> > > vendor/rails/actionpack/lib/action_controller/session_management.rb:122:in
> > > > `sass_old_process'
> > > >     vendor/plugins/haml/lib/sass/plugin.rb:124:in
> > > `process_without_test'
>
> > > > vendor/rails/actionpack/lib/action_controller/test_process.rb:15:in
> > > > `process'
>
> > > > vendor/rails/actionpack/lib/action_controller/test_process.rb:394:in
> > > > `process'
>
> > > > vendor/rails/actionpack/lib/action_controller/test_process.rb:365:in
> > > `get'
> > > >     test/functional/categories_controller_test.rb:43:in `test_new'
> > > >     test/test_helper.rb:43:in `active_users'
> > > >     test/test_helper.rb:42:in `each'
> > > >     test/test_helper.rb:42:in `active_users'
> > > >     test/functional/categories_controller_test.rb:41:in `test_new'
> > > >     /usr/lib/ruby/1.8/test/unit/testcase.rb:78:in `__send__'
> > > >     /usr/lib/ruby/1.8/test/unit/testcase.rb:78:in `run'
> > > >     /usr/lib/ruby/1.8/test/unit/testsuite.rb:34:in `run'
> > > >     /usr/lib/ruby/1.8/test/unit/testsuite.rb:33:in `each'
> > > >     /usr/lib/ruby/1.8/test/unit/testsuite.rb:33:in `run'
> > > >     /usr/lib/ruby/1.8/test/unit/testsuite.rb:34:in `run'
> > > >     /usr/lib/ruby/1.8/test/unit/testsuite.rb:33:in `each'
> > > >     /usr/lib/ruby/1.8/test/unit/testsuite.rb:33:in `run'
> > > >     /usr/lib/ruby/1.8/test/unit/ui/testrunnermediator.rb:46:in
> > > `run_suite'
> > > >     /usr/lib/ruby/1.8/test/unit/ui/console/testrunner.rb:67:in
> > > > `start_mediator'
> > > >     /usr/lib/ruby/1.8/test/unit/ui/console/testrunner.rb:41:in `start'
> > > >     /usr/lib/ruby/1.8/test/unit/ui/testrunnerutilities.rb:29:in `run'
> > > >     /usr/lib/ruby/1.8/test/unit/autorunner.rb:200:in `run'
> > > >     /usr/lib/ruby/1.8/test/unit/autorunner.rb:13:in `run'
> > > >     /usr/lib/ruby/1.8/test/unit.rb:278
> > > >     test/functional/categories_controller_test.rb:94
>
> > > > RSL


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Haml" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/haml?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to