• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

berkmancenter / mediacloud / 3353
53%
master: 70%

Build:
Build:
LAST BUILD BRANCH: release
DEFAULT BRANCH: master
Ran 04 Mar 2017 02:52AM UTC
Jobs 1
Files 178
Run time 11s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

pending completion
3353

push

travis-ci

pypt
In quote(), replace "%" with a shared marker to be further replaced into "%%" when executing

quote() takes on a job of not only escaping database-unsafe strings but
also taking care of strings that could be taken as psycopg2's parameter
placeholders.

However, if quote() were to duplicate "%":

    db.quote("SELECT 'abc%'") == "SELECT 'abc%'"

...result.__execute() would then double the percentage sign again:

    db.query(db.quote("SELECT 'abc%'")) -> "SELECT 'abc%%%%'"

...leading into unexpected results.

Even worse, this could have led to percentage signs followed by 's' to be
taken as psycopg2's parameter placeholders (because result.__execute()
avoids doubling percentage signs on what looks like a psycopg2's parameter
placeholder):

    db.quote("SELECT 'abc %s def'") == "SELECT 'abc %%s def'"
    db.query(db.quote("SELECT 'abc %s def'")) -> "SELECT 'abc %%%s'"

So, quote() would insert a space between '%' and successive 's' in order
to prevent this character sequence to be taken for a psycopg2 parameter
placeholder, which is an error on its own:

    db.quote("SELECT 'abc %s def'") == "SELECT 'abc % s def'"

In this commit, we generate a random marker that is shared between quote()
and result.__execute(). quote() replaces all cases of '%' with this
random marker, and __execute() replaces all cases of the marker into
double percentage sign right before running the query.

    random_marker = <DOUBLE PERCENTAGE SIGN: 0123456789abcdef>
    db.quote("SELECT 'abc %s def'") == "SELECT 'abc <DOUBLE PERCENTAGE SIGN: 0123456789abcdef>s def'"
    db.query(db.quote("SELECT 'abc %s def'")) -> "SELECT 'abc %%s'"

7742 of 14671 relevant lines covered (52.77%)

961.71 hits per line

Jobs
ID Job ID Ran Files Coverage
1 3353.1 04 Mar 2017 02:52AM UTC 0
52.77
Travis Job 3353.1
Source Files on build 3353
Detailed source file information is not available for this build.
  • Back to Repo
  • Travis Build #3353
  • bef635c6 on github
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc