Summary: | python code generation with purely virtual methods | ||
---|---|---|---|
Product: | [Applications] umbrello | Reporter: | cmg |
Component: | general | Assignee: | Umbrello Development Group <umbrello-devel> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | anthony |
Priority: | LO | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Mandrake RPMs | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
cmg
2004-02-17 21:07:15 UTC
It compiles as valid Python for me without the 'pass'. Python 2.3.3c1 Sorry, I did a bad reproduction of the test case. 1) Settings > Configure > Code Generation > Formatting Disable Write documentation if empty, write comments for sections even if section is empty: 2) Generate All Code: #!/usr/bin/env python [...] class new_class: cmg@zinc:~/tmp/uml% python New_class.py File "New_class.py", line 36 Python 2.3 If I include the docstring, it is indeed valid as the class will contain 1 statement. SVN commit 434449 by okellogg: m_bNeedPass: New flag controls emission of a final "pass" statement. BUG:75454 M +9 -3 pythonwriter.cpp M +2 -0 pythonwriter.h --- trunk/KDE/kdesdk/umbrello/umbrello/codegenerators/pythonwriter.cpp #434448:434449 @@ -34,8 +34,8 @@ #include "../operation.h" #include "../umlnamespace.h" -PythonWriter::PythonWriter( UMLDoc *parent, const char *name ) : -SimpleCodeGenerator( parent, name) { +PythonWriter::PythonWriter( UMLDoc *parent, const char *name ) + : SimpleCodeGenerator(parent, name), m_bNeedPass(true) { } PythonWriter::~PythonWriter() {} @@ -53,6 +53,8 @@ UMLAssociationList aggregations = c->getAggregations(); UMLAssociationList compositions = c->getCompositions(); + m_bNeedPass = true; + //find an appropriate name for our file fileName = findFileName(c,".py"); if (!fileName) { @@ -122,11 +124,15 @@ h<<m_indentation<<":version:"<<m_endl; h<<m_indentation<<":author:"<<m_endl; h<<m_indentation<<"\"\"\""<<m_endl<<m_endl; + m_bNeedPass = false; } //operations writeOperations(c,h); + if (m_bNeedPass) + h << m_indentation << "pass" << m_endl; + //finish files h<<m_endl<<m_endl; @@ -241,7 +247,7 @@ h<<m_indentation<<m_indentation<<"\"\"\""<<m_endl; } h<<m_indentation<<m_indentation<<"pass"<<m_endl<<m_endl; - + m_bNeedPass = false; }//end for } --- trunk/KDE/kdesdk/umbrello/umbrello/codegenerators/pythonwriter.h #434448:434449 @@ -78,6 +78,8 @@ */ void writeOperations(QString classname, UMLOperationList &opList, QTextStream &h, Access access); + + bool m_bNeedPass; ///< True as long as no "pass" has been written }; #endif //PYTHONWRITER |