Skip to content
This repository has been archived by the owner on Jul 13, 2019. It is now read-only.

Commit

Permalink
Fix #20, notatie 186-locs
Browse files Browse the repository at this point in the history
  • Loading branch information
geertw committed Apr 8, 2016
1 parent 3b6591b commit e4e1e01
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion infoplus_dvs.py
Expand Up @@ -7,6 +7,7 @@
import datetime
import pytz
import logging
import re

# Vraag een logger object:
__logger__ = logging.getLogger(__name__)
Expand Down Expand Up @@ -697,11 +698,23 @@ def treintype(self):
return self.soort

def get_matnummer(self):
"""
Bereken een leesbaar materieelnummer
"""
if self.matnummer == None:
return None

# Schoon matnummer op:
return self.matnummer.lstrip("0-").rstrip("0").rstrip("-")
matnummer = self.matnummer.lstrip("0-").rstrip("0").rstrip("-")

# Fix 1-86xxx notatie:
regex = re.compile("(1)\\-(86)([0-9]{3})")
match = regex.match(matnummer)

if match:
matnummer = "%s%s-%s" % match.group(1, 2, 3)

return matnummer

class Wijziging(object):
"""
Expand Down

0 comments on commit e4e1e01

Please sign in to comment.