本文整理汇总了Python中data.storage.Storage.remove方法的典型用法代码示例。如果您正苦于以下问题:Python Storage.remove方法的具体用法?Python Storage.remove怎么用?Python Storage.remove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类data.storage.Storage
的用法示例。
在下文中一共展示了Storage.remove方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Business
# 需要导入模块: from data.storage import Storage [as 别名]
# 或者: from data.storage.Storage import remove [as 别名]
class Business(object):
def __init__(self):
print 'business created'
# Get storage object
self.__store = Storage()
def get(self, value):
print 'In business.get method'
try:
return self.__store.get('business', 'business_id', value)
except:
traceback.print_exc()
return 'failed'
def remove(self, value):
print 'In business.remove method'
try:
return self.__store.remove('business', 'business_id', value)
except:
traceback.print_exc()
return 'failed'
def getAll(self):
print 'In business.getAll method'
try:
return self.__store.getAll('business')
except:
traceback.print_exc()
return 'failed'
示例2: Users
# 需要导入模块: from data.storage import Storage [as 别名]
# 或者: from data.storage.Storage import remove [as 别名]
class Users(object):
def __init__(self):
print 'User created\n'
# create storag
self.__store = Storage()
def addUser(self, data):
print 'In User.add method'
try:
self.__store.add('user', data)
return 'success'
except:
return 'failed'
def getUser(self, value):
print 'In User.get method'
try:
return self.__store.get('user', 'username', value)
except:
return 'failed'
def getAll(self):
print 'In Users.getAll method'
try:
return self.__store.getAll('user')
except:
return 'failed'
def updateUser(self, value, data):
print 'In User.update method'
try:
return self.__store.update('user', 'username', value, data)
except:
return 'failed'
def updateUserOwnCourse(self, email, courseid):
print 'In Course.updateUserOwnCourse method'
try:
return self.__store.addUserOwnCourse(email, courseid)
except:
traceback.print_exc()
return 'failed'
def removeUser(self, value):
print 'In User.remove method'
try:
return self.__store.remove('user', 'email', value)
except:
return 'failed'
示例3: Announcement
# 需要导入模块: from data.storage import Storage [as 别名]
# 或者: from data.storage.Storage import remove [as 别名]
class Announcement(object):
def __init__(self):
print 'Announcement created'
# create storag
self.__store = Storage()
def add(self, data):
print 'In announcement.add method'
try:
return self.__store.add('announcement', data)
except:
traceback.print_exc()
return 'failed'
def get(self, value):
print 'In announcement.get method'
try:
return self.__store.get('announcement', '_id', ObjectId(value))
except:
traceback.print_exc()
return 'failed'
def update(self, value, data):
print 'In announcement.update method'
try:
return self.__store.update('announcement', '_id', ObjectId(value), data)
except:
traceback.print_exc()
return 'failed'
def remove(self, value):
print 'In announcement.remove method'
try:
return self.__store.remove('announcement', '_id', ObjectId(value))
except:
traceback.print_exc()
return 'failed'
def getAll(self):
print 'In announcement.getAll method'
try:
return self.__store.getAll('announcement')
except:
traceback.print_exc()
return 'failed'
示例4: Message
# 需要导入模块: from data.storage import Storage [as 别名]
# 或者: from data.storage.Storage import remove [as 别名]
class Message(object):
def __init__(self):
print 'message created'
# create storage
self.__store = Storage()
def add(self, data):
print 'In message.add method'
try:
return self.__store.add('message', data)
except:
traceback.print_exc()
return 'failed'
def get(self, value):
print 'In message.get method'
try:
return self.__store.get('message', '_id', ObjectId(value))
except:
traceback.print_exc()
return 'failed'
def update(self, value, data):
print 'In message.update method'
try:
return self.__store.update('message', '_id', ObjectId(value), data)
except:
traceback.print_exc()
return 'failed'
def remove(self, value):
print 'In message.remove method'
try:
return self.__store.remove('message', '_id', ObjectId(value))
except:
traceback.print_exc()
return 'failed'
def getAll(self):
print 'In message.getAll method'
try:
return self.__store.getAll('message')
except:
traceback.print_exc()
return 'failed'
示例5: Category
# 需要导入模块: from data.storage import Storage [as 别名]
# 或者: from data.storage.Storage import remove [as 别名]
class Category(object):
def __init__(self):
print 'Category created'
# create storage
self.__store = Storage()
def add(self, data):
print 'In Category.add method'
try:
return self.__store.add('category', data)
except:
return 'failed'
def get(self, value):
print 'In Category.get method'
try:
return self.__store.get('category', '_id', ObjectId(value))
except:
return 'failed'
def update(self, value, data):
print 'In Category.update method'
try:
return self.__store.update('category', '_id', ObjectId(value), data)
except:
return 'failed'
def remove(self, value):
print 'In Category.remove method'
try:
return self.__store.remove('category', '_id', ObjectId(value))
except:
return 'failed'
def getAll(self):
print 'In Category.getAll method'
try:
return self.__store.getAll('category')
except:
return 'failed'
示例6: Course
# 需要导入模块: from data.storage import Storage [as 别名]
# 或者: from data.storage.Storage import remove [as 别名]
class Course(object):
def __init__(self):
print 'Course created\n'
# create storag
self.__store = Storage()
def add(self, email, data):
print 'In Course.add method'
try:
courseid = self.__store.add('course', data)
#Also update 'own' field of user collection
self.__store.addUserOwnCourse(email, str(courseid))
return courseid
except:
traceback.print_exc()
return 'failed'
def get(self, value):
print 'In Course.get method'
try:
return self.__store.get('course', '_id', ObjectId(value))
except:
traceback.print_exc()
return 'failed'
def update(self, value, data):
print 'In Course.update method'
try:
return self.__store.update('course', '_id', ObjectId(value), data)
except:
traceback.print_exc()
return 'failed'
def remove(self, value):
print 'In Course.remove method'
try:
return self.__store.remove('course', '_id', ObjectId(value))
except:
traceback.print_exc()
return 'failed'
def getAll(self):
print 'In Course.getAll method'
try:
return self.__store.getAll('courseContent')
except:
traceback.print_exc()
return 'failed'
def enroll(self, email, courseid):
print 'In Course.enroll method'
try:
return self.__store.enrollCourse(email, courseid)
except:
traceback.print_exc()
return 'failed'
def drop(self, email, courseid):
print 'In Course.drop method'
try:
return self.__store.dropCourse(email, courseid)
except:
traceback.print_exc()
return 'failed'