Bug 112936 - python code generation with UML packages defective
Summary: python code generation with UML packages defective
Status: RESOLVED FIXED
Alias: None
Product: umbrello
Classification: Applications
Component: general (show other bugs)
Version: 1.4.2
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Umbrello Development Group
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-09-20 12:03 UTC by Egbert Voigt
Modified: 2005-09-20 21:16 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 Egbert Voigt 2005-09-20 12:03:02 UTC
Version:           1.4.2 (using KDE KDE 3.4.0)
Installed from:    Compiled From Sources
Compiler:          gcc (GCC) 3.3.5 
OS:                Linux

If I generate Python code for classes assigned to packages, an invalid Python import statement like

"from Package/Class_to_import import *"

is written. This Python syntax error can be simply corrected by replacing "/" by ".".

The corresponding patch for "umbrello-1.4.2/umbrello/umbrello/codegenerators/pythonwriter.cpp" is


102c102,107
<                       h<<"from "<<headerName<<" import *"<<m_endl;
---
>                       if ( headerName.find('/') > 0) {
>                         h<<"from "<<headerName.replace(QChar('/'),QChar('.'))<<" import *"<<m_endl;
>                       }
>                       else {
>                         h<<"from "<<headerName<<" import *"<<m_endl;
>                       }
Comment 1 Oliver Kellogg 2005-09-20 21:16:35 UTC
SVN commit 462333 by okellogg:

BUG:112936 - writeClass(): Apply patch from Egbert Voigt.

 M  +1 -0      ChangeLog  
 M  +1 -0      THANKS  
 M  +4 -1      umbrello/codegenerators/pythonwriter.cpp  


--- branches/KDE/3.5/kdesdk/umbrello/ChangeLog #462332:462333
@@ -12,6 +12,7 @@
  57588  57672  58809  66461  67120  67719  72016  79433  87252  88117
  97162 105564 108223 109591 109636 110073 110216 110231 110379 111088
 111470 111502 111759 111768 112017 112292 112293 112333 112531 112552
+112936
 
 Version 1.4.2 (maintenance release)
 
--- branches/KDE/3.5/kdesdk/umbrello/THANKS #462332:462333
@@ -65,6 +65,7 @@
 Tanuj <tagrawal @hss.hns.com>
 Brian Thomas <brian.thomas @gsfc.nasa.gov>
 Jean Vittor <jean.vittor @wanadoo.fr>
+Egbert Voigt <Egbert.Voigt @alcatel.de>
 Stefan Walter <sw @gegenunendlich.de>
 Yurgen Wolfgang <raptorsforever @softhome.net>
 Maciej J. Woloszyk <mat @esi.com.pl>
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/codegenerators/pythonwriter.cpp #462332:462333
@@ -101,7 +101,10 @@
             first = headerName.at(0);
             first = first.upper();
             headerName = headerName.replace(0, 1, first);
-            h<<"from "<<headerName<<" import *"<<m_endl;
+            if (headerName.find('/') > 0)
+                h<<"from "<<headerName.replace(QChar('/'),QChar('.'))<<" import *"<<m_endl;
+            else
+                h<<"from "<<headerName<<" import *"<<m_endl;
         }
     }
     h<<m_endl;