Skip to content

Instantly share code, notes, and snippets.

function exportAll() {
if (getFormIdFromStore()) {
window.open('/image_set/' + get_asset_set_id() + '/assets.xls?form_id=' + getFormIdFromStore(), 'Excel Download', 'width=300, height=200');
} else {
window.open('/image_set/' + get_asset_set_id() + '/assets.xls', 'Excel Download', 'width=300, height=200');
}
}
var fp = new Ext.FormPanel({
fileUpload: true,
function exportAll() {
if (getFormIdFromStore()) {
window.open('/image_set/' + get_asset_set_id() + '/assets.xls?form_id=' + getFormIdFromStore(), 'Excel Download', 'width=300, height=200');
} else {
window.open('/image_set/' + get_asset_set_id() + '/assets.xls', 'Excel Download', 'width=300, height=200');
}
}
var fp = new Ext.FormPanel({
fileUpload: true,
@veriojon
veriojon / gist:671008
Created November 10, 2010 15:42
excel import js
var ExcelErrorDialog = Ext.extend(Ext.Window, {
constructor: function(config) {
this.importForm = new Ext.FormPanel({
frame: true,
bodyStyle: 'padding: 10px 10px 0 10px;',
labelWidth: 50,
defaults: { anchor: '95%', allowBlank: false, msgTarget: 'side'},
items: [{
xtype: 'displayfield',
itemID: 'filename',
Imata.log(a.result)
Imata.log(a.result.allerror)
for (r in a.result.allerror) {
if (!Ext.isFunction(r)) {
Imata.log('r:' + r);
for (e in a.result.allerror[r]) {
if (!Ext.isFunction(e)) {
Imata.log('e:' + e);
Imata.log('msg:' + a.result.allerror[r][e].msg);
}
@veriojon
veriojon / gist:671567
Created November 10, 2010 21:35
new dialog
var ExcelErrorDialog = Ext.extend(Ext.Window, {
constructor: function(config) {
this.importerrorForm = new Ext.FormPanel({
frame: true,
bodyStyle: 'padding: 10px 10px 0 10px;',
labelWidth: 50,
defaults: { anchor: '95%', allowBlank: false, msgTarget: 'side'},
items: [{
xtype: 'displayfield',
itemID: 'numerrors',
Error
Traceback (most recent call last):
File "/Users/jon/Env/lib/python2.6/unittest.py", line 270, in run
self.setUp()
File "test_excel.py", line 19, in setUp
self.data.setup()
File "/Users/jon/Env/lib/python2.6/site-packages/fixture-1.4-py2.6.egg/fixture/base.py", line 71, in setup
self.loader.load(self.data)
File "/Users/jon/Env/lib/python2.6/site-packages/fixture-1.4-py2.6.egg/fixture/loadable/loadable.py", line 193, in load
self.wrap_in_transaction(loader, unloading=False)
@veriojon
veriojon / gist:673129
Created November 11, 2010 20:31
basic class with some tests
class memCache(object):
def __init__(self):
self.cache_dict = dict()
def get(self,key):
try:
value = self.cache_dict[key]
return value
except:
@veriojon
veriojon / gist:674700
Created November 12, 2010 21:16
building the tests
from sharedshelf.tests import *
from sharedshelf.lib import imatacache
class TestImataCache(TestCase):
def setUp(self):
super(TestImataCache, self).setUp()
self.data.setup()
def tearDown(self):
@veriojon
veriojon / gist:703586
Created November 17, 2010 16:22
hudson error
Started by user anonymous
Checkout:workspace / /Users/jon/.hudson/jobs/Test Imata/workspace - hudson.remoting.LocalChannel@591c5342
Using strategy: Default
Last Built Revision: Revision 1b127fc6593990fca813074d4611eead04c71ced (origin/master)
Checkout:workspace / /Users/jon/.hudson/jobs/Test Imata/workspace - hudson.remoting.LocalChannel@591c5342
GitAPI created
Fetching changes from the remote Git repository
Fetching upstream changes from git@testbed2:imata.git
[workspace] $ git fetch -t git@testbed2:imata.git +refs/heads/*:refs/remotes/origin/*
ERROR: Problem fetching from origin / origin - could be unavailable. Continuing anyway
def export_records(field_definitions, records):
stream = cStringIO.StringIO()
try:
workbook = Workbook()
sheet = workbook.add_sheet('Exported Records')
#admin = workbook.add_sheet('Metadata')
# write_metadata()
write_header(sheet, field_definitions)
for row, record in enumerate(records):
sheet.write(row+1, 0, record.id)