Package couchdbkit :: Module utils
[hide private]
[frames] | no frames]

Module utils

source code

Mostly utility functions couchdbkit uses internally that don't really belong anywhere else in the modules.

Functions [hide private]
 
splitunc(p) source code
 
split_path(path) source code
 
validate_dbname(name)
validate dbname
source code
 
to_bytestring(s)
convert to bytestring an unicode
source code
 
read_file(fname, utf8=True, force_read=False)
read file content
source code
 
sign_file(file_path)
return md5 hash from file content
source code
 
write_content(fname, content)
write content in a file
source code
 
write_json(filename, content)
serialize content in json and save it
source code
 
read_json(filename, use_environment=False)
read a json file and deserialize
source code
Variables [hide private]
  VALID_DB_NAME = re.compile(r'^[a-z][a-z0-9_\$\(\)\+-/]*$')
  SPECIAL_DBS = ('_users', '_replicator')
  __package__ = 'couchdbkit'
Function Details [hide private]

sign_file(file_path)

source code 

return md5 hash from file content

:attr file_path: string, path of file

:return: string, md5 hexdigest

write_content(fname, content)

source code 

write content in a file

:attr fname: string,filename :attr content: string

write_json(filename, content)

source code 

serialize content in json and save it

:attr filename: string :attr content: string

read_json(filename, use_environment=False)

source code 

read a json file and deserialize

:attr filename: string :attr use_environment: boolean, default is False. If True, replace environment variable by their value in file content

:return: dict or list