bugged stringlengths 4 228k | fixed stringlengths 0 96.3M | __index_level_0__ int64 0 481k |
|---|---|---|
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,700 |
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,701 |
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,702 |
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,703 |
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,704 |
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,705 |
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,706 |
def newuser_action(self, message=None): ''' create a new user based on the contents of the form and then set the cookie ''' # re-open the database as "admin" self.db.close() self.db = self.instance.open('admin') | def newuser_action(self, message=None): ''' create a new user based on the contents of the form and then set the cookie ''' # re-open the database as "admin" self.db.close() self.db = self.instance.open('admin') | 33,707 |
def _opendb(self): '''Open the roundup instance database for a transaction. ''' instance = roundup.instance.open(self.instance_home) request = RequestWrapper(self.REQUEST['RESPONSE']) env = self.REQUEST.environ env['SCRIPT_NAME'] = '/'.join(self.getPhysicalPath()[:-1]) env['INSTANCE_NAME'] = self.id if env['REQUEST_MET... | def _opendb(self): '''Open the roundup instance database for a transaction. ''' instance = roundup.instance.open(self.instance_home) request = RequestWrapper(self.REQUEST['RESPONSE']) env = self.REQUEST.environ import urlparse path = urlparse.urlparse( self.absolute_url() )[2] path_components = path.split( '/' ) if... | 33,708 |
def testChanges(self): self.db.issue.create(title="spam", status='1') self.db.issue.create(title="eggs", status='2') self.db.issue.create(title="ham", status='4') self.db.issue.create(title="arguments", status='2') self.db.issue.create(title="abuse", status='1') self.db.issue.addprop(fixer=Link("user")) props = self.db... | def testChanges(self): self.db.issue.create(title="spam", status='1') self.db.issue.create(title="eggs", status='2') self.db.issue.create(title="ham", status='4') self.db.issue.create(title="arguments", status='2') self.db.issue.create(title="abuse", status='1') self.db.issue.addprop(fixer=Link("user")) props = self.db... | 33,709 |
def __init__(self, spec='.', offset=0, add_granularity=0, translator=i18n): """Construct a date given a specification and a time zone offset. | def __init__(self, spec='.', offset=0, add_granularity=0, translator=i18n): """Construct a date given a specification and a time zone offset. | 33,710 |
def test(): intervals = (" 3w 1 d 2:00", " + 2d", "3w") for interval in intervals: print '>>> Interval("%s")'%interval print `Interval(interval)` dates = (".", "2000-06-25.19:34:02", ". + 2d", "1997-04-17", "01-25", "08-13.22:13", "14:25", '2002-12') for date in dates: print '>>> Date("%s")'%date print `Date(date)... | def test(): intervals = (" 3w 1 d 2:00", " + 2d", "3w") for interval in intervals: print '>>> Interval("%s")'%interval print `Interval(interval)` dates = (".", "2000-06-25.19:34:02", ". + 2d", "1997-04-17", "01-25", "08-13.22:13", "14:25", '2002-12') for date in dates: print '>>> Date("%s")'%date print `Date(date)... | 33,711 |
def get(self): _val = Option.get(self) if not os.path.isabs(_val): _val = os.path.join(self.config["TRACKER_HOME"], _val) return _val | def get(self): _val = Option.get(self) if _val and not os.path.isabs(_val): _val = os.path.join(self.config["TRACKER_HOME"], _val) return _val | 33,712 |
def pagefoot(self): if self.debug: self.write('<hr><small><dl>') self.write('<dt><b>Path</b></dt>') self.write('<dd>%s</dd>'%(', '.join(map(repr, self.split_path)))) keys = self.form.keys() keys.sort() if keys: self.write('<dt><b>Form entries</b></dt>') for k in self.form.keys(): v = self.form.getvalue(k, "<empty>") if... | def pagefoot(self): if self.debug: self.write('<hr><small><dl>') self.write('<dt><b>Path</b></dt>') self.write('<dd>%s</dd>'%(', '.join(map(repr, self.split_path)))) keys = self.form.keys() keys.sort() if keys: self.write('<dt><b>Form entries</b></dt>') for k in self.form.keys(): v = self.form.getvalue(k, "<empty>") if... | 33,713 |
def index_arg(self, arg): ''' handle the args to index - they might be a list from the form (ie. submitted from a form) or they might be a command-separated single string (ie. manually constructed GET args) ''' if self.form.has_key(arg): arg = self.form[arg] if type(arg) == type([]): return [arg.value for arg in arg] ... | def index_arg(self, arg): ''' handle the args to index - they might be a list from the form (ie. submitted from a form) or they might be a command-separated single string (ie. manually constructed GET args) ''' if self.form.has_key(arg): arg = self.form[arg] if typeof(arg) == typeof([]): return [arg.value for arg in a... | 33,714 |
def index_filterspec(self, filter): ''' pull the index filter spec from the form | def index_filterspec(self, filter): ''' pull the index filter spec from the form | 33,715 |
def showfile(self): ''' display a file ''' nodeid = self.nodeid cl = self.db.file type = cl.get(nodeid, 'type') if type == 'message/rfc822': type = 'text/plain' self.header(headers={'Content-Type': type}) self.write(cl.get(nodeid, 'content')) | def showfile(self): ''' display a file ''' nodeid = self.nodeid cl = self.db.file mimetype = cl.get(nodeid, 'type') if mimetype == 'message/rfc822': mimetype = 'text/plain' self.header(headers={'Content-Type': mimetype}) self.write(cl.get(nodeid, 'content')) | 33,716 |
def _post_editnode(self, nid, changes=None): ''' do the linking and message sending part of the node creation ''' cn = self.classname cl = self.db.classes[cn] # link if necessary keys = self.form.keys() for key in keys: if key == ':multilink': value = self.form[key].value if type(value) != type([]): value = [value] for... | def _post_editnode(self, nid, changes=None): ''' do the linking and message sending part of the node creation ''' cn = self.classname cl = self.db.classes[cn] # link if necessary keys = self.form.keys() for key in keys: if key == ':multilink': value = self.form[key].value if typeof(value) != typeof([]): value = [value]... | 33,717 |
def _post_editnode(self, nid, changes=None): ''' do the linking and message sending part of the node creation ''' cn = self.classname cl = self.db.classes[cn] # link if necessary keys = self.form.keys() for key in keys: if key == ':multilink': value = self.form[key].value if type(value) != type([]): value = [value] for... | def _post_editnode(self, nid, changes=None): ''' do the linking and message sending part of the node creation ''' cn = self.classname cl = self.db.classes[cn] # link if necessary keys = self.form.keys() for key in keys: if key == ':multilink': value = self.form[key].value if typeof(value) != typeof([]): value = [value]... | 33,718 |
def parsePropsFromForm(db, cl, form, nodeid=0): '''Pull properties for the given class out of the form. ''' props = {} changed = [] keys = form.keys() num_re = re.compile('^\d+$') for key in keys: if not cl.properties.has_key(key): continue proptype = cl.properties[key] if isinstance(proptype, hyperdb.String): value = ... | def parsePropsFromForm(db, cl, form, nodeid=0): '''Pull properties for the given class out of the form. ''' props = {} changed = [] keys = form.keys() num_re = re.compile('^\d+$') for key in keys: if not cl.properties.has_key(key): continue proptype = cl.properties[key] if isinstance(proptype, hyperdb.String): value = ... | 33,719 |
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,720 |
def logout(self, message=None): self.make_user_anonymous() # construct the logout cookie path = '/'.join((self.env['SCRIPT_NAME'], self.env['INSTANCE_NAME'], '')) now = Cookie._getdate() self.header({'Set-Cookie': 'roundup_user=deleted; Max-Age=0; expires=%s; Path=%s;'%(now, path)}) return self.index() | def logout(self, message=None): self.make_user_anonymous() # construct the logout cookie path = '/'.join((self.env['SCRIPT_NAME'], self.env['INSTANCE_NAME'], '')) now = Cookie._getdate() self.header({'Set-Cookie': 'roundup_user=deleted; Max-Age=0; expires=%s; Path=%s;'%(now, path)}) return self.index() | 33,721 |
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,722 |
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,723 |
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,724 |
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 = '' print self.user, password # make sure th... | 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 = '' print self.user, password # make sure th... | 33,725 |
def newuser_action(self, message=None): ''' create a new user based on the contents of the form and then set the cookie ''' # re-open the database as "admin" self.db.close() self.db = self.instance.open('admin') | def newuser_action(self, message=None): ''' create a new user based on the contents of the form and then set the cookie ''' # re-open the database as "admin" self.db.close() self.db = self.instance.open('admin') | 33,726 |
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,727 |
def set(self, nodeid, **propvalues): isnew = 0 if propvalues.has_key('#ISNEW'): isnew = 1 del propvalues['#ISNEW'] if not propvalues: return if propvalues.has_key('id'): raise KeyError, '"id" is reserved' if self.db.journaltag is None: raise DatabaseError, 'Database open read-only' view = self.getview(1) # node must e... | def set(self, nodeid, **propvalues): isnew = 0 if propvalues.has_key('#ISNEW'): isnew = 1 del propvalues['#ISNEW'] if not propvalues: return if propvalues.has_key('id'): raise KeyError, '"id" is reserved' if self.db.journaltag is None: raise DatabaseError, 'Database open read-only' view = self.getview(1) # node must e... | 33,728 |
def __getview(self): db = self.db._db view = db.view(self.classname) if self.db.fastopen: return view.ordered(1) # is the definition the same? mkprops = view.structure() for nm, rutyp in self.ruprops.items(): for mkprop in mkprops: if mkprop.name == nm: break else: mkprop = None if mkprop is None: #print "%s missing pr... | def __getview(self): db = self.db._db view = db.view(self.classname) if self.db.fastopen: return view.ordered(1) # is the definition the same? mkprops = view.structure() for nm, rutyp in self.ruprops.items(): for mkprop in mkprops: if mkprop.name == nm: break else: mkprop = None if mkprop is None: #print "%s missing pr... | 33,729 |
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 | 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,730 |
def install_demo(home, backend): from roundup import init, instance, password, backends, configuration # set up the config for this tracker config = configuration.CoreConfig() config['TRACKER_HOME'] = home config['MAIL_DOMAIN'] = 'localhost' config['DATABASE'] = 'db' if backend in ('mysql', 'postgresql'): config['RDBM... | from roundup import configuration from roundup.scripts import roundup_server def install_demo(home, backend, template): """Install a demo tracker Parameters: home: tracker home directory path backend: database backend name template: full path to the tracker template directory """ from roundup import init, instance, ... | 33,731 |
def install_demo(home, backend): from roundup import init, instance, password, backends, configuration # set up the config for this tracker config = configuration.CoreConfig() config['TRACKER_HOME'] = home config['MAIL_DOMAIN'] = 'localhost' config['DATABASE'] = 'db' if backend in ('mysql', 'postgresql'): config['RDBM... | def install_demo(home, backend): from roundup import init, instance, password, backends, configuration # set up the config for this tracker config = configuration.CoreConfig() config['TRACKER_HOME'] = home config['MAIL_DOMAIN'] = 'localhost' config['DATABASE'] = 'db' if backend in ('mysql', 'postgresql'): config['RDBM... | 33,732 |
def install_demo(home, backend): from roundup import init, instance, password, backends, configuration # set up the config for this tracker config = configuration.CoreConfig() config['TRACKER_HOME'] = home config['MAIL_DOMAIN'] = 'localhost' config['DATABASE'] = 'db' if backend in ('mysql', 'postgresql'): config['RDBM... | def install_demo(home, backend): from roundup import init, instance, password, backends, configuration # set up the config for this tracker config = configuration.CoreConfig() config['TRACKER_HOME'] = home config['MAIL_DOMAIN'] = 'localhost' config['DATABASE'] = 'db' if backend in ('mysql', 'postgresql'): config['RDBM... | 33,733 |
def run_demo(): ''' Run a demo server for users to play with for instant gratification. Sets up the web service on localhost. Disables nosy lists. ''' home = os.path.abspath('demo') backend = 'anydbm' if not os.path.exists(home) or sys.argv[-1] == 'nuke': if len(sys.argv) > 2: backend = sys.argv[-2] install_demo(home,... | def run_demo(): ''' Run a demo server for users to play with for instant gratification. Sets up the web service on localhost. Disables nosy lists. ''' home = os.path.abspath('demo') backend = 'anydbm' if not os.path.exists(home) or sys.argv[-1] == 'nuke': if len(sys.argv) > 2: backend = sys.argv[-2] install_demo(home,... | 33,734 |
def run_demo(): ''' Run a demo server for users to play with for instant gratification. Sets up the web service on localhost. Disables nosy lists. ''' home = os.path.abspath('demo') backend = 'anydbm' if not os.path.exists(home) or sys.argv[-1] == 'nuke': if len(sys.argv) > 2: backend = sys.argv[-2] install_demo(home,... | defcfg = configuration.CoreConfig(home) run_demo():cfg = configuration.CoreConfig(home) '''cfg = configuration.CoreConfig(home) Runcfg = configuration.CoreConfig(home) acfg = configuration.CoreConfig(home) democfg = configuration.CoreConfig(home) servercfg = configuration.CoreConfig(home) forcfg = configuration.CoreCon... | 33,735 |
def run_demo(): ''' Run a demo server for users to play with for instant gratification. Sets up the web service on localhost. Disables nosy lists. ''' home = os.path.abspath('demo') backend = 'anydbm' if not os.path.exists(home) or sys.argv[-1] == 'nuke': if len(sys.argv) > 2: backend = sys.argv[-2] install_demo(home,... | def run_demo(): ''' Run a demo server for users to play with for instant gratification. Sets up the web service on localhost. Disables nosy lists. ''' home = os.path.abspath('demo') backend = 'anydbm' if not os.path.exists(home) or sys.argv[-1] == 'nuke': if len(sys.argv) > 2: backend = sys.argv[-2] install_demo(home,... | 33,736 |
def run_demo(): ''' Run a demo server for users to play with for instant gratification. Sets up the web service on localhost. Disables nosy lists. ''' home = os.path.abspath('demo') backend = 'anydbm' if not os.path.exists(home) or sys.argv[-1] == 'nuke': if len(sys.argv) > 2: backend = sys.argv[-2] install_demo(home,... | def run_demo(): ''' Run a demo server for users to play with for instant gratification. Sets up the web service on localhost. Disables nosy lists. ''' home = os.path.abspath('demo') backend = 'anydbm' if not os.path.exists(home) or sys.argv[-1] == 'nuke': if len(sys.argv) > 2: backend = sys.argv[-2] install_demo(home,... | 33,737 |
def run_demo(): ''' Run a demo server for users to play with for instant gratification. Sets up the web service on localhost. Disables nosy lists. ''' home = os.path.abspath('demo') backend = 'anydbm' if not os.path.exists(home) or sys.argv[-1] == 'nuke': if len(sys.argv) > 2: backend = sys.argv[-2] install_demo(home,... | def run_demo(): ''' Run a demo server for users to play with for instant gratification. Sets up the web service on localhost. Disables nosy lists. ''' home = os.path.abspath('demo') backend = 'anydbm' if not os.path.exists(home) or sys.argv[-1] == 'nuke': if len(sys.argv) > 2: backend = sys.argv[-2] install_demo(home,... | 33,738 |
def __init__(self, instance, request, env): self.instance = instance self.request = request self.env = env self.path = env['PATH_INFO'] self.split_path = self.path.split('/') | def __init__(self, instance, request, env): self.instance = instance self.request = request self.env = env self.path = env['PATH_INFO'] self.split_path = self.path.split('/') | 33,739 |
def filter(self, request=None, filterspec={}, sort=(None,None), group=(None,None)): ''' Return a list of items from this class, filtered and sorted by the current requested filterspec/filter/sort/group args | def filter(self, request=None, filterspec={}, sort=(None,None), group=(None,None)): ''' Return a list of items from this class, filtered and sorted by the current requested filterspec/filter/sort/group args | 33,740 |
def multilinkGenerator(classname, client, values): id = -1 check = client.db.security.hasPermission userid = client.userid while 1: id += 1 if id >= len(values): raise StopIteration value = values[id] if check('View', userid, classname, itemid=value): yield HTMLItem(client, classname, value) | 33,741 | |
def __iter__(self): ''' iterate and return a new HTMLItem ''' return multilinkGenerator(self._prop.classname, self._client, self._value) | def __iter__(self): ''' iterate and return a new HTMLItem ''' return multilinkGenerator(self._prop.classname, self._client, self._value) | 33,742 |
def reverse(self): ''' return the list in reverse order ''' l = self._value[:] l.reverse() return multilinkGenerator(self._prop.classname, self._client, l) | def reverse(self): ''' return the list in reverse order ''' l = self._value[:] l.reverse() return multilinkGenerator(self._prop.classname, self._client, l) | 33,743 |
def pg_command(cursor, command): '''Execute the postgresql command, which may be blocked by some other user connecting to the database, and return a true value if it succeeds. ''' try: cursor.execute(command) except psycopg.ProgrammingError, err: response = str(err).split('\n')[0] if response.find('FATAL') != -1: raise... | def pg_command(cursor, command): '''Execute the postgresql command, which may be blocked by some other user connecting to the database, and return a true value if it succeeds. ''' try: cursor.execute(command) except psycopg.ProgrammingError, err: response = str(err).split('\n')[0] if response.find('FATAL') != -1: raise... | 33,744 |
def finalize_options(self): build_scripts.finalize_options(self) cmdopt=self.distribution.command_options | def finalize_options(self): build_scripts.finalize_options(self) cmdopt=self.distribution.command_options | 33,745 |
def testNewIssueAuthMsg(self): message = cStringIO.StringIO('''Content-Type: text/plain; | def testNewIssueAuthMsg(self): message = cStringIO.StringIO('''Content-Type: text/plain; | 33,746 |
def testSimpleFollowup(self): self.doNewIssue() message = cStringIO.StringIO('''Content-Type: text/plain; | def testSimpleFollowup(self): self.doNewIssue() message = cStringIO.StringIO('''Content-Type: text/plain; | 33,747 |
def testFollowup(self): self.doNewIssue() | def testFollowup(self): self.doNewIssue() | 33,748 |
def testFollowupTitleMatch(self): self.doNewIssue() message = cStringIO.StringIO('''Content-Type: text/plain; | def testFollowupTitleMatch(self): self.doNewIssue() message = cStringIO.StringIO('''Content-Type: text/plain; | 33,749 |
def testFollowupNosyAuthor(self): self.doNewIssue() self.db.config.ADD_AUTHOR_TO_NOSY = 'yes' message = cStringIO.StringIO('''Content-Type: text/plain; | def testFollowupNosyAuthor(self): self.doNewIssue() self.db.config.ADD_AUTHOR_TO_NOSY = 'yes' message = cStringIO.StringIO('''Content-Type: text/plain; | 33,750 |
def testFollowupNosyRecipients(self): self.doNewIssue() self.db.config.ADD_RECIPIENTS_TO_NOSY = 'yes' message = cStringIO.StringIO('''Content-Type: text/plain; | def testFollowupNosyRecipients(self): self.doNewIssue() self.db.config.ADD_RECIPIENTS_TO_NOSY = 'yes' message = cStringIO.StringIO('''Content-Type: text/plain; | 33,751 |
def testFollowupNosyAuthorAndCopy(self): self.doNewIssue() self.db.config.ADD_AUTHOR_TO_NOSY = 'yes' self.db.config.MESSAGES_TO_AUTHOR = 'yes' message = cStringIO.StringIO('''Content-Type: text/plain; | def testFollowupNosyAuthorAndCopy(self): self.doNewIssue() self.db.config.ADD_AUTHOR_TO_NOSY = 'yes' self.db.config.MESSAGES_TO_AUTHOR = 'yes' message = cStringIO.StringIO('''Content-Type: text/plain; | 33,752 |
def testFollowupNoNosyAuthor(self): self.doNewIssue() self.instance.config.ADD_AUTHOR_TO_NOSY = 'no' message = cStringIO.StringIO('''Content-Type: text/plain; | def testFollowupNoNosyAuthor(self): self.doNewIssue() self.instance.config.ADD_AUTHOR_TO_NOSY = 'no' message = cStringIO.StringIO('''Content-Type: text/plain; | 33,753 |
def testFollowupNoNosyRecipients(self): self.doNewIssue() self.instance.config.ADD_RECIPIENTS_TO_NOSY = 'no' message = cStringIO.StringIO('''Content-Type: text/plain; | def testFollowupNoNosyRecipients(self): self.doNewIssue() self.instance.config.ADD_RECIPIENTS_TO_NOSY = 'no' message = cStringIO.StringIO('''Content-Type: text/plain; | 33,754 |
def testEnc01(self): self.doNewIssue() message = cStringIO.StringIO('''Content-Type: text/plain; | def testEnc01(self): self.doNewIssue() message = cStringIO.StringIO('''Content-Type: text/plain; | 33,755 |
def testMultipartEnc01(self): self.doNewIssue() message = cStringIO.StringIO('''Content-Type: text/plain; | def testMultipartEnc01(self): self.doNewIssue() message = cStringIO.StringIO('''Content-Type: text/plain; | 33,756 |
def testFollowupStupidQuoting(self): self.doNewIssue() | def testFollowupStupidQuoting(self): self.doNewIssue() | 33,757 |
def field(self, showid=0, size=None): ''' Render a form edit field for the property | def field(self, showid=0, size=None): ''' Render a form edit field for the property | 33,758 |
def field(self, showid=0, size=None): ''' Render a form edit field for the property | def field(self, showid=0, size=None): ''' Render a form edit field for the property | 33,759 |
def field(self, showid=0, size=None): ''' Render a form edit field for the property | def field(self, showid=0, size=None): ''' Render a form edit field for the property | 33,760 |
def have_backend(name): '''Is backend "name" available?''' try: get_backend(name) return 1 except ImportError, e: global _modules if not str(e).startswith('No module named %s' % _modules[name]): raise return 0 | def have_backend(name): '''Is backend "name" available?''' try: get_backend(name) return 1 except ImportError, e: global _modules if not str(e).startswith('No module named %s' % _modules.get(name, name)): raise return 0 | 33,761 |
def lookupIds(db, prop, ids, fail_ok=0, num_re=re.compile('^-?\d+$')): ''' "fail_ok" should be specified if we wish to pass through bad values (most likely form values that we wish to represent back to the user) ''' cl = db.getclass(prop.classname) l = [] for entry in ids: if num_re.match(entry): l.append(entry) else: ... | def lookupIds(db, prop, ids, fail_ok=0, num_re=re.compile('^-?\d+$')): ''' "fail_ok" should be specified if we wish to pass through bad values (most likely form values that we wish to represent back to the user) ''' cl = db.getclass(prop.classname) l = [] for entry in ids: if num_re.match(entry): l.append(entry) else: ... | 33,762 |
def __init__(self, config, journaltag=None): self.config = config self.journaltag = journaltag self.classes = {} self._classes = [] self.dirty = 0 self.__RW = 0 self._db = self.__open() self.indexer = Indexer(self.config.DATABASE) os.umask(0002) | def __init__(self, config, journaltag=None): self.config = config self.journaltag = journaltag self.classes = {} self._classes = [] self.dirty = 0 self._db = self.__open() self.indexer = Indexer(self.config.DATABASE) os.umask(0002) | 33,763 |
def __init__(self, config, journaltag=None): self.config = config self.journaltag = journaltag self.classes = {} self._classes = [] self.dirty = 0 self.__RW = 0 self._db = self.__open() self.indexer = Indexer(self.config.DATABASE) os.umask(0002) | def __init__(self, config, journaltag=None): self.config = config self.journaltag = journaltag self.classes = {} self._classes = [] self.dirty = 0 self.__RW = 0 self._db = self.__open() self.indexer = Indexer(self.config.DATABASE, self._db) os.umask(0002) | 33,764 |
def commit(self): if self.dirty: if self.__RW: self._db.commit() for cl in self.classes.values(): cl._commit() self.indexer.save_index() else: raise RuntimeError, "metakit is open RO" self.dirty = 0 | def commit(self): if self.dirty: self._db.commit() for cl in self.classes.values(): cl._commit() self.indexer.save_index() self.dirty = 0 | 33,765 |
def close(self): import time now = time.time start = now() for cl in self.classes.values(): cl.db = None #self._db.rollback() #print "pre-close cleanup of DB(%d) took %2.2f secs" % (self.__RW, now()-start) self._db = None #print "close of DB(%d) took %2.2f secs" % (self.__RW, now()-start) self.classes = {} try: del _in... | def close(self): for cl in self.classes.values(): cl.db = None #self._db.rollback() #print "pre-close cleanup of DB(%d) took %2.2f secs" % (self.__RW, now()-start) self._db = None #print "close of DB(%d) took %2.2f secs" % (self.__RW, now()-start) self.classes = {} try: del _instances[id(self.config)] except KeyError: ... | 33,766 |
def close(self): import time now = time.time start = now() for cl in self.classes.values(): cl.db = None #self._db.rollback() #print "pre-close cleanup of DB(%d) took %2.2f secs" % (self.__RW, now()-start) self._db = None #print "close of DB(%d) took %2.2f secs" % (self.__RW, now()-start) self.classes = {} try: del _in... | def close(self): import time now = time.time start = now() for cl in self.classes.values(): cl.db = None #self._db.rollback() #print "pre-close cleanup of DB(%d) took %2.2f secs" % (self.__RW, now()-start) self._db = None #print "close of DB(%d) took %2.2f secs" % (self.__RW, now()-start) self.classes = {} try: del _in... | 33,767 |
def close(self): import time now = time.time start = now() for cl in self.classes.values(): cl.db = None #self._db.rollback() #print "pre-close cleanup of DB(%d) took %2.2f secs" % (self.__RW, now()-start) self._db = None #print "close of DB(%d) took %2.2f secs" % (self.__RW, now()-start) self.classes = {} try: del _in... | defclose(self):importtimenow=time.timestart=now()forclinself.classes.values():cl.db=None#self._db.rollback()#print"pre-closecleanupofDB(%d)took%2.2fsecs"%(self.__RW,now()-start)self._db=None#print"closeofDB(%d)took%2.2fsecs"%(self.__RW,now()-start)self.classes={}try:del_instances[id(self.config)]exceptKeyError:passself... | 33,768 |
def close(self): import time now = time.time start = now() for cl in self.classes.values(): cl.db = None #self._db.rollback() #print "pre-close cleanup of DB(%d) took %2.2f secs" % (self.__RW, now()-start) self._db = None #print "close of DB(%d) took %2.2f secs" % (self.__RW, now()-start) self.classes = {} try: del _in... | def close(self): import time now = time.time start = now() for cl in self.classes.values(): cl.db = None #self._db.rollback() #print "pre-close cleanup of DB(%d) took %2.2f secs" % (self.__RW, now()-start) self._db = None #print "close of DB(%d) took %2.2f secs" % (self.__RW, now()-start) self.classes = {} try: del _in... | 33,769 |
def __open(self): self.dbnm = db = os.path.join(self.config.DATABASE, 'tracker.mk4') self.fastopen = 0 if os.path.exists(db): dbtm = os.path.getmtime(db) pkgnm = self.config.__name__.split('.')[0] schemamod = sys.modules.get(pkgnm+'.dbinit', None) if schemamod: if os.path.exists(schemamod.__file__): schematm = os.path.... | def __open(self): self.dbnm = db = os.path.join(self.config.DATABASE, 'tracker.mk4') self.fastopen = 0 if os.path.exists(db): dbtm = os.path.getmtime(db) pkgnm = self.config.__name__.split('.')[0] schemamod = sys.modules.get(pkgnm+'.dbinit', None) if schemamod: if os.path.exists(schemamod.__file__): schematm = os.path.... | 33,770 |
def isReadOnly(self): return self.__RW == 0 | def isReadOnly(self): return self.__RW == 0 | 33,771 |
def setkey(self, propname): if self.keyname: if propname == self.keyname: return raise ValueError, "%s already indexed on %s" % (self.classname, self.keyname) # first setkey for this run self.keyname = propname iv = self.db._db.view('_%s' % self.classname) if self.db.fastopen and iv.structure(): return # very first set... | def setkey(self, propname): if self.keyname: if propname == self.keyname: return raise ValueError, "%s already indexed on %s" % (self.classname, self.keyname) # first setkey for this run self.keyname = propname iv = self.db._db.view('_%s' % self.classname) if self.db.fastopen and iv.structure(): return # very first set... | 33,772 |
def setkey(self, propname): if self.keyname: if propname == self.keyname: return raise ValueError, "%s already indexed on %s" % (self.classname, self.keyname) # first setkey for this run self.keyname = propname iv = self.db._db.view('_%s' % self.classname) if self.db.fastopen and iv.structure(): return # very first set... | defsetkey(self,propname):ifself.keyname:ifpropname==self.keyname:returnraiseValueError,"%salreadyindexedon%s"%(self.classname,self.keyname)#firstsetkeyforthisrunself.keyname=propnameiv=self.db._db.view('_%s'%self.classname)ifself.db.fastopenandiv.structure():return#veryfirstsetkeyeverself.db.getWriteAccess()self.db.dir... | 33,773 |
def addprop(self, **properties): for key in properties.keys(): if self.ruprops.has_key(key): raise ValueError, "%s is already a property of %s" % (key, self.classname) self.ruprops.update(properties) self.db.getWriteAccess() self.db.fastopen = 0 view = self.__getview() self.db.commit() | def addprop(self, **properties): for key in properties.keys(): if self.ruprops.has_key(key): raise ValueError, "%s is already a property of %s" % (key, self.classname) self.ruprops.update(properties) self.db.fastopen = 0 view = self.__getview() self.db.commit() | 33,774 |
def __getview(self): db = self.db._db view = db.view(self.classname) mkprops = view.structure() if mkprops and self.db.fastopen: return view.ordered(1) # is the definition the same? for nm, rutyp in self.ruprops.items(): for mkprop in mkprops: if mkprop.name == nm: break else: mkprop = None if mkprop is None: print "%s... | def __getview(self): db = self.db._db view = db.view(self.classname) mkprops = view.structure() if mkprops and self.db.fastopen: return view.ordered(1) # is the definition the same? for nm, rutyp in self.ruprops.items(): for mkprop in mkprops: if mkprop.name == nm: break else: mkprop = None if mkprop is None: print "%s... | 33,775 |
def getview(self, RW=0): if RW and self.db.isReadOnly(): self.db.getWriteAccess() return self.db._db.view(self.classname).ordered(1) | def getview(self, RW=0): return self.db._db.view(self.classname).ordered(1) | 33,776 |
def getindexview(self, RW=0): if RW and self.db.isReadOnly(): self.db.getWriteAccess() return self.db._db.view("_%s" % self.classname).ordered(1) | def getindexview(self, RW=0): return self.db._db.view("_%s" % self.classname).ordered(1) | 33,777 |
def undo(fnm=nm, action1=os.remove, indexer=self.db.indexer): remove(fnm) | def undo(fnm=nm, action1=os.remove, indexer=self.db.indexer): remove(fnm) | 33,778 |
def menu(self, size=None, height=None, showid=0, additional=[], sort_on=None, **conditions): ''' Render a form select list for this property | def menu(self, size=None, height=None, showid=0, additional=[], sort_on=None, **conditions): ''' Render a form select list for this property | 33,779 |
def inner_run_cgi(self): ''' This is the inner part of the CGI handling ''' rest = self.path | def inner_run_cgi(self): ''' This is the inner part of the CGI handling ''' rest = self.path | 33,780 |
def __getattr__(self, classname): if classname == 'transactions': return self.dirty # fall back on the classes return self.getclass(classname) | def __getattr__(self, classname): if classname == 'transactions': return self.dirty # fall back on the classes return self.getclass(classname) | 33,781 |
def __init__(self, *args, **kwargs): HTMLProperty.__init__(self, *args, **kwargs) if self._value: display_value = lookupIds(self._db, self._prop, self._value, fail_ok=1) sortfun = make_sort_function(self._db, self._prop.classname) # sorting fails if the value contains # items not yet stored in the database # ignore the... | def __init__(self, *args, **kwargs): HTMLProperty.__init__(self, *args, **kwargs) if self._value: display_value = lookupIds(self._db, self._prop, self._value, fail_ok=1) sortfun = make_sort_function(self._db, self._prop.classname) # sorting fails if the value contains # items not yet stored in the database # ignore the... | 33,782 |
def parseForm(self, form, classname='test', nodeid=None): cl = client.Client(self.instance, None, {'PATH_INFO':'/'}, makeForm(form)) cl.classname = classname cl.nodeid = nodeid cl.db = self.db return cl.parsePropsFromForm() | def parseForm(self, form, classname='test', nodeid=None): cl = client.Client(self.instance, None, {'PATH_INFO':'/'}, makeForm(form)) cl.classname = classname cl.nodeid = nodeid cl.db = self.db return cl.parsePropsFromForm() | 33,783 |
def testMixedMultilink(self): form = cgi.FieldStorage() form.list.append(cgi.MiniFieldStorage('nosy', '1,2')) form.list.append(cgi.MiniFieldStorage('nosy', '3')) cl = client.Client(self.instance, None, {'PATH_INFO':'/'}, form) cl.classname = 'issue' cl.nodeid = None cl.db = self.db self.assertEqual(cl.parsePropsFromFor... | def testMixedMultilink(self): form = cgi.FieldStorage() form.list.append(cgi.MiniFieldStorage('nosy', '1,2')) form.list.append(cgi.MiniFieldStorage('nosy', '3')) cl = client.Client(self.instance, None, {'PATH_INFO':'/'}, form) cl.classname = 'issue' cl.nodeid = None cl.db = self.db self.assertEqual(cl.parsePropsFromFor... | 33,784 |
def classhelp(self, properties=None, label=''"(list)", width='500', height='400', property='', form='itemSynopsis'): '''Pop up a javascript window with class help | def classhelp(self, properties=None, label=''"(list)", width='500', height='400', property='', form='itemSynopsis'): '''Pop up a javascript window with class help | 33,785 |
def get_backend(name): '''Get a specific backend by name.''' return __import__('back_%s'%name, globals()) | def get_backend(name): '''Get a specific backend by name.''' vars = globals() if vars.has_key(name): return vars[name] module_name = 'back_%s' % name try: module = __import__(module_name, vars) except: del sys.modules['.'.join((__name__, module_name))] del vars[module_name] raise else: vars[name] = module return m... | 33,786 |
def have_backend(name): '''Is backend "name" available?''' module = _modules.get(name, name) try: get_backend(name) return 1 except ImportError, e: if not str(e).startswith('No module named %s'%module): raise return 0 | def have_backend(name): '''Is backend "name" available?''' try: get_backend(name) return 1 except ImportError, e: if not str(e).startswith('No module named %s'%module): raise return 0 | 33,787 |
def have_backend(name): '''Is backend "name" available?''' module = _modules.get(name, name) try: get_backend(name) return 1 except ImportError, e: if not str(e).startswith('No module named %s'%module): raise return 0 | def have_backend(name): '''Is backend "name" available?''' module = _modules.get(name, name) try: get_backend(name) return 1 except ImportError, e: global _modules if not str(e).startswith('No module named %s' % _modules[name]): raise return 0 | 33,788 |
def get(self, name, extension=None): ''' Interface to get a template, possibly loading a compiled template. | def get(self, name, extension=None): ''' Interface to get a template, possibly loading a compiled template. | 33,789 |
def history(self, direction='descending', dre=re.compile('\d+')): l = ['<table class="history">' '<tr><th colspan="4" class="header">', _('History'), '</th></tr><tr>', _('<th>Date</th>'), _('<th>User</th>'), _('<th>Action</th>'), _('<th>Args</th>'), '</tr>'] current = {} comments = {} history = self._klass.history(self... | def history(self, direction='descending', dre=re.compile('\d+')): l = ['<table class="history">' '<tr><th colspan="4" class="header">', _('History'), '</th></tr><tr>', _('<th>Date</th>'), _('<th>User</th>'), _('<th>Action</th>'), _('<th>Args</th>'), '</tr>'] current = {} comments = {} history = self._klass.history(self... | 33,790 |
def history(self, direction='descending', dre=re.compile('\d+')): l = ['<table class="history">' '<tr><th colspan="4" class="header">', _('History'), '</th></tr><tr>', _('<th>Date</th>'), _('<th>User</th>'), _('<th>Action</th>'), _('<th>Args</th>'), '</tr>'] current = {} comments = {} history = self._klass.history(self... | def history(self, direction='descending', dre=re.compile('\d+')): l = ['<table class="history">' '<tr><th colspan="4" class="header">', _('History'), '</th></tr><tr>', _('<th>Date</th>'), _('<th>User</th>'), _('<th>Action</th>'), _('<th>Args</th>'), '</tr>'] current = {} comments = {} history = self._klass.history(self... | 33,791 |
def history(self, direction='descending', dre=re.compile('\d+')): l = ['<table class="history">' '<tr><th colspan="4" class="header">', _('History'), '</th></tr><tr>', _('<th>Date</th>'), _('<th>User</th>'), _('<th>Action</th>'), _('<th>Args</th>'), '</tr>'] current = {} comments = {} history = self._klass.history(self... | def history(self, direction='descending', dre=re.compile('\d+')): l = ['<table class="history">' '<tr><th colspan="4" class="header">', _('History'), '</th></tr><tr>', _('<th>Date</th>'), _('<th>User</th>'), _('<th>Action</th>'), _('<th>Args</th>'), '</tr>'] current = {} comments = {} history = self._klass.history(self... | 33,792 |
def history(self, direction='descending', dre=re.compile('\d+')): l = ['<table class="history">' '<tr><th colspan="4" class="header">', _('History'), '</th></tr><tr>', _('<th>Date</th>'), _('<th>User</th>'), _('<th>Action</th>'), _('<th>Args</th>'), '</tr>'] current = {} comments = {} history = self._klass.history(self... | def history(self, direction='descending', dre=re.compile('\d+')): l = ['<table class="history">' '<tr><th colspan="4" class="header">', _('History'), '</th></tr><tr>', _('<th>Date</th>'), _('<th>User</th>'), _('<th>Action</th>'), _('<th>Args</th>'), '</tr>'] current = {} comments = {} history = self._klass.history(self... | 33,793 |
def history(self, direction='descending', dre=re.compile('\d+')): l = ['<table class="history">' '<tr><th colspan="4" class="header">', _('History'), '</th></tr><tr>', _('<th>Date</th>'), _('<th>User</th>'), _('<th>Action</th>'), _('<th>Args</th>'), '</tr>'] current = {} comments = {} history = self._klass.history(self... | def history(self, direction='descending', dre=re.compile('\d+')): l = ['<table class="history">' '<tr><th colspan="4" class="header">', _('History'), '</th></tr><tr>', _('<th>Date</th>'), _('<th>User</th>'), _('<th>Action</th>'), _('<th>Args</th>'), '</tr>'] current = {} comments = {} history = self._klass.history(self... | 33,794 |
def history(self, direction='descending', dre=re.compile('\d+')): l = ['<table class="history">' '<tr><th colspan="4" class="header">', _('History'), '</th></tr><tr>', _('<th>Date</th>'), _('<th>User</th>'), _('<th>Action</th>'), _('<th>Args</th>'), '</tr>'] current = {} comments = {} history = self._klass.history(self... | def history(self, direction='descending', dre=re.compile('\d+')): l = ['<table class="history">' '<tr><th colspan="4" class="header">', _('History'), '</th></tr><tr>', _('<th>Date</th>'), _('<th>User</th>'), _('<th>Action</th>'), _('<th>Args</th>'), '</tr>'] current = {} comments = {} history = self._klass.history(self... | 33,795 |
def history(self, direction='descending', dre=re.compile('\d+')): l = ['<table class="history">' '<tr><th colspan="4" class="header">', _('History'), '</th></tr><tr>', _('<th>Date</th>'), _('<th>User</th>'), _('<th>Action</th>'), _('<th>Args</th>'), '</tr>'] current = {} comments = {} history = self._klass.history(self... | def history(self, direction='descending', dre=re.compile('\d+')): l = ['<table class="history">' '<tr><th colspan="4" class="header">', _('History'), '</th></tr><tr>', _('<th>Date</th>'), _('<th>User</th>'), _('<th>Action</th>'), _('<th>Args</th>'), '</tr>'] current = {} comments = {} history = self._klass.history(self... | 33,796 |
def history(self, direction='descending', dre=re.compile('\d+')): l = ['<table class="history">' '<tr><th colspan="4" class="header">', _('History'), '</th></tr><tr>', _('<th>Date</th>'), _('<th>User</th>'), _('<th>Action</th>'), _('<th>Args</th>'), '</tr>'] current = {} comments = {} history = self._klass.history(self... | def history(self, direction='descending', dre=re.compile('\d+')): l = ['<table class="history">' '<tr><th colspan="4" class="header">', _('History'), '</th></tr><tr>', _('<th>Date</th>'), _('<th>User</th>'), _('<th>Action</th>'), _('<th>Args</th>'), '</tr>'] current = {} comments = {} history = self._klass.history(self... | 33,797 |
def submit(self, label="Submit Changes"): """Generate a submit button. | def submit(self, label="Submit Changes"): """Generate a submit button. | 33,798 |
def plain(self): ''' Render a "plain" representation of the property ''' self.view_check() | def plain(self): ''' Render a "plain" representation of the property ''' self.view_check() | 33,799 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.