#16 PloneArticle 2.0b1 - PloneArticleModel KeyError

closed
nobody
None
5
2004-03-22
2003-12-30
No

Okay, so I discovered the process behind this one. I
attached the traceback from the KeyError under default
circumstances to this bug report as well.

My site (http://www.wavelengthsjournal.com) is using
PloneArticles from v1.1, recently imported in our move
to Plone 2.0(RC2) and now uses PloneArticle 2.0b1.
Well, as much as PloneArticle 2.0b1 shows, edits, and
pokes at 1.1's articles perfectly, anything generated
now won't display properly.

You can "fix" the issue by modifying ArticleModel.py -
but it then breaks all your old Articles. So it's a
Catch-22. Below is the root of the problem, maybe there
are things I'm still missing:

-------------------------------------------------

security.declareProtected(CMFCorePermissions.View,
"getModelPath")
def getModelPath(self):
"""
getModelPath(self, model) => returns the
Model's path to serve as a layout for the PloneArticle
"""
model_path='here/%(template)s/macros/%(macro)s'
template=self.getModelId()
portal_url = getToolByName(self, 'portal_url')
if 'portal_form_controller' in
portal_url.getPortalObject().objectIds():
# Macro for Plone 2
macro='PloneArticleModel'
else:
# Macro for Plone 1.x
macro='Plone2ArticleModel'
return model_path %
({'template':template,'macro':macro})

---------------------------------------------------

Discussion

  • Anonymous - 2003-12-30

    PloneArticleModel KeyError Traceback (txt)

     
  • Anonymous - 2003-12-31

    Logged In: YES
    user_id=937094

    Alright, so I fixed this bug in my site last night. Did an XML
    export of one of each batch of articles, found that
    PloneArticle was maintaining the old or the new models for
    both, and that it wouldn't let me change them. So I "fixed"
    ArticleModel.py to cough up the Plone2ArticleModels for both
    conditions.

    That took care of my tricky-as-hell Models page. Then I went
    through all the old articles and changed their Model to
    Documentation (the Plone2ArticleModel variety). I was
    getting the KeyError:PloneArticleModel error on all of them
    now - good. Then poked ArticleModel.py again to put
    Plone2ArticleModel in both conditions to raise the right model
    on view.

    Voila. wavelengths works once again. But with your current
    settings in the scripts, it's only backwards-compatible. To let
    you make and view new articles, it has to be
    Plone2ArticleModel in the top macro.

    Might I suggest that you'd save a lot of time and effort by
    following the KISS philosophy of this? Just work on 2.0b1 for
    Plone 2, and maybe a 1.x as necessary - but this
    compatibility nonsense is making it a living hell for you guys in
    debugging.

     
  • Nicolas Geissel

    Nicolas Geissel - 2004-02-11
    • status: open --> wont-fix
     
  • P.-J. Grizel

    P.-J. Grizel - 2004-03-22

    Logged In: YES
    user_id=717376

    Fixed in CVS : we get a default model in case of error.

     
  • P.-J. Grizel

    P.-J. Grizel - 2004-03-22
    • status: wont-fix --> closed
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks