Bug 145916 - Class attribute documentation not generated for python
Summary: Class attribute documentation not generated for python
Status: RESOLVED FIXED
Alias: None
Product: umbrello
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Ubuntu Linux
: NOR normal (vote)
Target Milestone: ---
Assignee: Umbrello Development Group
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-05-24 22:07 UTC by Ben Hearsum
Modified: 2007-05-25 23:54 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ben Hearsum 2007-05-24 22:07:29 UTC
Version:           svn (using KDE KDE 3.5.6)
Installed from:    Ubuntu Packages
OS:                Linux

No documentation is generated (either in code generation or exporting to HTML) for class attributes in Python. I'm unsure if this is a bug or a missing feature. To me, it's pretty critical that this documentations is generated _somewhere_.

STR:
1) Create a Python project.
2) Add a class with attributes
3) Add documentation to those attributes
4) Generate code or export to HTML

Expected Behaviour:
Documentation should be generated for class attributes

Actual Behaviour:
Attribute documentation is not included anywhere in the generated files.
Comment 1 Ben Hearsum 2007-05-24 22:11:47 UTC
I should also mention that this bug is similar to bug#109909
Comment 2 Oliver Kellogg 2007-05-25 23:54:37 UTC
SVN commit 668297 by okellogg:

writeAttributes(): New. Write attribute documentation, name, and visibility
 in a Python comment section.
BUG:145916


 M  +1 -0      ChangeLog  
 M  +18 -1     umbrello/codegenerators/pythonwriter.cpp  
 M  +9 -0      umbrello/codegenerators/pythonwriter.h  


--- branches/KDE/3.5/kdesdk/umbrello/ChangeLog #668296:668297
@@ -3,6 +3,7 @@
 * Bugs/wishes from http://bugs.kde.org:
 * Unstable saves and loads, class names become dirty (145709)
 * Crash on deleting class in list view (145762)
+* Class attribute documentation not generated for python (145916)
 * Python code generator does not wrap lines properly (145918)
 
 Version 1.5.7
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/codegenerators/pythonwriter.cpp #668296:668297
@@ -30,6 +30,7 @@
 #include "../association.h"
 #include "../attribute.h"
 #include "../classifier.h"
+#include "../attribute.h"
 #include "../operation.h"
 #include "../umlnamespace.h"
 
@@ -143,6 +144,9 @@
         m_bNeedPass = false;
     }
 
+    // attributes
+    writeAttributes(c->getAttributeList(), h);
+
     //operations
     writeOperations(c,h);
 
@@ -161,8 +165,21 @@
 ////////////////////////////////////////////////////////////////////////////////////
 //  Helper Methods
 
-void PythonWriter::writeOperations(UMLClassifier *c,QTextStream &h) {
+void PythonWriter::writeAttributes(UMLAttributeList atList, QTextStream &py) {
+    if (!forceDoc() || atList.count() == 0)
+        return;
+    py << m_indentation << "\"\"\" ATTRIBUTES" << m_endl << m_endl;
+    for (UMLAttribute *at = atList.first(); at; at = atList.next()) {
+        py << formatDoc(at->getDoc(), m_indentation + ' ') << m_endl;
+        Uml::Visibility vis = at->getVisibility();
+        py << m_indentation << cleanName(at->getName()) << "  ("
+            << vis.toString() << ")" << m_endl << m_endl ;
+    } // end for
+    py << m_indentation << "\"\"\"" << m_endl << m_endl;
+}
 
+void PythonWriter::writeOperations(UMLClassifier *c, QTextStream &h) {
+
     //Lists to store operations  sorted by scope
     UMLOperationList oppub,opprot,oppriv;
 
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/codegenerators/pythonwriter.h #668296:668297
@@ -20,6 +20,7 @@
 #define PYTHONWRITER_H
 
 #include "simplecodegenerator.h"
+#include "../umlattributelist.h"
 #include "../umloperationlist.h"
 
 enum Access {PRIVATE, PUBLIC, PROTECTED};
@@ -54,6 +55,14 @@
 private:
 
     /**
+     * write all attributes for a given class
+     *
+     * @param c   the concept we are generating code for
+     * @param py  output stream for the header file
+     */
+    void writeAttributes(UMLAttributeList atList, QTextStream &py);
+
+    /**
       * write all operations for a given class
       *
       * @param c the concept we are generating code for