Changeset 4416:9535be69f9b6 in livinglogic.python.xist

Show
Ignore:
Timestamp:
03/08/11 18:53:48 (9 years ago)
Author:
Walter Doerwald <walter@…>
Branch:
default
Message:

Factor out the code to get the correct name for the schema object.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/ll/orasql/__init__.py

    r4415 r4416  
    27072707            self.stream = cStringIO.StringIO() 
    27082708        else: 
    2709             name = url.path[1] 
    2710             if name.lower().endswith(".sql"): 
    2711                 name = name[:-4] 
    2712             name = unicodedata.normalize('NFC', name) 
    2713             code = Object.name2type[type](name).createddl(self.connection.dbconnection, term=False) 
     2709            code = Object.name2type[type](self._namefromurl()).createddl(self.connection.dbconnection, term=False) 
    27142710            self.stream = cStringIO.StringIO(code.encode("utf-8")) 
     2711 
     2712    def _namefromurl(self): 
     2713        name = self.url.path[1] 
     2714        if name.lower().endswith(".sql"): 
     2715            name = name[:-4] 
     2716        return unicodedata.normalize('NFC', name) 
    27152717 
    27162718    def read(self, size=-1): 
     
    27382740                c = self.connection.dbconnection.cursor() 
    27392741                type = Object.name2type[self.url.path[0]] 
    2740                 name = self.url.path[1] 
    2741                 if name.lower().endswith(".sql"): 
    2742                     name = name[:-4] 
    2743                 name = unicodedata.normalize('NFC', name) 
     2742                name = self._namefromurl() 
    27442743                code = self.stream.getvalue().decode("utf-8") 
    27452744                code = type.fixname(name, code)