[typo] Ticket #1210 - content state model flawed

Benjamin Jackson bhjackson at gmail.com
Thu Mar 20 10:47:38 EDT 2008


Hi all,
Just wanted to email the list as my ticket has not been addressed and I'm
finding more holes in the state model... just looked at the
publication_pending state, and found this:

    def change_published_state(content, published)
      content[:published] = published

      if published && content.published_at <= Time.now
        content.state = JustPublished.instance
      end
    end

    def set_published_at(content, new_time)
      content[:published_at] = new_time
      Trigger.remove(content, :trigger_method => 'publish!')
      if new_time.nil?
        content.state = Draft.instance
      elsif new_time <= Time.now
        content.state = JustPublished.instance
      end
    end

Unless I'm mistaken, these are called when published and pubished_at are set
in the model, right?

In the metaweblog service, the new post and edit post functions set
published and published_at respectively as:

    article.published   = publish
    article.author      = username
    article.published_at = struct['dateCreated'].to_time.getlocal rescue
Time.now


    article.published   = publish
    article.author      = username
    article.published_at  = struct['dateCreated'].to_time.getlocal unless
struct['dateCreated'].blank?

So in other words, as a client of the API I have to know that unless I set
dateCreated to the future when creating a post, and then never set it at all
when editing a post, my post will always be marked for publication even
though I'm explicitly sending published=false.

Please let me know if I'm off here, but I'd love to see this addressed as my
ticket has been stale for 2-3 weeks. Thanks,

Ben
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/typo-list/attachments/20080320/d36eb90b/attachment.html 


More information about the Typo-list mailing list