No subject
Thu Oct 25 19:26:07 UTC 2012
ema to import from another CKAN as the data-objects are already in the righ=
t form.</div><div style=3D"color:rgb(34,34,34);font-size:13px;font-family:a=
rial,sans-serif">
<br></div><div style=3D"color:rgb(34,34,34);font-size:13px;font-family:aria=
l,sans-serif">Thanks!</div><div style=3D"color:rgb(34,34,34);font-size:13px=
;font-family:arial,sans-serif">
Michael</div><div style=3D"color:rgb(34,34,34);font-size:13px;font-family:a=
rial,sans-serif"><br></div></div></div><div style=3D"color:rgb(34,34,34);fo=
nt-size:13px;font-family:arial,sans-serif"><div><div class=3D"h5">
<div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0</div><div>class DgvatF=
orm(SingletonPlugin):</div><div>=C2=A0 =C2=A0 implements(IRoutes)</div><div=
>=C2=A0 =C2=A0 implements(IConfigurer)</div><div>=C2=A0 =C2=A0 implements(I=
GenshiStreamFilter)</div><div>=C2=A0 =C2=A0 implements(IDatasetForm)</div>
<div>=C2=A0 =C2=A0=C2=A0</div><div>=C2=A0 =C2=A0 log.fatal("Enter: %s&=
quot; % __name__)</div><div>=C2=A0 =C2=A0 def package_form(self):</div><div=
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 return 'package/datagvat_organization_form=
.html'</div><div>=C2=A0 =C2=A0=C2=A0</div><div>=C2=A0 =C2=A0=C2=A0</div=
><div>
=C2=A0 =C2=A0 def before_map(self, map):</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=
=A0 map.connect('/error/{action}', controller=3D'ckanext.dgvat_=
por.controllers.data_gv_at:DgvatErrorController')</div><div>=C2=A0 =C2=
=A0 =C2=A0 =C2=A0 map.connect('/error/{action}/{id}', controller=3D=
'ckanext.dgvat_por.controllers.data_gv_at:DgvatErrorController') =
=C2=A0 =C2=A0 =C2=A0 =C2=A0</div>
<div>=C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=
=A0 map.connect('/dataset/new', controller=3D'ckanext.dgvat_por=
.controllers.data_gv_at:DgvatPackageController', action=3D'new'=
)</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 map.connect('/dataset/edit/{id}=
', controller=3D'ckanext.dgvat_por.controllers.data_gv_at:DgvatPack=
ageController', action=3D'edit')</div>
<div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 map.connect('/dataset/{id}.{format}=
9;, controller=3D'ckanext.dgvat_por.controllers.data_gv_at:DgvatPackage=
Controller', action=3D'read')</div><div>=C2=A0 =C2=A0 =C2=A0 =
=C2=A0 map.connect('/dataset/{id}', controller=3D'ckanext.dgvat=
_por.controllers.data_gv_at:DgvatPackageController', action=3D'read=
')</div>
<div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 map.connect('/dataset/{id}/resource/{r=
esource_id}', controller=3D'ckanext.dgvat_por.controllers.data_gv_a=
t:DgvatPackageController', action=3D'resource_read')</div><div>=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 map.connect('/dataset/{id}/resource/{resour=
ce_id}/embed', controller=3D'ckanext.dgvat_por.controllers.data_gv_=
at:DgvatPackageController', action=3D'resource_embedded_dataviewer&=
#39;)</div>
<div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 map.connect('/dataset/editresources/{i=
d}', controller=3D'ckanext.dgvat_por.controllers.data_gv_at:DgvatPa=
ckageController', action=3D'editresources')</div><div>=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 map.connect('/user/edit/{id:.*}', controller=
=3D'ckanext.dgvat_por.controllers.dgvat_user:DgvatUserController', =
action=3D'edit')</div>
<div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 #m.connect('/user/reset/{id:.*}', =
action=3D'perform_reset')</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 map=
.connect('/user/register', controller=3D'ckanext.dgvat_por.cont=
rollers.dgvat_user:DgvatUserController', action=3D'register')</=
div>
<div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 map.connect('/user/login', control=
ler=3D'ckanext.dgvat_por.controllers.dgvat_user:DgvatUserController'=
;, action=3D'login')</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 map.conn=
ect('/user/_logout', '/user/logout', controller=3D'ckan=
ext.dgvat_por.controllers.dgvat_user:DgvatUserController', action=3D=
9;logout')</div>
<div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 map.connect('/user/logged_in', con=
troller=3D'ckanext.dgvat_por.controllers.dgvat_user:DgvatUserController=
', action=3D'logged_in')</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =
map.connect('/user/logged_out', controller=3D'ckanext.dgvat_por=
.controllers.dgvat_user:DgvatUserController', action=3D'logged_out&=
#39;)</div>
<div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 map.connect('/user/logged_out_redirect=
', controller=3D'ckanext.dgvat_por.controllers.dgvat_user:DgvatUser=
Controller', action=3D'logged_out_page')</div><div>=C2=A0 =C2=
=A0 =C2=A0 =C2=A0 #map.connect('/user/reset', action=3D'request=
_reset')</div>
<div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 #m.connect('/user/me', action=3D&#=
39;me')</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 map.connect('/user/se=
t_lang/{lang}', controller=3D'ckanext.dgvat_por.controllers.dgvat_u=
ser:DgvatUserController', action=3D'set_lang')</div>
<div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 #m.connect('/user/{id:.*}', action=
=3D'read')</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 map.connect('/=
user', controller=3D'ckanext.dgvat_por.controllers.dgvat_user:Dgvat=
UserController', action=3D'index') =C2=A0 =C2=A0 =C2=A0 =C2=A0<=
/div>
<div>=C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=
=A0 map.connect('home', '/', controller=3D'ckanext.dgva=
t_por.controllers.dgvat_cockpit:DgvatCockpitController', action=3D'=
search')</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 map.connect('about&#=
39;, '/about', controller=3D'ckanext.dgvat_por.controllers.dgva=
t_cockpit:DgvatCockpitController', action=3D'about')</div>
<div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 map.connect('terms', '/terms&#=
39;, controller=3D'ckanext.dgvat_por.controllers.dgvat_cockpit:DgvatCoc=
kpitController', action=3D'terms')</div><div>=C2=A0 =C2=A0 =C2=
=A0 =C2=A0 map.connect('help', '/help', controller=3D'c=
kanext.dgvat_por.controllers.dgvat_cockpit:DgvatCockpitController', act=
ion=3D'help')</div>
<div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 map.connect('register_api', '/=
register_api', controller=3D'ckanext.dgvat_por.controllers.dgvat_co=
ckpit:DgvatCockpitController', action=3D'register')</div><div>=
=C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 #lo=
g.fatal("=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D> %s" % map)</div>
<div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 return map</div><div>=C2=A0 =C2=A0=C2=A0</=
div><div>=C2=A0 =C2=A0=C2=A0</div><div>=C2=A0 =C2=A0 def after_map(self, ma=
p):</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 #log.fatal("=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D> %s" % map)</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 retu=
rn map</div><div>
=C2=A0 =C2=A0=C2=A0</div><div>=C2=A0 =C2=A0=C2=A0</div><div>=C2=A0 =C2=A0 d=
ef update_config(self, config):</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 log.d=
ebug("update_config")</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 confi=
g['package_form'] =3D 'data_gv_at'</div><div>=C2=A0 =C2=A0 =
=C2=A0 =C2=A0 configure_template_directory(config, 'templates')</di=
v>
<div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 configure_public_directory(config, 'pu=
blic')</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0</div><div>=C2=A0 =C2=
=A0 =C2=A0 =C2=A0=C2=A0</div><div>=C2=A0 =C2=A0 def filter(self, stream):</=
div><div><br></div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 from pylons import requ=
est, tmpl_context as c</div>
<div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 routes =3D request.environ.get('pylons=
.routes_dict')</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 log.debug(routes)<=
/div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 if routes and \</div><div>=C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0routes.get('controller'=
;) =3D=3D 'package' and \</div>
<div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0routes.get('=
;action') =3D=3D 'read' and=C2=A0<a href=3D"http://c.pkg.id/" s=
tyle=3D"color:rgb(17,85,204)" target=3D"_blank">c.pkg.id</a>:</div><div><br=
></div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 # Add dataset id to t=
he UI</div>
<div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 stream =3D stream_filters.pa=
ckage_id_filter(stream, c.pkg)</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 return=
stream</div><div>=C2=A0 =C2=A0=C2=A0</div><div>=C2=A0 =C2=A0=C2=A0</div><d=
iv>=C2=A0 =C2=A0 def setup_template_variables(self, context, data_dict):</d=
iv><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 log.debug("setup_template_variable=
s")</div>
<div><br></div><div>=C2=A0 =C2=A0 def package_types(self):</div><div>=C2=A0=
=C2=A0 =C2=A0 =C2=A0 return ['dataset']</div><div>=C2=A0 =C2=A0=C2=
=A0</div><div>=C2=A0 =C2=A0 def is_fallback(self):</div><div>=C2=A0 =C2=A0 =
=C2=A0 =C2=A0 return True =C2=A0</div><div><br></div><div>=C2=A0 =C2=A0 def=
form_to_db_schema(self):</div>
<div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 log.fatal("Enter form to db!!!")=
</div><div><div style=3D"margin:5px 0px"><div style=3D"color:rgb(80,0,80);f=
ont-size:11px;background-color:rgb(241,241,241);border:1px solid rgb(221,22=
1,221);clear:both;line-height:6px;outline:none;width:20px">
<div style=3D"background-image:url(https://ssl.gstatic.com/ui/v1/icons/mail=
/ellipsis.png);min-height:8px;width:20px;background-repeat:no-repeat no-rep=
eat"></div></div></div></div></div></div><div class=3D"im"><div>=C2=A0 =C2=
=A0 def add_to_extras(self, key, data, errors, context):</div>
<div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 # get current number of extras</div><div>=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 extras =3D data.get(('extras',), [])</d=
iv><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 if not extras:</div><div>=C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 data[('extras',)] =3D extras</div><div>=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 #extras.append({'key': key[-1], 'va=
lue': data[key]})</div>
<div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 #log.fatal("add to extras: %s, %s&quo=
t; % (key, data[key]))</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 #log.fatal(&qu=
ot;extra_number: %s" % extra_number)</div><div>=C2=A0 =C2=A0 =C2=A0 =
=C2=A0 #data[('extras', extra_number, 'key')] =3D key[0]</d=
iv>
<div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 cats =3D""</div><div>=C2=A0 =C2=
=A0 =C2=A0 =C2=A0 allCat=3D[]</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 for cur=
in data[key]:</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if cur !=
=3D '[' and cur!=3D']':</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 cats +=3D cur</div><div>=C2=A0 =C2=A0 =C2=
=A0 =C2=A0 for cat_desc, id in c.categorization:</div>
<div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if id in cats:</div><div>=C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 allCat.append(id) =C2=
=A0 =C2=A0 =C2=A0</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 log.fatal("add=
ed categorizations:id %s" % allCat)</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=
=A0 log.fatal("cats, key: %s,%s" % (cats, data[key]))</div>
<div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 log.fatal("is list: %s" % isinst=
ance(data[key], list))</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 #data[('ex=
tras', extra_number, 'value')] =3D allCat</div><div>=C2=A0 =C2=
=A0 =C2=A0 =C2=A0 extras.append({'key': key[-1], 'value': a=
llCat})</div>
<div><div style=3D"margin:5px 0px"><div style=3D"color:rgb(80,0,80);font-si=
ze:11px;background-color:rgb(241,241,241);border:1px solid rgb(221,221,221)=
;clear:both;line-height:6px;outline:none;width:20px">
<div style=3D"background-image:url(https://ssl.gstatic.com/ui/v1/icons/mail=
/ellipsis.png);min-height:8px;width:20px;background-repeat:no-repeat no-rep=
eat"></div></div></div></div></div><div class=3D"im"><div>=C2=A0 =C2=A0 def=
read_template(self):</div>
<div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 return 'package/read.html'</div><d=
iv><br></div><div>=C2=A0 =C2=A0=C2=A0</div><div>=C2=A0 =C2=A0 def check_dat=
a_dict(self, schema=3DNone):</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 return</=
div><div><br></div><div>=C2=A0 =C2=A0 def new_template(self):</div><div>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 return 'package/new.html'</div>
<div><br></div><div>=C2=A0 =C2=A0 def comments_template(self):</div><div>=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 return 'package/comments.html'</div><di=
v><br></div><div>=C2=A0 =C2=A0 def search_template(self):</div><div>=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 return 'package/search.html'</div>
<div><br></div><div>=C2=A0 =C2=A0 def read_template(self):</div><div>=C2=A0=
=C2=A0 =C2=A0 =C2=A0 return 'package/read.html'</div><div><br></di=
v><div>=C2=A0 =C2=A0 def history_template(self):</div><div>=C2=A0 =C2=A0 =
=C2=A0 =C2=A0 return 'package/history.html'</div>
<div>
<br></div><div>=C2=A0 =C2=A0 def package_form(self):</div><div>=C2=A0 =C2=
=A0 =C2=A0 =C2=A0 return 'package/datagvat_organization_form.html'<=
/div></div></div><br></div>
</blockquote></div><br></div>
--90e6ba1efca050ccb304d390950b--
More information about the ckan-dev
mailing list