Skip to content

Commit

Permalink
some of lint warning fixing and code refactor for readability
Browse files Browse the repository at this point in the history
  • Loading branch information
sanlinnaing committed Oct 8, 2024
1 parent fa744c4 commit 5843876
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
4 changes: 2 additions & 2 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,13 @@
if options.sentrydsn:
sentry_sdk.init(dsn=options.sentrydsn, integrations=[TornadoIntegration()])
else:
logging.warn("Sentry dsn is not set")
logging.warning("Sentry dsn is not set")

mongodb = None
while not mongodb:
try:
mongodb = pymongo.MongoClient(options.mongouri)
except:
except Exception:
logging.error("Cannot not connect to MongoDB")

masterdb = mongodb[options.masterdb]
Expand Down
6 changes: 4 additions & 2 deletions controllers/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import hashlib, os
from controllers.base import *
from controllers.base import WebBaseHandler
from tornado.options import options
from routes import route
from util import get_password


@route(r"/auth/([^/]+)")
Expand Down
4 changes: 2 additions & 2 deletions controllers/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
from pushservices.apns import ApnsClient
import requests
import traceback
from controllers.base import *
from controllers.base import WebBaseHandler


@route(r"/applications/([^/]+)/settings[\/]?")
Expand Down Expand Up @@ -126,7 +126,7 @@ def post(self, appname):
app["wnstokenexpiry"] = int(responsedata["expires_in"]) + int(
time.time()
)
## Update connections too
# Update connections too
self.wnsconnections[app["shortname"]] = []
wns = WNSClient(self.masterdb, app, 0)
self.wnsconnections[app["shortname"]].append(wns)
Expand Down
5 changes: 2 additions & 3 deletions pushservices/bootstrap.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import logging
from .apns import *
from .apns import ApnsClient
from .clickatell import *
from .fcm import FCMClient
from .mpns import MPNSClient
Expand Down Expand Up @@ -63,9 +63,8 @@ def init_messaging_agents(masterdb):
if "wnsclientid" in app and "wnsclientsecret" in app and "shortname" in app:
try:
wns = WNSClient(masterdb, app, 0)
services["wns"][appname].append(wns)
except Exception as ex:
logging.error(ex)
continue
services["wns"][appname].append(wns)

return services

0 comments on commit 5843876

Please sign in to comment.