rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
id = 'ScreenGroup_%s' % uuid.uuid1()
id = 'ScreenGroup %s' % uuid.uuid1() else: id = 'ScreenGroup %s' % id
def getScreenGroup(self, id): if id is None: # generate new id id = 'ScreenGroup_%s' % uuid.uuid1()
if other.color:
if other.color and other.color != (255, 255, 255):
def copyAttributes(self, other): if other.xy: self.xy = other.xy if other.label and other.id != other.label: self.label = other.label if other.color: self.color = other.color if other.style: self.style = other.style if other.numbered: self.numbered = other.numbered if other.background: self.background = other.backgroun...
if other.dir:
if other.dir and other.dir != 'forward':
def copyAttributes(self, other): if other.label: self.label = other.label if other.dir: self.dir = other.dir if other.color: self.color = other.color if other.style: self.style = other.style if other.noweight: self.noweight = other.noweight
if dir in ('left-up', 'left', 'right-up', 'right', 'right-down'):
if dir in ('left-up', 'left', 'same', 'right-up', 'right', 'right-down'):
def heads(self): heads = [] dir = self.direction()
elif dir in ('left-up', 'left', 'left-down', 'down'):
elif dir in ('left-up', 'left', 'left-down', 'down', 'same'):
def heads(self): heads = [] dir = self.direction()
elif dir in ('left-up', 'left'):
elif dir in ('left-up', 'left', 'same'):
def shaft(self): span = XY(self.metrix.spanWidth, self.metrix.spanHeight) dir = self.direction()
System.setProperty('gov.nasa.jpl.oodt.cas.filemgr.catalog.lucene.idxPath', config.get('index', 'path')) System.setProperty('gov.nasa.jpl.oodt.cas.filemgr.catalog.lucene.pageSize', config.get('index', 'pageSize')) System.setProperty('gov.nasa.jpl.oodt.cas.filemgr.repositorymgr.dirs', config.get('policies', 'repo')) Syst...
System.setProperty('org.apache.oodt.cas.filemgr.catalog.lucene.idxPath', config.get('index', 'path')) System.setProperty('org.apache.oodt.cas.filemgr.catalog.lucene.pageSize', config.get('index', 'pageSize')) System.setProperty('org.apache.oodt.cas.filemgr.repositorymgr.dirs', config.get('policies', 'repo')) System.set...
def _setJavaProperties(config): '''Set Java-based properties. The Java-based cas expects a whole bunch of system properties to be set, sort of like global variables. Woot! Global variables! ''' from java.lang import System System.setProperty('gov.nasa.jpl.oodt.cas.filemgr.catalog.lucene.idxPath', config.get('index',...
dll = re.sub(r'^\s*DLL Name:\s+([a-zA-Z_\-0-9\.]+).*$', r'\1', line)
dll = re.sub(r'^\s*DLL Name:\s+([a-zA-Z_\-0-9\.\+]+).*$', r'\1', line)
def finddlls(program, extrapaths = []): '''Check program for required DLLs. Find all required DLLs except ignored ones and return a list of DLL filenames (including path).''' # ask objdump about dependencies. output = subprocess.Popen(["objdump", "-x", program], stdout=subprocess.PIPE) cmdout = output.communicate() # ...
def lookup(self, file, remote=None):
def lookup(self, file, remotenames=None):
def lookup(self, file, remote=None):
if (name in remote) or (remote is None and name != self.name):
if (remotenames is None and name != self.name) or name in remotenames:
def lookup(self, file, remote=None):
>>> from numpy import array
def calculateConsistency(arr): """Given pairwise comparisons array, calculate consistency ratio (CR) for the comparisons. Example: >>> arr = array([ [1, 1./3, 1./9, 1./5], [3,1,1,1], [9,1,1,3], [5,1,1./3,1] ]) >>> print calculateConsistency(arr) 0.0557579272574 """ # get largest (ie. primary) eigenvalue eva = max(e...
import os
def foo(bar): return 'baz'
path = os.path.join(from_template.name, name)
path = from_template.name + '\\' + name
def get_file_template(name, from_template): path = os.path.join(from_template.name, name) return from_template.__class__.from_filename( path, namespace=from_template.namespace, get_template=from_template.get_template)
for xml_file in faust.xml_files()[:300]:
for xml_file in faust.xml_files():
def validate(last=False): """Validates the content of the queue by calling Jing and parsing its output""" global validation_queue if not last and len(validation_queue) < validation_queue_max_length: return validation = subprocess.Popen(shlex.split(validation_command) + validation_queue, stdout=subprocess.PIPE, stderr=...
logging.error("Expected SCRIPT_NAME %s - got %s" % (SCRIPT_NAME, environ['SCRIPT_NAME'])) logging.error("Expected PATH_INFO %s - got %s" % (PATH_INFO, environ['PATH_INFO']))
logging.error("Expected SCRIPT_NAME %s - got %s" % (SCRIPT_NAME, environ.get('SCRIPT_NAME',"** Missing ***"))) logging.error("Expected PATH_INFO %s - got %s" % (PATH_INFO, environ.get('PATH_INFO',"** Missing **")))
def _(environ, start_response): val = True if SCRIPT_NAME is not None: val = val and environ['SCRIPT_NAME'] == SCRIPT_NAME val = val and environ['PATH_INFO'] == PATH_INFO if not val: logging.error("Expected SCRIPT_NAME %s - got %s" % (SCRIPT_NAME, environ['SCRIPT_NAME'])) logging.error("Expected PATH_INFO %s - got %s"...
print(dir()) if '__file__' in dir() and os.path.isfile(os.path.join(os.path.split(__file__)[0],'static','favicon.ico')): command_options['static_content_path'] = os.path.join(os.path.split(__file__)[0],'static')
if sys.path[0] and os.path.isfile(os.path.join(sys.path[0],'static','favicon.ico')): command_options['static_content_path'] = os.path.join(sys.path[0],'static')
def run_with_command_line_input(): _help = r'''
''' % (command_options['port'], os.path.abspath(command_options['content_path']), _s, example_URI,example_URI)
''' % (command_options['port'], os.path.abspath(command_options['content_path']), _s, example_URI)
def run_with_command_line_input(): _help = r'''
s.bind(('',8888))
s.bind(('',0))
def assisted_start(options): _help = r'''
httpd = wsgiserver.CherryPyWSGIServer(('127.0.0.1',int(options['port'])),app)
httpd = wsgiserver.CherryPyWSGIServer(('0.0.0.0',int(options['port'])),app)
def assisted_start(options): _help = r'''
except PathBoundsError: return self.canned_handlers(environ, start_response, '501')
except: return self.canned_handlers(environ, start_response, '404')
def __call__(self, environ, start_response): selector_matches = (environ.get('wsgiorg.routing_args') or ([],{}))[1] if 'working_path' in selector_matches: # working_path is a custom key that I just happened to decide to use # for marking the portion of the URI that is palatable for static serving. # 'working_path' is t...
def _start_response(self, *args, **kw): pass
def _start_response(self, code, headers): if not code == "200 OK": raise Exception('RPC call returned HTTP error: %s' % code)
def _start_response(self, *args, **kw): pass
install('nt_svcutils', test)
if sys.platform[:3].lower() == "win": install('nt_svcutils', test)
def setUp(test): buildoutSetUp(test) install_develop('plone.recipe.zeoserver', test) install('zc.recipe.egg', test) install('nt_svcutils', test) install('zope.mkzeoinstance', test) install('ZopeUndo', test) dependencies = pkg_resources.working_set.require('ZODB3') for dep in dependencies: try: install(dep.project_name,...
arguments_info += ("import getopt; opts = getopt.getopt(" "sys.argv[1:], 'S:B:W1')[0];\nstorage = " "opts and opts[0][1] or '1'\nblob_dir = " "opts and opts[1][1] or blob_dir")
arguments_info += ("import getopt; opts = " "getopt.getopt(sys.argv[1:], 'S:B:W1')[0];\n" "opts = dict(opts)\n" "storage = opts.has_key('-S') and " "opts['-S'] or '1'\n" "blob_dir = opts.has_key('-B') and " "opts['-B'] or blob_dir")
def install_scripts(self): options = self.options location = options['location']
project.set_tool_data('sfx', 'unix_group_name', new_unix_group_name)
project.set_tool_data('sfx', unix_group_name=new_unix_group_name)
def restore_project(dirname, new_shortname, new_unix_group_name): log.info('Reloading %s into %s', dirname, new_shortname) with open(os.path.join(dirname, 'project.json')) as fp: project_doc = json.load(fp, object_hook=object_hook) project = M.Project.query.get(_id=project_doc['_id']) st = state(project) st.document = ...
summary = FieldProperty(str)
summary = FieldProperty(str, required=True)
def index(self): result = Snapshot.index(self) result.update( title_s='Version %d of %s' % ( self.version,self.original().summary), type_s='Ticket Snapshot', text=self.data.summary) return result
return str(self.summary)
return self.summary
def shorthand_id(self): return str(self.summary)
g.solr.delete('project_id_s:%s AND mount_point_s:%s' % (
g.solr.delete(q='project_id_s:"%s" AND mount_point_s:"%s"' % (
def uninstall(self, project=None, project_id=None): 'Whatever logic is required to tear down a tool' if project_id is None: project_id = project._id # De-index all the artifacts belonging to this tool in one fell swoop g.solr.delete('project_id_s:%s AND mount_point_s:%s' % ( project_id, self.config.options['mount_point...
prefix_len = len(to_project_name+'/') in_use = [sp.shortname[prefix_len:] for sp in to_project.direct_subprojects] in_use += [ac.options['mount_point'] for ac in to_project.app_configs]
if to_project is None: in_use = [] to_project_name = '' else: prefix_len = len(to_project_name+'/') in_use = [sp.shortname[prefix_len:] for sp in to_project.direct_subprojects] in_use += [ac.options['mount_point'] for ac in to_project.app_configs]
def fork(self, to_name=None, project_name=None): security.require_authenticated() if not c.app.forkable: raise exc.HTTPNotFound from_repo = c.app.repo if project_name: to_project_name = project_name else: to_project_name = 'u/' + c.user.username ThreadLocalORMSession.flush_all() ThreadLocalORMSession.close_all() from_p...
return super(M.AuthPlugin, self).authenticate_request()
return super(M.AuthenticationProvider, self).authenticate_request()
def authenticate_request(self): cookie_name = self.sfx_session_manager.cookie_name mgr = self.sfx_session_manager if 'userid' in self.session: if cookie_name not in self.request.cookies: self.logout() return M.User.anonymous() elif self.request.cookies[cookie_name] == self.session.get('sfx-sessid'): # already logged in...
assert 'User "Test Me" registered' in r
assert 'User "Test Me" registered' in unentity(r.body)
def test_create_account(self): r = self.app.get('/auth/create_account') assert 'Create an Account' in r r = self.app.post('/auth/save_new', params=dict(username='aaa',password='123')) r = r.follow() assert 'Password must be at least 8 characters.' in r r = self.app.post('/auth/save_new', params=dict(username='aaa', pas...
ew.ResourceManager.configure(compress=not asbool(global_conf['debug']))
ew.ResourceManager.configure(compress=False)
def make_app(global_conf, full_stack=True, **app_conf): """ Set pyforge up with the settings found in the PasteDeploy configuration file used. :param global_conf: The global settings for pyforge (those defined under the ``[DEFAULT]`` section). :type global_conf: dict :param full_stack: Should the whole TG2 stack be se...
assert req.html.find('select',{'name':'limit'}).find('option',{'selected':'selected'}).string == '250'
assert index_view.html.find('select',{'name':'limit'}).find('option',{'selected':'selected'}).string == '250'
def test_render_index(self): index_view = self.app.get('/bugs/') assert req.html.find('select',{'name':'limit'}).find('option',{'selected':'selected'}).string == '250'
assert '<p><strong>status</strong>: aa --&gt; ccc' in ticket_view
assert '<li><strong>status</strong>: aa --&gt; ccc' in ticket_view
def test_milestone_names(self): self.app.post('/admin/bugs/set_custom_fields', { 'milestone_names': 'aaa bbb ccc', 'status_names': 'aa bb cc', 'custom_fields': {} }) self.new_ticket(summary='test milestone names') self.app.post('/bugs/1/update_ticket',{ 'summary':'zzz', 'description':'bbb', 'status':'ccc', 'milestone':...
yield onready(''' markdownSettings.previewParserPath = "/nf/markdown_to_html?project=%s"+ "&app=%s";
yield onready('''markdownSettings.previewParserPath = "/nf/markdown_to_html?"+ $.param({project:'%s', app:'%s'});
def resources(self): yield ew.resource.JSLink('js/jquery.markitup.pack.js') yield ew.resource.JSLink('js/jquery.markitup.markdown.js') yield ew.resource.JSLink('js/sf_markitup.js') yield ew.resource.CSSLink('css/markitup.css', compress=False) yield ew.resource.CSSLink('css/markitup_markdown.css', compress=False) yield ...
globals = model.Globals.query.get(app_config_id=c.app.config._id)
globals = model.Globals.query.get(app_config_id=self.app.config._id)
def index(self): globals = model.Globals.query.get(app_config_id=c.app.config._id) return dict(app=self.app, globals=globals)
self.page.labels = labels.split(',')
if len(labels): self.page.labels = labels.split(',') else: self.page.labels = []
def update(self, title=None, text=None, tags=None, tags_old=None, labels=None, labels_old=None, viewable_by=None,new_viewable_by=None,**kw): require(has_artifact_access('edit', self.page)) if tags: tags = tags.split(',') else: tags = [] ws = re.compile('\s+') new_title = ''.join(ws.split(title)) if self.page.title != n...
except ValueError:
except:
def latest(self, branch='master'): if self._impl is None: return None try: return self.CommitClass.from_repo_object(self._impl.commit(rev=branch), self) except ValueError: return None
assert 'You are currently subscribed' in ticket_view
assert 'class="artifact_unsubscribe' in ticket_view
def test_new_ticket(self): summary = 'test new ticket' ticket_view = self.new_ticket(summary=summary) assert_true(summary in ticket_view) assert 'You are currently subscribed' in ticket_view
self.ormsession.delete(
self.ormsession.remove(
def up(self): if self.session.db.name == 'allura': self.ormsession.delete( M.Mailbox, {'type':'flash'})
yield excerpt(esc(t1,i1,i2))
yield esc(excerpt(t1,i1,i2))
def excerpt(text, a, b): if b-a > 1000: return text[a:a+400] + '...' + text[b-400:b] else: return text[a:b]
'labels':'yellow,green',
'labels-0':'yellow', 'labels-1':'green',
def test_ticket_label_unlabel(self): summary = 'test labeling and unlabeling a ticket' self.new_ticket(summary=summary) self.app.post('/bugs/1/update_ticket',{ 'summary':'aaa', 'description':'bbb', 'status':'ccc', '_milestone':'', 'assigned_to':'', 'labels':'yellow,green', 'labels_old':'yellow,green', 'comment': '' }) ...
'labels':'yellow',
'labels-0':'yellow',
def test_ticket_label_unlabel(self): summary = 'test labeling and unlabeling a ticket' self.new_ticket(summary=summary) self.app.post('/bugs/1/update_ticket',{ 'summary':'aaa', 'description':'bbb', 'status':'ccc', '_milestone':'', 'assigned_to':'', 'labels':'yellow,green', 'labels_old':'yellow,green', 'comment': '' }) ...
require(has_artifact_access('admin', app=self.app), 'Admin access required')
require(has_artifact_access('configure', app=self.app), 'Requires permission to "configure"')
def _check_security(self): require(has_artifact_access('admin', app=self.app), 'Admin access required')
self.app.post('/Tickets/save_ticket', params=dict( ticket_num='', tags='', summary='This is a ticket', status='open', description='This is a description'))
r = self.app.post( '/Tickets/save_ticket', params=variable_encode(dict( ticket_form=dict( ticket_num='', tags='', assigned_to='', milestone='', summary='This is a ticket', status='open', description='This is a description'))), status=302)
def setUp(self): TestController.setUp(self) self.app.get('/Wiki/') self.app.get('/Tickets/') self.app.post('/Tickets/save_ticket', params=dict( ticket_num='', tags='', summary='This is a ticket', status='open', description='This is a description'))
url = self.neighborhood.url_prefix + self.shortname + '/'
shortname = self.shortname[len(self.neighborhood.shortname_prefix):] url = self.neighborhood.url_prefix + shortname + '/'
def url(self): url = self.neighborhood.url_prefix + self.shortname + '/' if url.startswith('//'): try: return request.scheme + ':' + url except TypeError: # pragma no cover return 'http:' + url else: return url
log.info('HI! I am publishing!')
def publish(self, xn, key, message=None, **kw): project = getattr(c, 'project', None) app = getattr(c, 'app', None) log.info('HI! I am publishing!') if message is None: message = {} if project: message.setdefault('project_id', project._id) if app: message.setdefault('mount_point', app.config.options.mount_point) if has...
yield ProjectRole.query.get(name='*anonymous') if self._id: yield ProjectRole.query.get(name='*authenticated')
anon_role = ProjectRole.query.get(name='*anonymous') auth_role = ProjectRole.query.get(name='*authenticated') if anon_role: yield anon_role if self._id and auth_role: yield auth_role
def role_iter(self): yield ProjectRole.query.get(name='*anonymous') if self._id: yield ProjectRole.query.get(name='*authenticated') if self._id: pr = self.project_role() for role in pr.role_iter(): yield role
else: count = 0
def log(self, limit=None, page=0, count=0, **kw): limit, page, start = g.handle_paging(limit, page) revisions = c.app.repo.log( branch=self._branch, offset=start, limit=limit) c.log_widget = self.log_widget if self._branch is None: if c.app.repo.heads: count = c.app.repo.heads[0].count else: count = 0 else: count = sel...
count = self._branch.count
for branch in c.app.repo.branches: if branch['name'] == self._branch: count = branch['count'] break
def log(self, limit=None, page=0, count=0, **kw): limit, page, start = g.handle_paging(limit, page) revisions = c.app.repo.log( branch=self._branch, offset=start, limit=limit) c.log_widget = self.log_widget if self._branch is None: if c.app.repo.heads: count = c.app.repo.heads[0].count else: count = 0 else: count = sel...
if labels[0] != '[': return
if not labels or labels[0] != '[': return
def restore_labels(obj, test=True): if not obj.labels: return labels = obj.labels while True: if labels[0] != '[': return lbllen = map(len, labels) if max(lbllen) != 1: return if min(lbllen) != 1: return s = ''.join(labels) s = s.replace("u'", "'") s = s.replace('u"', '"') jobj = '{"obj":' + s.replace("'", '"') + '}' t...
description = diff
description = '<pre>' + diff + '</pre>'
def commit(self): self.subscribe() VersionedArtifact.commit(self) if self.version > 1: v1 = self.get_version(self.version-1) v2 = self la = [ line + '\n' for line in v1.text.splitlines() ] lb = [ line + '\n' for line in v2.text.splitlines() ] diff = ''.join(patience.unified_diff( la, lb, 'v%d' % v1.version, 'v%d' % v...
encoding = chardet.detect(s[:1024])['encoding'] try: if encoding: return unicode(s, encoding) except UnicodeDecodeError: pass encoding = chardet.detect(s)['encoding'] try: if encoding: return unicode(s, encoding) except UnicodeDecodeError: pass
encodings = [ lambda:'utf-8', lambda:'latin-1', lambda:chardet.detect(s[:1024])['encoding'], lambda:chardet.detect(s)['encoding'] ] for enc in encodings: try: return unicode(s, enc()) except UnicodeDecodeError: pass
def really_unicode(s): try: return unicode(s) except UnicodeDecodeError: pass encoding = chardet.detect(s[:1024])['encoding'] try: if encoding: return unicode(s, encoding) except UnicodeDecodeError: pass encoding = chardet.detect(s)['encoding'] try: if encoding: return unicode(s, encoding) except UnicodeDecodeError: pa...
rex = re.compile(un)
rex = re.compile('^' + un + '$')
def by_username(self, username): from pyforge import model as M un = re.escape(username) un = un.replace(r'\_', '[-_]') rex = re.compile(un) return M.User.query.get(username=rex)
def overview(self):
def overview(self, **kw):
def overview(self): c.markdown_editor = W.markdown_editor c.label_edit = W.label_edit categories = M.ProjectCategory.query.find(dict(parent_id=None)).sort('label').all() return dict(categories=categories)
def tools(self):
def tools(self, **kw):
def tools(self): tools = [ (ep.name, ep.load()) for ep in pkg_resources.iter_entry_points('pyforge') ] installable_tools = [ dict(name=name, app=app) for (name, app) in tools if app.installable ] installable_tools = sorted(installable_tools, key=lambda tool: tool['app'].ordinal) c.markdown_editor = W.markdown_editor c....
def perms(self):
def perms(self, **kw):
def perms(self): """Simplfied permission management screen for the project""" c.user_select = ffw.ProjectUserSelect() return dict()
result = cls(id=ci.sha, repo=repo)
result = cls(id=ci.hexsha, repo=repo)
def from_repo_object(cls, ci, repo): result = cls(id=ci.sha, repo=repo) result.__dict__['_impl'] = ci return result
for d in self.parents[0].diff(self.sha):
for d in self.parents[0].diff(self.hexsha):
def diff_summarize(self): if self.parents: for d in self.parents[0].diff(self.sha): if d.deleted_file: yield 'remove', d.a_blob.path elif d.new_file: yield 'add', d.b_blob.path else: yield 'change', d.a_blob.path else: for x in self.tree().ls(): yield 'add', x['href']
return self._blob.data
return self._blob.data_stream.read()
def text(self): return self._blob.data
if ent.sha == self._commit.sha:
if ent.hexsha == self._commit.hexsha:
def context(self): path = self._tree.path().split('/')[1:-1] result = dict(prev=None, next=None) entries = self._repo._log( paths=self._blob.path) prev=next=None found_ci = False for ent in entries: if ent.sha == self._commit.sha: found_ci = True elif found_ci: prev=ent break elif not len(ent.context()['next']) or ent....
assert len(cat_links) == 3
assert len(cat_links) == 4
def test_index(self): response = self.app.get('/') assert response.html.find('h1',{'class':'title'}).string == 'All Projects' projects = response.html.findAll('div',{'class':'border card'}) assert len(projects) == 7, len(projects) assert projects[0].find('a').get('href') == '/adobe/adobe-1/' assert projects[0].find('im...
if(thread_reply){
if(thread_reply.length){
def resources(self): for r in super(Thread, self).resources(): yield r for w in self.widgets.itervalues(): for r in w.resources(): yield r yield ew.JSScript(''' $(document).ready(function(){ var thread_reply = $('a.sidebar_thread_reply'); var thread_tag = $('a.sidebar_thread_tag'); var thread_spam = $('a.sidebar_thread...
if(thread_tag){
if(thread_tag.length){
def resources(self): for r in super(Thread, self).resources(): yield r for w in self.widgets.itervalues(): for r in w.resources(): yield r yield ew.JSScript(''' $(document).ready(function(){ var thread_reply = $('a.sidebar_thread_reply'); var thread_tag = $('a.sidebar_thread_tag'); var thread_spam = $('a.sidebar_thread...
if(thread_spam){
if(thread_spam.length){
def resources(self): for r in super(Thread, self).resources(): yield r for w in self.widgets.itervalues(): for r in w.resources(): yield r yield ew.JSScript(''' $(document).ready(function(){ var thread_reply = $('a.sidebar_thread_reply'); var thread_tag = $('a.sidebar_thread_tag'); var thread_spam = $('a.sidebar_thread...
prefix = config.get('forgemail.host', 'https://sourceforge.net')
prefix = config.get('forgemail.url', 'https://sourceforge.net')
def footer(self): prefix = config.get('forgemail.host', 'https://sourceforge.net') return '''
if neighborhood.url_prefix == 'p':
if neighborhood.url_prefix == '/p/':
def _unix_group_name(self, neighborhood, shortname): if neighborhood.url_prefix == 'p': path = shortname else: path = neighborhood.url_prefix + shortname[len(neighborhood.shortname_prefix):] parts = [ p for p in path.split('/') if p ] return '.'.join(reversed(parts))
projects = M.Project.query.find(q_project).all() for p in projects:
all_projects = M.Project.query.find(q_project).all() for p in all_projects:
def main(): parser = optparse.OptionParser() parser.add_option( '--clean', action='store_true', dest='clean', default=False, help='remove all RepoObjects before refresh') parser.add_option( '--all', action='store_true', dest='all', default=False, help='refresh all commits (not just the ones that are new') options, args...
project_id = os.path.normpath( os.path.join('/' + c.project.shortname, project_id))
if c.project: project_id = os.path.normpath( os.path.join('/' + c.project.shortname, project_id)) else: project_id = '/' + project_id
def lookup(cls, link): from .project import Project # # Parse the link syntax # m = cls.re_link_1.match(link) if m is None: m = cls.re_link_2.match(link) if m is None: return None groups = m.groupdict() project_id = groups.get('project_id', None) app_id = groups.get('app_id', None) artifact_id = groups.get('artifact_id...
neighborhood, shortname, user_project)
neighborhood, shortname, user, user_project)
def register_project(self, neighborhood, shortname, user, user_project): # Reserve project name with SFX r = self.api.create(neighborhood, shortname) log.info('SFX Project creation returned: %s', r) p = super(SFXProjectRegistrationProvider, self).register_project( neighborhood, shortname, user_project) return p
assert response.html.find('input', {'name': 'summary'})
assert response.html.find('textarea', {'name': 'summary'})
def test_ticket_view_editable(self): summary = 'test ticket view page can be edited' self.new_ticket(summary=summary) response = self.app.get('/p/test/bugs/1/') assert response.html.find('input', {'name': 'summary'}) assert response.html.find('input', {'name': 'assigned_to'}) assert response.html.find('textarea', {'nam...
assert error_message.findPreviousSibling('input').get('name') == 'ticket_form.summary'
assert error_message.findPreviousSibling('textarea').get('name') == 'ticket_form.summary'
def test_new_ticket_validation(self): summary = 'ticket summary' response = self.app.get('/bugs/new/') assert not response.html.find('div', {'class':'error'}) form = response.forms[1] # try submitting with no summary set and check for error message error_form = form.submit() error_message = error_form.html.find('div', ...
assert success.find('input', {'name':'summary'}).get('value') == summary
assert success.find('textarea', {'name':'summary'}).string == summary
def test_new_ticket_validation(self): summary = 'ticket summary' response = self.app.get('/bugs/new/') assert not response.html.find('div', {'class':'error'}) form = response.forms[1] # try submitting with no summary set and check for error message error_form = form.submit() error_message = error_form.html.find('div', ...
assert response.html.find('input', {'name':'edit_ticket_form.summary'}).get('value') == old_summary
assert response.html.find('textarea', {'name':'edit_ticket_form.summary'}).string == old_summary
def test_edit_ticket_validation(self): old_summary = 'edit ticket test' new_summary = "new summary" self.new_ticket(summary=old_summary) response = self.app.get('/bugs/1/edit/') # check that existing form is valid assert response.html.find('input', {'name':'edit_ticket_form.summary'}).get('value') == old_summary assert...
assert error_message.findPreviousSibling('input').get('name') == 'edit_ticket_form.summary'
assert error_message.findPreviousSibling('textarea').get('name') == 'edit_ticket_form.summary'
def test_edit_ticket_validation(self): old_summary = 'edit ticket test' new_summary = "new summary" self.new_ticket(summary=old_summary) response = self.app.get('/bugs/1/edit/') # check that existing form is valid assert response.html.find('input', {'name':'edit_ticket_form.summary'}).get('value') == old_summary assert...
assert success.find('input', {'name':'summary'}).get('value') == new_summary
assert success.find('textarea', {'name':'summary'}).string == new_summary
def test_edit_ticket_validation(self): old_summary = 'edit ticket test' new_summary = "new summary" self.new_ticket(summary=old_summary) response = self.app.get('/bugs/1/edit/') # check that existing form is valid assert response.html.find('input', {'name':'edit_ticket_form.summary'}).get('value') == old_summary assert...
text=data['payload'],
text=data['payload'] or '--no text body--',
def message_auditor(self, routing_key, data, artifact, **kw): # Find ancestor comment in_reply_to = data.get('in_reply_to', []) if in_reply_to: parent_id = in_reply_to[0] else: parent_id = None thd = artifact.discussion_thread(data) # Handle attachments message_id = data['message_id'][0] if data.get('filename'): log.in...
if new.get('install'):
if new and new.get('install'):
def update_mounts(self, subproject=None, plugin=None, new=None, **kw): if subproject is None: subproject = [] if plugin is None: plugin = [] for sp in subproject: if sp.get('delete'): M.Project.query.get(shortname=sp['shortname']).delete() for p in plugin: if p.get('delete'): c.project.uninstall_app(p['mount_point']) i...
assert len(projects) == 3, len(projects)
assert len(projects) == 4, len(projects)
def test_index(self): response = self.app.get('/') assert response.html.find('h1',{'class':'title'}).string == 'All Projects' projects = response.html.findAll('div',{'class':'border card'}) assert len(projects) == 3, len(projects) assert projects[0].find('a').get('href') == '/adobe/adobe-1/' assert projects[0].find('im...
md.inlinePatterns['artifact_1'] = ArtifactLinkPattern('^' + self.core_artifact_link) md.inlinePatterns['artifact_2'] = ArtifactLinkPattern(r'\w' + self.core_artifact_link)
md.inlinePatterns['artifact'] = ArtifactLinkPattern(self.core_artifact_link)
def extendMarkdown(self, md, md_globals): md.treeprocessors['br'] = LineOrientedTreeProcessor() md.inlinePatterns['oembed'] = OEmbedPattern(r'\[embed#(.*?)\]') md.inlinePatterns['autolink_1'] = AutolinkPattern(r'(http(?:s?)://\S*)') md.inlinePatterns['artifact_1'] = ArtifactLinkPattern('^' + self.core_artifact_link) md...
url_handle = urllib2.urlopen(url, timeout=timeout) return json.load(url_handle)['User']
try: url_handle = urllib2.urlopen(url, timeout=timeout) return json.load(url_handle)['User'] except urllib2.HTTPError, ex: if ex.code == 404: return None raise
def user_data(self, username, timeout=2): """ given a sfnet hostname and userid, returns a dict of user data """ try: url = self._userid_api_url(int(username)) except ValueError: url = self._username_api_url(username) url_handle = urllib2.urlopen(url, timeout=timeout) return json.load(url_handle)['User']
user_data = self.user_data(username) u = M.User.query.get(username=username)
if u is not None and u.sfx_userid: user_data = self.user_data(u.sfx_userid) else: user_data = self.user_data(username)
def upsert_user(self, username, user_data=None): if user_data is None: user_data = self.user_data(username) u = M.User.query.get(username=username) if u is None: u = M.User( username=username, display_name=user_data['name'], sfx_userid=user_data['id']) n = M.Neighborhood.query.get(name='Users') n.register_project('u/' ...
postlaunch = '\n'.join(postlaunch)
prelaunch = '\n'.join(prelaunch)
def make_ticket_text(engineer): tag_prefix = date.today().strftime('release_%Y%m%d') # get release tag existing_tags_today = command('git tag -l %s*' % tag_prefix) if existing_tags_today: tag = '%s.%.2d' % (tag_prefix, len(existing_tags_today)) else: tag = tag_prefix last_release = command('git tag -l release_*') if la...
postlaunch = '-none-'
prelaunch = '-none-'
def make_ticket_text(engineer): tag_prefix = date.today().strftime('release_%Y%m%d') # get release tag existing_tags_today = command('git tag -l %s*' % tag_prefix) if existing_tags_today: tag = '%s.%.2d' % (tag_prefix, len(existing_tags_today)) else: tag = tag_prefix last_release = command('git tag -l release_*') if la...
assert success.findAll('form')[1].get('action') == '/p/test/bugs/1/update_ticket'
assert success.findAll('form')[0].get('action') == '/p/test/bugs/1/update_ticket'
def test_new_ticket_validation(self): summary = 'ticket summary' response = self.app.get('/bugs/new/') assert not response.html.find('div', {'class':'error'}) form = response.form # try submitting with no summary set and check for error message error_form = form.submit() error_message = error_form.html.find('div', {'cl...
assert success.findAll('form')[1].get('action') == '/p/test/bugs/1/update_ticket'
assert success.findAll('form')[0].get('action') == '/p/test/bugs/1/update_ticket'
def test_edit_ticket_validation(self): old_summary = 'edit ticket test' new_summary = "new summary" self.new_ticket(summary=old_summary) response = self.app.get('/bugs/1/edit/') # check that existing form is valid assert response.html.find('input', {'name':'ticket_form.summary'}).get('value') == old_summary assert not ...
user = util.identify_sender(data['peer'], data['mailfrom'], data['headers'], msg)
user = util.identify_sender(data['peer'], data['mailfrom'], msg['headers'], msg)
def received_email(routing_key, data): '''Route messages according to their destination: <topic>@<mount_point>.<subproj2>.<subproj1>.<project>.projects.sourceforge.net goes to the audit with routing ID <tool name>.mail.<topic> ''' msg = util.parse_message(data['data']) user = util.identify_sender(data['peer'], data['m...
'labels':'yellow,green',
'labels-0':'yellow', 'labels-1':'green',
def test_ticket_label_unlabel(self): summary = 'test labeling and unlabeling a ticket' self.new_ticket(summary=summary) self.app.post('/bugs/1/update_ticket',{ 'summary':'aaa', 'description':'bbb', 'status':'ccc', 'milestone':'', 'assigned_to':'', 'labels':'yellow,green', 'labels_old':'yellow,green' }) response = self....
'labels':'yellow',
'labels-0':'yellow',
def test_ticket_label_unlabel(self): summary = 'test labeling and unlabeling a ticket' self.new_ticket(summary=summary) self.app.post('/bugs/1/update_ticket',{ 'summary':'aaa', 'description':'bbb', 'status':'ccc', 'milestone':'', 'assigned_to':'', 'labels':'yellow,green', 'labels_old':'yellow,green' }) response = self....
def register_project(self, neighborhood, shortname, user_project):
def register_project(self, neighborhood, shortname, user, user_project):
def register_project(self, neighborhood, shortname, user_project): # Reserve project name with SFX r = self.api.create(neighborhood, shortname) log.info('SFX Project creation returned: %s', r) p = super(SFXProjectRegistrationProvider, self).register_project( neighborhood, shortname, user_project) return p
moderate_post = FW.ModeratePost()
moderate_post = DW.ModeratePost()
def validate(self, v, s): return v
subscriptions.append(dict( _id=subs._id, project_name=subs.project.name, mount_point=subs.app_config.options.mount_point, artifact_index_id=s.artifact_index_id, topic=s.topic, type=s.type, frequency=s.frequency.unit, artifact=s.artifact_index_id))
if subs.app_config: subscriptions.append(dict( _id=subs._id, project_name=subs.project.name, mount_point=subs.app_config.options.mount_point, artifact_index_id=s.artifact_index_id, topic=s.topic, type=s.type, frequency=s.frequency.unit, artifact=s.artifact_index_id))
def index(self): require_authenticated() c.form = F.subscription_form subscriptions = [] for subs in M.Subscriptions.query.find(dict(user_id=c.user._id)): for s in subs.subscriptions: with h.push_context(subs.project_id): subscriptions.append(dict( _id=subs._id, project_name=subs.project.name, mount_point=subs.app_conf...
bin = model.Bin()
bin = model.Bin(**post_data)
def save_bin(self, **post_data): require(has_artifact_access('write')) if request.method != 'POST': raise Exception('save_bin must be a POST request') bin = model.Bin() bin.app_config_id = c.app.config._id bin.custom_fields = dict() globals = model.Globals.query.get(app_config_id=c.app.config._id) for k,v in post_data....
for k,v in post_data.iteritems(): setattr(bin, k, v)
def save_bin(self, **post_data): require(has_artifact_access('write')) if request.method != 'POST': raise Exception('save_bin must be a POST request') bin = model.Bin() bin.app_config_id = c.app.config._id bin.custom_fields = dict() globals = model.Globals.query.get(app_config_id=c.app.config._id) for k,v in post_data....
api = SFXProjectApi() url='/downloads/' + api._unix_group_name(c.project.neighborhood, c.project.shortname) + '/'
url='/downloads/' + c.project.get_tool_data('sfx', 'unix_group_name') + '/'
def sitemap(self): menu_id = self.config.options.mount_point.title() api = SFXProjectApi() url='/downloads/' + api._unix_group_name(c.project.neighborhood, c.project.shortname) + '/' return [SitemapEntry(menu_id, url)[self.sidebar_menu()] ]
if not repo_path: return {"error":"no path specified"}
def permissions(self, repo_path=None, **kw): """Expects repo_path to be a filesystem path like <tool>/<project>.<neighborhood>/reponame[.git] unless the <neighborhood> is 'p', in which case it is <tool>/<project>/reponame[.git]
self.app.get('/tickets/')
self.app.get('/bugs/')
def setUp(self): TestController.setUp(self) self.app.get('/wiki/') self.app.get('/tickets/') r = self.app.post( '/tickets/save_ticket', params=variable_encode(dict( ticket_form=dict( ticket_num='', tags='', labels='', assigned_to='', milestone='', summary='This is a ticket', status='open', description='This is a descri...
'/tickets/save_ticket',
'/bugs/save_ticket',
def setUp(self): TestController.setUp(self) self.app.get('/wiki/') self.app.get('/tickets/') r = self.app.post( '/tickets/save_ticket', params=variable_encode(dict( ticket_form=dict( ticket_num='', tags='', labels='', assigned_to='', milestone='', summary='This is a ticket', status='open', description='This is a descri...
self.app.get('/tickets/feed.rss') self.app.get('/tickets/feed.atom')
self.app.get('/bugs/feed.rss') self.app.get('/bugs/feed.atom')
def test_ticket_list_feed(self): self.app.get('/tickets/feed.rss') self.app.get('/tickets/feed.atom')
print '*** Summary: Production Push (R:%s, D:%s)' % (
print '*** Summary: Production Push (R:%s, D:%s) - allura' % (
def main(): CP.read(os.path.join(os.environ['HOME'], '.forgepushrc')) engineer = option('re', 'engineer', 'Name of engineer pushing: ') text, tag = make_ticket_text(engineer) print '*** Create a ticket on SourceForge (https://sourceforge.net/p/allura/tickets/new/) with the following contents:' print '*** Summary: Produ...
if lc.id:
if lc['id']:
def prev_commit(self): lc = self.get_last_commit() if lc.id: last_commit = self.repo.commit(lc.id) if last_commit.parent_ids: return self.repo.commit(last_commit.parent_ids[0]) return None