bugged
stringlengths
4
228k
fixed
stringlengths
0
96.3M
__index_level_0__
int64
0
481k
def handle(self): """Attempt to log a user in.
def handle(self): """Attempt to log a user in.
33,400
def __init__(self, config, section, setting, default=NODEFAULT, description=None, aliases=None
def __init__(self, config, section, setting, default=NODEFAULT, description=None, aliases=None
33,401
def set(self, value): """Update the value""" self._value = value
def set(self, value): """Update the value""" self._value = value
33,402
def reset(self): """Reset the value to default""" self._value = self.default
def reset(self): """Reset the value to default""" self._value = self.default
33,403
def isdefault(self): """Return True if current value is the default one""" return self._value == self.default
def isdefault(self): """Return True if current value is the default one""" return self._value == self.default
33,404
def str(self, default=0): """Return string representation of the value
def str(self, default=0): """Return string representation of the value
33,405
def __str__(self): return self.str()
def __str__(self): return self.str()
33,406
def __repr__(self): if self.isdefault(): _format = "<%(class)s %(name)s (default): %(value)s>" else: _format = "<%(class)s %(name)s (default: %(default)s): %(value)s>" return _format % { "class": self.__class__.__name__, "name": self.name, "default": self.str(default=1), "value": str(self), }
def __repr__(self): if self.isdefault(): _format = "<%(class)s %(name)s (default): %(value)s>" else: _format = "<%(class)s %(name)s (default: %(default)s): %(value)s>" return _format % { "class": self.__class__.__name__, "name": self.name, "default": self.value2str(self._default_value), "value": self.value2str(self._va...
33,407
def format(self): """Return .ini file fragment for this option""" _desc_lines = [] for _description in (self.description, self.class_description): if _description: _desc_lines.extend(_description.split("\n")) # comment out the setting line if there is no value if self.isset(): _is_set = "" else: _is_set = "#" _rv = "# ...
def format(self): """Return .ini file fragment for this option""" _desc_lines = [] for _description in (self.description, self.class_description): if _description: _desc_lines.extend(_description.split("\n")) # comment out the setting line if there is no value if self.isset(): _is_set = "" else: _is_set = "#" _rv = "# ...
33,408
def format(self): """Return .ini file fragment for this option""" _desc_lines = [] for _description in (self.description, self.class_description): if _description: _desc_lines.extend(_description.split("\n")) # comment out the setting line if there is no value if self.isset(): _is_set = "" else: _is_set = "#" _rv = "# ...
def format(self): """Return .ini file fragment for this option""" _desc_lines = [] for _description in (self.description, self.class_description): if _description: _desc_lines.extend(_description.split("\n")) # comment out the setting line if there is no value if self.isset(): _is_set = "" else: _is_set = "#" _rv = "# ...
33,409
def str(self, default=0): if default: _val = self.default else: _val = self._value if _val: return "yes" else: return "no"
def _value2str(self, value): if value: return "yes" else: return "no"
33,410
def set(self, value): if type(value) == type(""): _val = value.lower() if _val in ("yes", "true", "on", "1"): _val = 1 elif _val in ("no", "false", "off", "0"): _val = 0 else: raise OptionValueError(self, value, self.class_description) else: _val = value and 1 or 0 Option.set(self, _val)
def str2value(self, value): if type(value) == type(""): _val = value.lower() if _val in ("yes", "true", "on", "1"): _val = 1 elif _val in ("no", "false", "off", "0"): _val = 0 else: raise OptionValueError(self, value, self.class_description) else: _val = value and 1 or 0 Option.set(self, _val)
33,411
def set(self, value): if type(value) == type(""): _val = value.lower() if _val in ("yes", "true", "on", "1"): _val = 1 elif _val in ("no", "false", "off", "0"): _val = 0 else: raise OptionValueError(self, value, self.class_description) else: _val = value and 1 or 0 Option.set(self, _val)
def set(self, value): if type(value) == type(""): _val = value.lower() if _val in ("yes", "true", "on", "1"): _val = 1 elif _val in ("no", "false", "off", "0"): _val = 0 else: raise OptionValueError(self, value, self.class_description) else: _val = value and 1 or 0 Option.set(self, _val)
33,412
def set(self, value): _val = value.lower() if _val in ("yes", "no", "new"): Option.set(self, _val) else: raise OptionValueError(self, value, self.class_description)
def str2value(self, value): _val = value.lower() if _val in ("yes", "no", "new"): Option.set(self, _val) else: raise OptionValueError(self, value, self.class_description)
33,413
def set(self, value): _val = value.lower() if _val in ("yes", "no", "new"): Option.set(self, _val) else: raise OptionValueError(self, value, self.class_description)
def set(self, value): _val = value.lower() if _val in ("yes", "no", "new"): return _val else: raise OptionValueError(self, value, self.class_description)
33,414
def set(self, value): try: _val = float(value) except ValueError: raise OptionValueError(self, value, "Floating point number required") else: Option.set(self, _val)
def str2value(self, value): try: _val = float(value) except ValueError: raise OptionValueError(self, value, "Floating point number required") else: Option.set(self, _val)
33,415
def set(self, value): try: _val = float(value) except ValueError: raise OptionValueError(self, value, "Floating point number required") else: Option.set(self, _val)
def set(self, value): try: return float(value) except ValueError: raise OptionValueError(self, value, "Floating point number required") else: Option.set(self, _val)
33,416
def set(self, value): try: _val = float(value) except ValueError: raise OptionValueError(self, value, "Floating point number required") else: Option.set(self, _val)
def set(self, value): try: _val = float(value) except ValueError: raise OptionValueError(self, value, "Floating point number required") else: Option.set(self, _val)
33,417
def set(self, value): try: _val = int(value) except ValueError: raise OptionValueError(self, value, "Integer number required") else: Option.set(self, _val)
def str2value(self, value): try: _val = int(value) except ValueError: raise OptionValueError(self, value, "Integer number required") else: Option.set(self, _val)
33,418
def set(self, value): try: _val = int(value) except ValueError: raise OptionValueError(self, value, "Integer number required") else: Option.set(self, _val)
def set(self, value): try: return int(value) except ValueError: raise OptionValueError(self, value, "Integer number required") else: Option.set(self, _val)
33,419
def set(self, value): try: _val = int(value) except ValueError: raise OptionValueError(self, value, "Integer number required") else: Option.set(self, _val)
def set(self, value): try: _val = int(value) except ValueError: raise OptionValueError(self, value, "Integer number required") else: Option.set(self, _val)
33,420
def set(self, value): try: _val = int(value) except ValueError: raise OptionValueError(self, value, "Integer number required") else: Option.set(self, _val)
def set(self, value): try: _val = int(value) except ValueError: raise OptionValueError(self, value, "Integer number required") else: Option.set(self, _val)
33,421
def set(self, value): try: _val = int(value) except ValueError: raise OptionValueError(self, value, "Integer number required") else: Option.set(self, _val)
def set(self, value): try: _val = int(value) except ValueError: raise OptionValueError(self, value, "Integer number required") else: Option.set(self, _val)
33,422
def set(self, value): try: _val = int(value) except ValueError: raise OptionValueError(self, value, "Integer number required") else: Option.set(self, _val)
def set(self, value): try: _val = int(value) except ValueError: raise OptionValueError(self, value, "Integer number required") else: Option.set(self, _val)
33,423
def set(self, value): try: _val = int(value) except ValueError: raise OptionValueError(self, value, "Integer number required") else: Option.set(self, _val)
def set(self, value): try: _val = int(value) except ValueError: raise OptionValueError(self, value, "Integer number required") else: Option.set(self, _val)
33,424
def set(self, value): try: _val = int(value) except ValueError: raise OptionValueError(self, value, "Integer number required") else: Option.set(self, _val)
def set(self, value): try: _val = int(value) except ValueError: raise OptionValueError(self, value, "Integer number required") else: Option.set(self, _val)
33,425
def filter(self, search_matches, filterspec, sort=(None,None), group=(None,None), num_re = re.compile('^\d+$')): """Return a list of the ids of the active nodes in this class that match the 'filter' spec, sorted by the group spec and then the sort spec.
def filter(self, search_matches, filterspec, sort=(None,None), group=(None,None), num_re = re.compile('^\d+$')): """Return a list of the ids of the active nodes in this class that match the 'filter' spec, sorted by the group spec and then the sort spec.
33,426
def usage(): print '''Usage: roundup init roundup spec classname roundup create [-user login] classanme propname=value ... roundup list [-list] classname roundup history [-list] designator roundup get [-list] designator[,designator,...] propname roundup set [-user login] designator[,designator,...] propname=value ... ...
def usage(): print '''Usage: roundup init roundup spec classname roundup create [-user login] classname propname=value ... roundup list [-list] classname roundup history [-list] designator roundup get [-list] designator[,designator,...] propname roundup set [-user login] designator[,designator,...] propname=value ... ...
33,427
def main(): if len(sys.argv) == 1: usage() return 1 command = sys.argv[1] if command == 'init': password = '' confirm = 'x' while password != confirm: password = getpass.getpass('Admin Password:') confirm = getpass.getpass(' Confirm:') roundupdb.initDB(config.DATABASE, password) return 0 if command == 'get': d...
def main(): if len(sys.argv) == 1: usage() return 1 command = sys.argv[1] if command == 'init': password = '' confirm = 'x' while password != confirm: password = getpass.getpass('Admin Password:') confirm = getpass.getpass(' Confirm:') roundupdb.initDB(config.DATABASE, ...
33,428
def getPart(self): ''' Get a single part of a multipart message and return it as a new Message instance. ''' boundary = self.getparam('boundary') mid, end = '--'+boundary, '--'+boundary+'--' s = cStringIO.StringIO() while 1: line = self.fp.readline() if not line: break if line.strip() in (mid, end): break s.write(line)...
def getPart(self): ''' Get a single part of a multipart message and return it as a new Message instance. ''' boundary = self.getparam('boundary') mid, end = '--'+boundary, '--'+boundary+'--' s = cStringIO.StringIO() while 1: line = self.fp.readline() if not line: break if line.strip() in (mid, end): break s.write(line)...
33,429
def handle_message(self, message): ''' message - a Message instance
def handle_message(self, message): ''' message - a Message instance
33,430
def handle_message(self, message): ''' message - a Message instance
def handle_message(self, message): ''' message - a Message instance
33,431
def __init__(self, instance, request, env, form=None): hyperdb.traceMark() self.instance = instance self.request = request self.env = env
def __init__(self, instance, request, env, form=None): hyperdb.traceMark() self.instance = instance self.request = request self.env = env
33,432
def set_cookie(self, user): ''' Set up a session cookie for the user and store away the user's login info against the session. ''' # TODO generate a much, much stronger session key ;) self.session = binascii.b2a_base64(repr(random.random())).strip()
def set_cookie(self, user): ''' Set up a session cookie for the user and store away the user's login info against the session. ''' # TODO generate a much, much stronger session key ;) self.session = binascii.b2a_base64(repr(random.random())).strip()
33,433
def set_cookie(self, user): ''' Set up a session cookie for the user and store away the user's login info against the session. ''' # TODO generate a much, much stronger session key ;) self.session = binascii.b2a_base64(repr(random.random())).strip()
def set_cookie(self, user): ''' Set up a session cookie for the user and store away the user's login info against the session. ''' # TODO generate a much, much stronger session key ;) self.session = binascii.b2a_base64(repr(random.random())).strip()
33,434
def logout_action(self): ''' Make us really anonymous - nuke the cookie too ''' # log us out self.make_user_anonymous()
def logout_action(self): ''' Make us really anonymous - nuke the cookie too ''' # log us out self.make_user_anonymous()
33,435
def logout_action(self): ''' Make us really anonymous - nuke the cookie too ''' # log us out self.make_user_anonymous()
def logout_action(self): ''' Make us really anonymous - nuke the cookie too ''' # log us out self.make_user_anonymous()
33,436
def do_set(self, args, pwre = re.compile(r'{(\w+)}(.+)')): '''Usage: set [items] property=value property=value ... Set the given properties of one or more items(s).
def do_set(self, args, pwre = re.compile(r'{(\w+)}(.+)')): '''Usage: set items property=value property=value ... Set the given properties of one or more items(s).
33,437
def do_set(self, args, pwre = re.compile(r'{(\w+)}(.+)')): '''Usage: set [items] property=value property=value ... Set the given properties of one or more items(s).
def do_set(self, args, pwre = re.compile(r'{(\w+)}(.+)')): '''Usage: set [items] property=value property=value ... Set the given properties of one or more items(s).
33,438
def open(self, tracker_home): ''' Open the tracker.
def open(self, tracker_home): ''' Open the tracker.
33,439
def open(self, tracker_home): ''' Open the tracker.
def open(self, tracker_home): ''' Open the tracker.
33,440
def formatdate(timeval): return time.strftime("%a, %d %b %Y %H:%M:%S +0000", timeval)
def formatdate(timeval): return time.strftime("%a, %d %b %Y %H:%M:%S +0000", timeval)
33,441
def get_standard_message(self, to, subject, author=None): '''Form a standard email message from Roundup.
def get_standard_message(self, to, subject, author=None): '''Form a standard email message from Roundup.
33,442
def sendmessage(self, nodeid, msgid): """Send a message to the members of an issue's nosy list.
def sendmessage(self, nodeid, msgid): """Send a message to the members of an issue's nosy list.
33,443
def sendmessage(self, nodeid, msgid): """Send a message to the members of an issue's nosy list.
def sendmessage(self, nodeid, msgid): """Send a message to the members of an issue's nosy list.
33,444
def sendmessage(self, nodeid, msgid): """Send a message to the members of an issue's nosy list.
def sendmessage(self, nodeid, msgid): """Send a message to the members of an issue's nosy list.
33,445
def email_footer(self, nodeid, msgid): ''' Add a footer to the e-mail with some useful information ''' web = self.ISSUE_TRACKER_WEB return '''%s
def email_footer(self, nodeid, msgid): ''' Add a footer to the e-mail with some useful information ''' web = self.ISSUE_TRACKER_WEB + 'issue'+ nodeid return '''%s
33,446
def db_nuke(config): """Clear all database contents and drop database itself""" if db_exists(config): kwargs = rdbms_common.connection_dict(config) conn = MySQLdb.connect(**kwargs) try: conn.select_db(config.RDBMS_NAME) except: # no, it doesn't exist pass else: cursor = conn.cursor() cursor.execute("SHOW TABLES") table...
def db_nuke(config): """Clear all database contents and drop database itself""" if db_exists(config): kwargs = connection_dict(config) conn = MySQLdb.connect(**kwargs) try: conn.select_db(config.RDBMS_NAME) except: # no, it doesn't exist pass else: cursor = conn.cursor() cursor.execute("SHOW TABLES") tables = cursor.fe...
33,447
def db_create(config): """Create the database.""" kwargs = rdbms_common.connection_dict(config) conn = MySQLdb.connect(**kwargs) cursor = conn.cursor() command = "CREATE DATABASE %s"%config.RDBMS_NAME config.logging.getLogger('hyperdb').info(command) cursor.execute(command) conn.commit() conn.close()
def db_create(config): """Create the database.""" kwargs = connection_dict(config) conn = MySQLdb.connect(**kwargs) cursor = conn.cursor() command = "CREATE DATABASE %s"%config.RDBMS_NAME config.logging.getLogger('hyperdb').info(command) cursor.execute(command) conn.commit() conn.close()
33,448
def db_exists(config): """Check if database already exists.""" kwargs = rdbms_common.connection_dict(config) conn = MySQLdb.connect(**kwargs) try: try: conn.select_db(config.RDBMS_NAME) except MySQLdb.OperationalError: return 0 finally: conn.close() return 1
def db_exists(config): """Check if database already exists.""" kwargs = connection_dict(config) conn = MySQLdb.connect(**kwargs) try: try: conn.select_db(config.RDBMS_NAME) except MySQLdb.OperationalError: return 0 finally: conn.close() return 1
33,449
def sql_open_connection(self): kwargs = rdbms_common.connection_dict(config, 'db') self.config.logging.getLogger('hyperdb').info('open database %r'%( kwargs['db'],)) try: conn = MySQLdb.connect(**kwargs) except MySQLdb.OperationalError, message: raise DatabaseError, message cursor = conn.cursor() cursor.execute("SET AU...
def sql_open_connection(self): kwargs = connection_dict(self.config) self.config.logging.getLogger('hyperdb').info('open database %r'%( kwargs['db'],)) try: conn = MySQLdb.connect(**kwargs) except MySQLdb.OperationalError, message: raise DatabaseError, message cursor = conn.cursor() cursor.execute("SET AUTOCOMMIT=OFF")...
33,450
def sql_open_connection(self): kwargs = rdbms_common.connection_dict(config, 'db') self.config.logging.getLogger('hyperdb').info('open database %r'%( kwargs['db'],)) try: conn = MySQLdb.connect(**kwargs) except MySQLdb.OperationalError, message: raise DatabaseError, message cursor = conn.cursor() cursor.execute("SET AU...
def sql_open_connection(self): kwargs = rdbms_common.connection_dict(config, 'db') self.config.logging.getLogger('hyperdb').info('open database %r'%( kwargs['db'],)) try: conn = MySQLdb.connect(**kwargs) except MySQLdb.OperationalError, message: raise DatabaseError, message cursor = conn.cursor() cursor.execute("SET AU...
33,451
def add_new_columns_v2(self): '''While we're adding the actor column, we need to update the tables to have the correct datatypes.''' for klass in self.classes.values(): cn = klass.classname properties = klass.getprops() old_spec = self.database_schema['tables'][cn]
def add_new_columns_v2(self): '''While we're adding the actor column, we need to update the tables to have the correct datatypes.''' for klass in self.classes.values(): cn = klass.classname properties = klass.getprops() old_spec = self.database_schema['tables'][cn]
33,452
def add_new_columns_v2(self): '''While we're adding the actor column, we need to update the tables to have the correct datatypes.''' for klass in self.classes.values(): cn = klass.classname properties = klass.getprops() old_spec = self.database_schema['tables'][cn]
def add_new_columns_v2(self): '''While we're adding the actor column, we need to update the tables to have the correct datatypes.''' for klass in self.classes.values(): cn = klass.classname properties = klass.getprops() old_spec = self.database_schema['tables'][cn]
33,453
def add_new_columns_v2(self): '''While we're adding the actor column, we need to update the tables to have the correct datatypes.''' for klass in self.classes.values(): cn = klass.classname properties = klass.getprops() old_spec = self.database_schema['tables'][cn]
def add_new_columns_v2(self): '''While we're adding the actor column, we need to update the tables to have the correct datatypes.''' for klass in self.classes.values(): cn = klass.classname properties = klass.getprops() old_spec = self.database_schema['tables'][cn]
33,454
def create_journal_table(self, spec): ''' create the journal table for a class given the spec and already-determined cols ''' # journal table cols = ','.join(['%s varchar'%x for x in 'nodeid date tag action params'.split()]) sql = '''create table %s__journal ( nodeid integer, date datetime, tag varchar(255), action var...
def create_journal_table(self, spec): ''' create the journal table for a class given the spec and already-determined cols ''' # journal table cols = ','.join(['%s varchar'%x for x in 'nodeid date tag action params'.split()]) sql = '''create table %s__journal ( nodeid integer, date datetime, tag varchar(255), action var...
33,455
def filter(self, search_matches, filterspec, sort=(None,None), group=(None,None)): '''Return a list of the ids of the active nodes in this class that match the 'filter' spec, sorted by the group spec and then the sort spec
def filter(self, search_matches, filterspec, sort=(None,None), group=(None,None)): '''Return a list of the ids of the active nodes in this class that match the 'filter' spec, sorted by the group spec and then the sort spec
33,456
def filter(self, search_matches, filterspec, sort=(None,None), group=(None,None)): '''Return a list of the ids of the active nodes in this class that match the 'filter' spec, sorted by the group spec and then the sort spec
def filter(self, search_matches, filterspec, sort=(None,None), group=(None,None)): '''Return a list of the ids of the active nodes in this class that match the 'filter' spec, sorted by the group spec and then the sort spec
33,457
def sortfun(a, b, dir=sortby[i], i=i): if dir == '-': return cmp(b[1][i], a[1][i]) else: return cmp(a[1][i], b[1][i])
def sortfun(a, b, dir=sortby[i], i=i): if dir == '-': return cmp(b[1][i], a[1][i]) else: return cmp(a[1][i], b[1][i])
33,458
def open_connection(self): if not db_exists(self.config): db_create(self.config)
def open_connection(self): if not db_exists(self.config): db_create(self.config)
33,459
def set(self, nodeid, **propvalues): """Modify a property on an existing node of this class. 'nodeid' must be the id of an existing node of this class or an IndexError is raised.
def set(self, nodeid, **propvalues): """Modify a property on an existing node of this class. 'nodeid' must be the id of an existing node of this class or an IndexError is raised.
33,460
def Choice(name, *options): cl = Class(db, name, name=hyperdb.String(), order=hyperdb.String()) for i in range(len(options)): cl.create(name=option[i], order=i) return hyperdb.Link(name)
def Choice(name, db, *options): '''Quick helper to create a simple class with choices ''' cl = Class(db, name, name=String(), order=String()) for i in range(len(options)): cl.create(name=option[i], order=i) return hyperdb.Link(name)
33,461
def Choice(name, *options): cl = Class(db, name, name=hyperdb.String(), order=hyperdb.String()) for i in range(len(options)): cl.create(name=option[i], order=i) return hyperdb.Link(name)
def Choice(name, *options): cl = Class(db, name, name=hyperdb.String(), order=hyperdb.String()) for i in range(len(options)): cl.create(name=options[i], order=i) return hyperdb.Link(name)
33,462
def index(client, templates, db, classname, filterspec={}, filter=[], columns=[], sort=[], group=[], show_display_form=1, nodeids=None, col_re=re.compile(r'<property\s+name="([^>]+)">')): globals = { 'plain': Plain(db, templates, classname, form={}), 'field': Field(db, templates, classname, form={}), 'menu': Menu(db, t...
def index(client, templates, db, classname, filterspec={}, filter=[], columns=[], sort=[], group=[], show_display_form=1, nodeids=None, col_re=re.compile(r'<property\s+name="([^>]+)">')): globals = { 'plain': Plain(db, templates, classname, form={}), 'field': Field(db, templates, classname, form={}), 'menu': Menu(db, t...
33,463
def login(self, message=None): self.pagehead('Login to roundup', message) self.write('''
def login(self, message=None): self.pagehead('Login to roundup', message) self.write('''
33,464
def login(self, message=None): self.pagehead('Login to roundup', message) self.write('''
def login(self, message=None): self.pagehead('Login to roundup', message) self.write('''
33,465
def login(self, message=None): self.pagehead('Login to roundup', message) self.write('''
def login(self, message=None): self.pagehead('Login to roundup', message) self.write('''
33,466
def login(self, message=None): self.pagehead('Login to roundup', message) self.write('''
def login(self, message=None): self.pagehead('Login to roundup', message) self.write('''
33,467
def login(self, message=None): self.pagehead('Login to roundup', message) self.write('''
def login(self, message=None): self.pagehead('Login to roundup', message) self.write('''
33,468
def login(self, message=None): self.pagehead('Login to roundup', message) self.write('''
def login(self, message=None): self.pagehead('Login to roundup', message) self.write('''
33,469
def login(self, message=None): self.pagehead('Login to roundup', message) self.write('''
def login(self, message=None): self.pagehead('Login to roundup', message) self.write('''
33,470
def main(self, dre=re.compile(r'([^\d]+)(\d+)'), nre=re.compile(r'new(\w+)')):
def main(self, dre=re.compile(r'([^\d]+)(\d+)'), nre=re.compile(r'new(\w+)')):
33,471
def handle_message(self, message): ''' message - a Message instance
def handle_message(self, message): ''' message - a Message instance
33,472
def handle_message(self, message): ''' message - a Message instance
def handle_message(self, message): ''' message - a Message instance
33,473
def handle_message(self, message): ''' message - a Message instance
def handle_message(self, message): ''' message - a Message instance
33,474
def unknown_starttag(self, tag, attributes): s = '' s = s + '<%s' % tag for name, value in attributes: s = s + ' %s="%s"' % (name, value) s = s + '>' self.append_data(s)
def unknown_starttag(self, tag, attributes): self.append_data('<%s' % tag) closeit = 1 for name, value in attributes: s = s + ' %s="%s"' % (name, value) s = s + '>' self.append_data(s)
33,475
def unknown_starttag(self, tag, attributes): s = '' s = s + '<%s' % tag for name, value in attributes: s = s + ' %s="%s"' % (name, value) s = s + '>' self.append_data(s)
def unknown_starttag(self, tag, attributes): s = '' s = s + '<%s' % tag for name, value in attributes: s = s + ' %s="%s"' % (name, value) s = s + '>' self.append_data(s)
33,476
def standard_message(self, to, subject, body, author=None): try: self.mailer.standard_message(to, subject, body, author) return 1 except MessageSendException, e: self.error_message.append(str(e))
def standard_message(self, to, subject, body, author=None): try: self.mailer.standard_message(to, subject, body, author) return 1 except MessageSendError, e: self.error_message.append(str(e))
33,477
def testParagraphs(self): s = '''testing\n\ntesting\n\ntesting''' summary, content = parseContent(s) print `summary`, `content` self.assertEqual(summary, 'testing') self.assertEqual(content, 'testing\n\ntesting\n\ntesting')
def testParagraphs(self): s = '''testing\n\ntesting\n\ntesting''' summary, content = parseContent(s) self.assertEqual(summary, 'testing') self.assertEqual(content, 'testing\n\ntesting\n\ntesting')
33,478
def history(self, direction='descending', dre=re.compile('^\d+$')): self.view_check()
def history(self, direction='descending', dre=re.compile('^\d+$')): self.view_check()
33,479
def is_view_ok(self): ''' Is the user allowed to View the current class? ''' if self._db.security.hasPermission('View', self._client.userid, self._classname, self._name, self._nodeid): return 1 return self.is_edit_ok()
def is_view_ok(self): ''' Is the user allowed to View the current class? ''' if self._db.security.hasPermission('View', self._client.userid, self._classname, self._name, self._nodeid): return 1 return self.is_edit_ok()
33,480
def _changenode(self, props): ''' change the node based on the contents of the form ''' cl = self.db.classes[self.classname] # set status to chatting if 'unread' or 'resolved' try: # determine the id of 'unread','resolved' and 'chatting' unread_id = self.db.status.lookup('unread') resolved_id = self.db.status.lookup('r...
def _changenode(self, props): ''' change the node based on the contents of the form ''' cl = self.db.classes[self.classname] # set status to chatting if 'unread' or 'resolved' try: # determine the id of 'unread','resolved' and 'chatting' unread_id = self.db.status.lookup('unread') resolved_id = self.db.status.lookup('r...
33,481
def _changenode(self, props): ''' change the node based on the contents of the form ''' cl = self.db.classes[self.classname] # set status to chatting if 'unread' or 'resolved' try: # determine the id of 'unread','resolved' and 'chatting' unread_id = self.db.status.lookup('unread') resolved_id = self.db.status.lookup('r...
def _changenode(self, props): ''' change the node based on the contents of the form ''' cl = self.db.classes[self.classname] # set status to chatting if 'unread' or 'resolved' try: # determine the id of 'unread','resolved' and 'chatting' unread_id = self.db.status.lookup('unread') resolved_id = self.db.status.lookup('r...
33,482
def _createnode(self): ''' create a node based on the contents of the form ''' cl = self.db.classes[self.classname] props, dummy = parsePropsFromForm(self.db, cl, self.form)
def _createnode(self): ''' create a node based on the contents of the form ''' cl = self.db.classes[self.classname] props, dummy = parsePropsFromForm(self.db, cl, self.form)
33,483
def setuid(user): if not hasattr(os, 'getuid'): return # People can remove this check if they're really determined if user is None: if os.getuid(): return raise ValueError, _("Can't run as root!") if os.getuid(): print _('WARNING: ignoring "-u" argument, not root') try: import pwd except ImportError: raise ValueErro...
def setuid(user): if not hasattr(os, 'getuid'): return # People can remove this check if they're really determined if user is None: if os.getuid(): return raise ValueError, _("Can't run as root!") if os.getuid(): print _('WARNING: ignoring "-u" argument, not root') try: import pwd except ImportError: raise ValueErro...
33,484
def run(port=undefined, success_message=None): ''' Script entry point - handle args and figure out what to to. ''' # time out after a minute if we can import socket if hasattr(socket, 'setdefaulttimeout'): socket.setdefaulttimeout(60) config = ServerConfig() options = "hvS" if RoundupService: options += 'c' try: (opt...
def run(port=undefined, success_message=None): ''' Script entry point - handle args and figure out what to to. ''' # time out after a minute if we can import socket if hasattr(socket, 'setdefaulttimeout'): socket.setdefaulttimeout(60) config = ServerConfig() options = "hvS" if RoundupService: options += 'c' try: (opt...
33,485
def translate(self, domain, msgid, mapping=None, context=None, target_language=None, default=None): return str(msgid).upper() def repl(m, mapping=mapping): return ustr(mapping[m.group(m.lastindex)]) cre = re.compile(r'\$(?:(%s)|\{(%s)\})' % (NAME_RE, NAME_RE)) return cre.sub(repl, default or msgid)
def translate(self, domain, msgid, mapping=None, context=None, target_language=None, default=None): def repl(m, mapping=mapping): return ustr(mapping[m.group(m.lastindex)]) cre = re.compile(r'\$(?:(%s)|\{(%s)\})' % (NAME_RE, NAME_RE)) return cre.sub(repl, default or msgid)
33,486
def repl(m, mapping=mapping): return ustr(mapping[m.group(m.lastindex)])
def repl(m, mapping=mapping): return ustr(mapping[m.group(m.lastindex)])
33,487
def pagehead(self, title, message=None): url = self.env['SCRIPT_NAME'] + '/' machine = self.env['SERVER_NAME'] port = self.env['SERVER_PORT'] if port != '80': machine = machine + ':' + port base = urlparse.urlunparse(('http', machine, url, None, None, None)) if message is not None: message = _('<div class="system-msg">...
def pagehead(self, title, message=None): url = self.env['SCRIPT_NAME'] + '/' machine = self.env['SERVER_NAME'] port = self.env['SERVER_PORT'] if port != '80': machine = machine + ':' + port base = urlparse.urlunparse(('http', machine, url, None, None, None)) if message is not None: message = _('<div class="system-msg">...
33,488
def pagehead(self, title, message=None): url = self.env['SCRIPT_NAME'] + '/' machine = self.env['SERVER_NAME'] port = self.env['SERVER_PORT'] if port != '80': machine = machine + ':' + port base = urlparse.urlunparse(('http', machine, url, None, None, None)) if message is not None: message = _('<div class="system-msg">...
def pagehead(self, title, message=None): url = self.env['SCRIPT_NAME'] + '/' machine = self.env['SERVER_NAME'] port = self.env['SERVER_PORT'] if port != '80': machine = machine + ':' + port base = urlparse.urlunparse(('http', machine, url, None, None, None)) if message is not None: message = _('<div class="system-msg">...
33,489
def pagehead(self, title, message=None): url = self.env['SCRIPT_NAME'] + '/' machine = self.env['SERVER_NAME'] port = self.env['SERVER_PORT'] if port != '80': machine = machine + ':' + port base = urlparse.urlunparse(('http', machine, url, None, None, None)) if message is not None: message = _('<div class="system-msg">...
def pagehead(self, title, message=None): url = self.env['SCRIPT_NAME'] + '/' machine = self.env['SERVER_NAME'] port = self.env['SERVER_PORT'] if port != '80': machine = machine + ':' + port base = urlparse.urlunparse(('http', machine, url, None, None, None)) if message is not None: message = _('<div class="system-msg">...
33,490
def login(self, message=None, newuser_form=None, action='index'): self.pagehead(_('Login to roundup'), message) self.write(_('''
def login(self, message=None, newuser_form=None, action='index'): self.pagehead(_('Login to roundup'), message) self.write(_('''
33,491
def login_action(self, message=None): if not self.form.has_key('__login_name'): return self.login(message=_('Username required')) self.user = self.form['__login_name'].value if self.form.has_key('__login_password'): password = self.form['__login_password'].value else: password = '' # make sure the user exists try: uid ...
def login_action(self, message=None): if not self.form.has_key('__login_name'): return self.login(message=_('Username required')) self.user = self.form['__login_name'].value if self.form.has_key('__login_password'): password = self.form['__login_password'].value else: password = '' # make sure the user exists try: uid ...
33,492
def login_action(self, message=None): if not self.form.has_key('__login_name'): return self.login(message=_('Username required')) self.user = self.form['__login_name'].value if self.form.has_key('__login_password'): password = self.form['__login_password'].value else: password = '' # make sure the user exists try: uid ...
def login_action(self, message=None): if not self.form.has_key('__login_name'): return self.login(message=_('Username required')) self.user = self.form['__login_name'].value if self.form.has_key('__login_password'): password = self.form['__login_password'].value else: password = '' # make sure the user exists try: uid ...
33,493
def pagehead(self, title, message=None): url = self.env['SCRIPT_NAME'] + '/' #self.env.get('PATH_INFO', '/') machine = self.env['SERVER_NAME'] port = self.env['SERVER_PORT'] if port != '80': machine = machine + ':' + port base = urlparse.urlunparse(('http', machine, url, None, None, None)) if message is not None: messa...
def pagehead(self, title, message=None): url = self.env['SCRIPT_NAME'] + '/' #self.env.get('PATH_INFO', '/') machine = self.env['SERVER_NAME'] port = self.env['SERVER_PORT'] if port != '80': machine = machine + ':' + port base = urlparse.urlunparse(('http', machine, url, None, None, None)) if message is not None: messa...
33,494
def pagehead(self, title, message=None): url = self.env['SCRIPT_NAME'] + '/' #self.env.get('PATH_INFO', '/') machine = self.env['SERVER_NAME'] port = self.env['SERVER_PORT'] if port != '80': machine = machine + ':' + port base = urlparse.urlunparse(('http', machine, url, None, None, None)) if message is not None: messa...
def pagehead(self, title, message=None): url = self.env['SCRIPT_NAME'] + '/' #self.env.get('PATH_INFO', '/') machine = self.env['SERVER_NAME'] port = self.env['SERVER_PORT'] if port != '80': machine = machine + ':' + port base = urlparse.urlunparse(('http', machine, url, None, None, None)) if message is not None: messa...
33,495
def usage(args, message=None): if message is not None: print message print _(
def usage(args, message=None): if message is not None: print message print _(
33,496
def main(argv): '''Handle the arguments to the program and initialise environment. ''' # take the argv array and parse it leaving the non-option # arguments in the args array. try: optionsList, args = getopt.getopt(argv[1:], 'vcC:S:', ['set=', 'class=']) except getopt.GetoptError: # print help information and exit: usa...
def main(argv): '''Handle the arguments to the program and initialise environment. ''' # take the argv array and parse it leaving the non-option # arguments in the args array. try: optionsList, args = getopt.getopt(argv[1:], 'vc:C:S:', ['set=', 'class=']) except getopt.GetoptError: # print help information and exit: us...
33,497
def serve_file(self, designator, dre=re.compile(r'([^\d]+)(\d+)')): ''' Serve the file from the content property of the designated item. ''' m = dre.match(str(designator)) if not m: raise NotFound, str(designator) classname, nodeid = m.group(1), m.group(2) if classname != 'file': raise NotFound, designator
def serve_file(self, designator, dre=re.compile(r'([^\d]+)(\d+)')): ''' Serve the file from the content property of the designated item. ''' m = dre.match(str(designator)) if not m: raise NotFound, str(designator) classname, nodeid = m.group(1), m.group(2) self.opendb('admin') klass = self.db.getclass(classname) pro...
33,498
def serve_file(self, designator, dre=re.compile(r'([^\d]+)(\d+)')): ''' Serve the file from the content property of the designated item. ''' m = dre.match(str(designator)) if not m: raise NotFound, str(designator) classname, nodeid = m.group(1), m.group(2) if classname != 'file': raise NotFound, designator
def serve_file(self, designator, dre=re.compile(r'([^\d]+)(\d+)')): ''' Serve the file from the content property of the designated item. ''' m = dre.match(str(designator)) if not m: raise NotFound, str(designator) classname, nodeid = m.group(1), m.group(2) if classname != 'file': raise NotFound, designator
33,499