mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-24 03:33:11 +01:00
Some random commits, NormalizedString, etc.
This commit is contained in:
parent
61793a489c
commit
30abebecbe
@ -103,12 +103,15 @@ def close(registry, filename, annotated=True, helpOnceOnly=False):
|
|||||||
lines.append('###\n')
|
lines.append('###\n')
|
||||||
fd.writelines(lines)
|
fd.writelines(lines)
|
||||||
if hasattr(value, 'value'): # This lets us print help for non-valued.
|
if hasattr(value, 'value'): # This lets us print help for non-valued.
|
||||||
fd.write('%s: %s\n' % (name, value))
|
fd.write('%s: %s\n' % (escape(name), value))
|
||||||
fd.close()
|
fd.close()
|
||||||
|
|
||||||
def isValidRegistryName(name):
|
def isValidRegistryName(name):
|
||||||
return '.' not in name and ':' not in name and len(name.split()) == 1
|
return '.' not in name and ':' not in name and len(name.split()) == 1
|
||||||
|
|
||||||
|
def escape(name):
|
||||||
|
return name
|
||||||
|
|
||||||
def split(name):
|
def split(name):
|
||||||
# XXX: This should eventually handle escapes.
|
# XXX: This should eventually handle escapes.
|
||||||
return name.split('.')
|
return name.split('.')
|
||||||
@ -367,12 +370,15 @@ class OnlySomeStrings(String):
|
|||||||
self.error()
|
self.error()
|
||||||
|
|
||||||
class NormalizedString(String):
|
class NormalizedString(String):
|
||||||
|
def normalize(self, s):
|
||||||
|
return utils.normalizeWhitespace(s.strip())
|
||||||
|
|
||||||
def set(self, s):
|
def set(self, s):
|
||||||
s = utils.normalizeWhitespace(s.strip())
|
s = self.normalize(s)
|
||||||
String.set(self, s)
|
String.set(self, s)
|
||||||
|
|
||||||
def setValue(self, s):
|
def setValue(self, s):
|
||||||
s = utils.normalizeWhitespace(s.strip())
|
s = self.normalize(s)
|
||||||
String.setValue(self, s)
|
String.setValue(self, s)
|
||||||
|
|
||||||
class StringSurroundedBySpaces(String):
|
class StringSurroundedBySpaces(String):
|
||||||
|
Loading…
Reference in New Issue
Block a user