Passed
Push — master ( 525f7c...1e26bf )
by Dave
01:15
created

backend.fcmutils.safestring()   A

Complexity

Conditions 3

Size

Total Lines 6
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 5
nop 1
dl 0
loc 6
rs 10
c 0
b 0
f 0
1
#import time
2
3
def safestring(thestring):
4
    '''safely convert anything into string'''
5
    if thestring is None:
6
        return None
7
    if isinstance(thestring, str): return thestring
8
    return str(thestring, "utf-8")
9
10
def formattime(the_time):
11
    '''standard format for time'''
12
    return the_time.strftime('%Y-%m-%d %H:%M:%S')
13