Daniel,
Here is the patch, for sure this time.
Dave
On Thu, Aug 02, 2018 at 08:48:38AM +0000, Ramirez, Daniel - FAS GmbH wrote:
> Hi Mr. Kuhlman,
>
> First of all, cool piece of software here. We are planning to use it in a
> project about automotive industry and it could save us a lot of time and
> effort, so kudos!
>
> While generating some bindings for a huge XSD file I got validation errors
> on the generated code because of classes names. It looked as if the
> cleanup list parameter was not being used. I debugged it using the
> packaged source code and I narrowed it to
> generateSimpleTypes.writeEnumClass . Here, the output is generated by
> calling the simpleType.getName() and it looks like here is the problem.
>
> As it outputs directly the imported name, no cleanup takes place. I edited
> our SimpleTypeElement.getName() method so it returns a
> cleanupName(self.name) but I am not sure that this will not break other
> internal references; that is why I decided to notify the bug instead of
> doing a PR.
>
> This seemed to fix the problem in our case so, if it is a generic enough
> solution, I can submit the PR. Let me know what suits you best.
>
> Thanks again and best regards,
>
> Daniel Ramirez
>
> Software Development
>
> FAS GmbH
>
> Frühlingstraße 31-33 - 85055 Ingolstadt
>
> Mobil: +49-(0) 152-21700-621
>
> Email: daniel.rami...@fahrerassistenzsysteme.de
--
Dave Kuhlman
http://www.davekuhlman.org
diff -r ff3e12aeec06 generateDS.py
--- a/generateDS.py Mon Jul 30 13:40:41 2018 -0700
+++ b/generateDS.py Thu Aug 02 11:46:23 2018 -0700
@@ -6712,16 +6712,17 @@
def writeEnumClass(simpleType):
enumValues = simpleType.getEnumValues()
+ simpleTypeName = cleanupName(simpleType.getName())
if enumValues:
output = ""
try:
- validateIdentifier(simpleType.getName())
+ validateIdentifier(simpleTypeName)
except ValueError:
err_msg(
'*** The Simple Type name "%s" is not a valid '
- 'Python identifier\n' % simpleType.getName())
+ 'Python identifier\n' % simpleTypeName)
return
- output += 'class %s(object):\n' % simpleType.getName()
+ output += 'class %s(object):\n' % simpleTypeName
for enumValue in enumValues:
try:
validatedEnumValue = validateIdentifier(enumValue)
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
generateds-users mailing list
generateds-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/generateds-users