Changeset 843 for trunk/pgdb.py


Ignore:
Timestamp:
Feb 8, 2016, 4:23:14 PM (3 years ago)
Author:
cito
Message:

Silently accept unescaped quotes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/pgdb.py

    r842 r843  
    800800        so that we have a consistent behavior regarding percent signs.
    801801        """
    802         if parameters:
    803             if isinstance(parameters, dict):
    804                 parameters = _quotedict(parameters)
    805                 parameters.quote = self._quote
    806             else:
    807                 parameters = tuple(map(self._quote, parameters))
    808         else:
    809             parameters = {}
     802        if not parameters:
     803            try:
     804                return string % ()  # unescape literal quotes if possible
     805            except (TypeError, ValueError):
     806                return string  # silently accept unescaped quotes
     807        if isinstance(parameters, dict):
     808            parameters = _quotedict(parameters)
     809            parameters.quote = self._quote
     810        else:
     811            parameters = tuple(map(self._quote, parameters))
    810812        return string % parameters
    811813
Note: See TracChangeset for help on using the changeset viewer.