Re: manage_changeMetaId [1 Attachment]

"Sebastian Tänzer [email protected] [zms-developers]" <[email protected]> Wed, 4 Mar 2015 14:55:03 +0100
Newsgroups gmane.comp.cms.zms.devel
Message-ID <[email protected]>
--Apple-Mail=_7F56ED5D-7B00-4EF1-8329-E61D44D0D0D0
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=utf-8

I=E2=80=99ve built a quick action for now. You just have to set the old and=
 new meta_id in the script before execution:

=E2=80=A6
meta_old =3D "type1"
meta_new =3D "type2"
=E2=80=A6

With more time it=E2=80=99s possible to extend it with a UI, but it should =
get the job done for now.=20

Best
Sebastian


> Am 04.03.2015 um 12:14 schrieb Thorsten Weber [email protected] [zms-=
developers] <[email protected]>:
>=20
> Is there a downloadable action to change/replace special content types (m=
anage_changeMetaId) which is working with ZMS3-3.0.4 ?
> version 0.2 is somehow broken and I don=E2=80=99t have time right now to =
dive into it.
>=20
> Regards
>=20
> Thorsten
>=20
>=20


--Apple-Mail=_7F56ED5D-7B00-4EF1-8329-E61D44D0D0D0
Content-Type: multipart/mixed;
	boundary="Apple-Mail=_1ACEC073-9A1F-4D6D-930B-DBF3A9AAB88A"

--Apple-Mail=_1ACEC073-9A1F-4D6D-930B-DBF3A9AAB88A
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
	charset=utf-8

<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html charset=
=3Dutf-8"></head><body style=3D"word-wrap: break-word; -webkit-nbsp-mode: s=
pace; -webkit-line-break: after-white-space;" class=3D""><div class=3D"">I=
=E2=80=99ve built a quick action for now. You just have to set the old and =
new meta_id in the script before execution:</div><div class=3D""><br class=
=3D""></div><div class=3D"">=E2=80=A6</div><div class=3D""><div class=3D"">=
meta_old =3D "type1"</div><div class=3D"">meta_new =3D "type2"</div></div><=
div class=3D"">=E2=80=A6</div><div class=3D""><br class=3D""></div><div cla=
ss=3D"">With more time it=E2=80=99s possible to extend it with a UI, but it=
 should get the job done for now.&nbsp;</div><div class=3D""><br class=3D""=
></div><div class=3D"">Best</div><div class=3D"">Sebastian</div><div class=
=3D""><br class=3D""></div><div class=3D""></div></body></html>
--Apple-Mail=_1ACEC073-9A1F-4D6D-930B-DBF3A9AAB88A
Content-Disposition: attachment;
	filename=changeMeta.metacmd.xml
Content-Type: application/xml;
	name="changeMeta.metacmd.xml"
Content-Transfer-Encoding: 7bit

<?xml version="1.0" encoding="utf-8"?>

<dictionary>
  <item key="data"><![CDATA[## Script (Python) "changeMeta"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=
##title=*** DO NOT DELETE OR MODIFY ***
##
request = container.REQUEST
RESPONSE =  request.RESPONSE

el = context.getChildNodes()

meta_old = "type1"
meta_new = "type2"

for e in el:
    if e.meta_id == meta_old:
        print '%s changed from %s to %s<br/>' % (e.id, e.meta_id, meta_new)
        context.operator_setattr(e, 'meta_id', meta_new)

# Return a string identifying this script.
return printed
]]>
  </item>
  <item key="description"></item>
  <item key="exec" type="int">1</item>
  <item key="icon_clazz"><![CDATA[icon-cogs]]></item>
  <item key="id"><![CDATA[changeMeta]]></item>
  <item key="meta_type"><![CDATA[Script (Python)]]></item>
  <item key="meta_types" type="list">
    <list>
      <item><![CDATA[type(ZMSDocument)]]></item>
      <item><![CDATA[type(ZMSObject)]]></item>
    </list>
  </item>
  <item key="name"><![CDATA[Change meta_id]]></item>
  <item key="roles" type="list">
    <list>
      <item><![CDATA[ZMSAdministrator]]></item>
    </list>
  </item>
  <item key="title"><![CDATA[Change meta_id]]></item>
</dictionary>
--Apple-Mail=_1ACEC073-9A1F-4D6D-930B-DBF3A9AAB88A
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
	charset=utf-8

<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html charset=
=3Dutf-8"></head><body style=3D"word-wrap: break-word; -webkit-nbsp-mode: s=
pace; -webkit-line-break: after-white-space;" class=3D""><div class=3D""></=
div><br class=3D""><div><blockquote type=3D"cite" class=3D""><div class=3D"=
">Am 04.03.2015 um 12:14 schrieb Thorsten Weber <a href=3D"mailto:thorsten@=
frosthelm.de" class=3D"">[email protected]</a> [zms-developers] &lt;<a =
href=3D"mailto:[email protected]" class=3D"">zms-developers@ya=
hoogroups.com</a>&gt;:</div><br class=3D"Apple-interchange-newline"><div cl=
ass=3D"">












=20
<div style=3D"background-color: #fff;" class=3D"">
<span style=3D"display:none" class=3D"">&nbsp;</span>



    <div id=3D"ygrp-text" class=3D""><p class=3D"">Is there a downloadable =
action to change/replace special content types (manage_changeMetaId) which =
is working with ZMS3-3.0.4 ?<br class=3D"">
version 0.2 is somehow broken and I don=E2=80=99t have time right now to di=
ve into it.<br class=3D"">
<br class=3D"">
Regards<br class=3D"">
<br class=3D"">
Thorsten</p>

    </div>
=20=20=20=20=20

=20=20=20=20

</div>



<!-- end group email -->

</div></blockquote></div><br class=3D""></body></html>
--Apple-Mail=_1ACEC073-9A1F-4D6D-930B-DBF3A9AAB88A--

--Apple-Mail=_7F56ED5D-7B00-4EF1-8329-E61D44D0D0D0--