Skip to content

Commit

Permalink
support python3
Browse files Browse the repository at this point in the history
  • Loading branch information
Bloodevil committed Dec 29, 2014
1 parent 0a5f6e7 commit b7d10a0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
9 changes: 7 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import os
import os, sys
try:
from setuptools import setup, find_packages
except ImportError:
Expand All @@ -12,13 +12,17 @@
README = 'https://github.com/Bloodevil/ipython_mongo/blob/master/README.md'
NEWS = 'https://github.com/Bloodevil/ipython_mongo/blob/master/NEWS.txt'

version = '0.3.2'
version = '0.3.3'

install_requires = [
'ipython>=1.0',
'pymongo>=2.7',
]

extra = {}
if sys.version_info >= (3,):
extra['use_2to3'] = True

setup(name='ipython-mongo',
version=version,
packages=find_packages('src'),
Expand All @@ -33,6 +37,7 @@
'Topic :: Database',
'Topic :: Database :: Front-Ends',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 3',
],
keywords=['database', 'ipython', 'mongodb', 'shell', 'imongo'],
author='Yeaji Shin',
Expand Down
8 changes: 4 additions & 4 deletions src/imongo/imongo.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def conn(self, line):
@line_magic('show_dbs')
def show_dbs(self, line):
if self._conn:
print 'Pymongo> MongoClient(url).database_names()' # [TODO]
print('Pymongo> MongoClient(url).database_names()') # [TODO]
return self._conn.database_names()
else:
return "[ERROR] please connect to mongodb using %mongo_connect"
Expand All @@ -53,10 +53,10 @@ def show_collections(self, line):
if not self._conn:
return "[ERROR] connect mongodb before %show_collections"
if self._conn and line:
print "Pymongo> Database(%s, %s).collection_names()"%(str(self._conn), line)
print("Pymongo> Database(%s, %s).collection_names()"%(str(self._conn), line))
collections = Database(self._conn, line).collection_names()
if not collections:
print "[ERROR] check your database name there no collection"
print("[ERROR] check your database name there no collection")
collections = self.show_dbs(self)
return collections

Expand Down Expand Up @@ -121,7 +121,7 @@ def help_message(self, line):
message += COLLECTION_METHODS
else:
message += HELP_MESSAGE
print message
print(message)


def load_ipython_extension(ipython):
Expand Down

0 comments on commit b7d10a0

Please sign in to comment.