text:
Q: SharePoint 2010 Batch Update Error, I'm uploading data from csv file which has about 200k records to sharepoint list, code works fine but I get this error after code has run for about 2hrs or so.

Cannot complete this action.
Please try again.    at
  Microsoft.SharePoint.SPGlobal.HandleComException(COMException comEx)
  at Microsoft.SharePoint.Library.SPRequest.ProcessBatchData(String
  bstrUrl, String bstrData, ISPDataCallback pResultCallback)    at
  Microsoft.SharePoint.SPWeb.ProcessBatchData(String strBatchData)    at
  UploadIrisData.Program.Dof1FieldsBatchUpdate[T](IEnumerable`1
  memberList, SPList list, StringBuilder methodBuilder, SPWeb web,
  SPQuery query, String createquery, String batchFormat)
  HandleComException at offset 27818482 in file:line:column :0:0

  private static void Dof1FieldsBatchUpdate<T>(IEnumerable<T> memberList, SPList list, StringBuilder methodBuilder, SPWeb web,
        SPQuery query, string createquery, string batchFormat)
    {
        string batch = String.Empty;
        string listGuid = list.ID.ToString();
        List<f1fields> f1Fieldses = (List<f1fields>)memberList;
        query.Query = "<Where>" + CreateDynamicQuery<T>(memberList.ToList(), createquery) + "</Where>";

        query.ViewAttributes = "Scope='Recursive'";

        query.RowLimit = 1000;
        try
        {
            do
            {
                SPListItemCollection items = list.GetItems(query);

                string methodFormat = "<Method ID=\"{0}\">" +
                            "<SetList>{1}</SetList>" +
                            "<SetVar Name=\"Cmd\">Save</SetVar>" +
                            "<SetVar Name=\"ID\">{2}</SetVar>" +
                            "<SetVar Name=\"urn:schemas-microsoft-com:office:office#Title\">{3}</SetVar>" +
                            "<SetVar Name=\"urn:schemas-microsoft-com:office:office#CLContractNumber\">{4}</SetVar>" +
                            "<SetVar Name=\"urn:schemas-microsoft-com:office:office#CLClubName\">{5}</SetVar>" +
                            "<SetVar Name=\"urn:schemas-microsoft-com:office:office#CLEmailHome\">{6}</SetVar>" +
                            "<SetVar Name=\"urn:schemas-microsoft-com:office:office#CLEmailWork\">{7}</SetVar>" +
                            "<SetVar Name=\"urn:schemas-microsoft-com:office:office#CLFaxNumber\">{9}</SetVar>" +
                            "<SetVar Name=\"urn:schemas-microsoft-com:office:office#CLHomePhone\">{10}</SetVar>" +
                            "<SetVar Name=\"urn:schemas-microsoft-com:office:office#CLIDNumber\">{11}</SetVar>" +
                            "<SetVar Name=\"urn:schemas-microsoft-com:office:office#CLLegalCategory\">{12}</SetVar>" +
                            "<SetVar Name=\"urn:schemas-microsoft-com:office:office#CLMemberEffectiveYear\">{13}</SetVar>" +
                            "<SetVar Name=\"urn:schemas-microsoft-com:office:office#CLMemberName\">{14}</SetVar>" +
                            "<SetVar Name=\"urn:schemas-microsoft-com:office:office#CLMemberStatus\">{15}</SetVar>" +
                            "<SetVar Name=\"urn:schemas-microsoft-com:office:office#CLPassportNumber\">{16}</SetVar>" +
                            "<SetVar Name=\"urn:schemas-microsoft-com:office:office#CLPasswordRequired\">{17}</SetVar>" +
                            "<SetVar Name=\"urn:schemas-microsoft-com:office:office#CLPhysicalHomeAddress1\">{18}</SetVar>" +
                            "<SetVar Name=\"urn:schemas-microsoft-com:office:office#CLPhysicalHomeAddress2\">{19}</SetVar>" +
                            "<SetVar Name=\"urn:schemas-microsoft-com:office:office#CLPhysicalHomeAddress3\">{20}</SetVar>" +
                            "<SetVar Name=\"urn:schemas-microsoft-com:office:office#CLPhysicalHomeAddress4\">{21}</SetVar>" +
                            "<SetVar Name=\"urn:schemas-microsoft-com:office:office#CLPhysicalHomePostalCode\">{22}</SetVar>" +
                            "<SetVar Name=\"urn:schemas-microsoft-com:office:office#CLPhysicalWorkAddress1\">{23}</SetVar>" +
                            "<SetVar Name=\"urn:schemas-microsoft-com:office:office#CLPhysicalWorkAddress2\">{24}</SetVar>" +
                            "<SetVar Name=\"urn:schemas-microsoft-com:office:office#CLPhysicalWorkAddress3\">{25}</SetVar>" +
                            "<SetVar Name=\"urn:schemas-microsoft-com:office:office#CLPhysicalWorkAddress4\">{26}</SetVar>" +
                            "<SetVar Name=\"urn:schemas-microsoft-com:office:office#CLPhysicalWorkPostalCode\">{27}</SetVar>" +
                            "<SetVar Name=\"urn:schemas-microsoft-com:office:office#CLPostalHomeAddress1\">{28}</SetVar>" +
                            "<SetVar Name=\"urn:schemas-microsoft-com:office:office#CLPostalHomeAddress2\">{29}</SetVar>" +
                            "<SetVar Name=\"urn:schemas-microsoft-com:office:office#CLPostalHomeAddress3\">{30}</SetVar>" +
                            "<SetVar Name=\"urn:schemas-microsoft-com:office:office#CLPostalHomeAddress4\">{31}</SetVar>" +
                            "<SetVar Name=\"urn:schemas-microsoft-com:office:office#CLPostalHomePostalCode\">{32}</SetVar>" +
                            "<SetVar Name=\"urn:schemas-microsoft-com:office:office#CLWorkPhone\">{33}</SetVar>" +
                            "<SetVar Name=\"urn:schemas-microsoft-com:office:office#CLCompanyKey\">{34}</SetVar>" +
                            "<SetVar Name=\"urn:schemas-microsoft-com:office:office#CLPostalWorkAddress1\">{35}</SetVar>" +
                            "<SetVar Name=\"urn:schemas-microsoft-com:office:office#CLPostalWorkAddress2\">{36}</SetVar>" +
                            "<SetVar Name=\"urn:schemas-microsoft-com:office:office#CLPostalWorkAddress3\">{37}</SetVar>" +
                            "<SetVar Name=\"urn:schemas-microsoft-com:office:office#CLPostalWorkAddress4\">{38}</SetVar>" +
                            "<SetVar Name=\"urn:schemas-microsoft-com:office:office#CLPostalWorkPostalCode\">{39}</SetVar>" +
                            "<SetVar Name=\"urn:schemas-microsoft-com:office:office#CLCellphone\">{40}</SetVar>" +
                            "<SetVar Name=\"urn:schemas-microsoft-com:office:office#CLAnnualFeesTotalOverdue\">{41}</SetVar>" +
                            "<SetVar Name=\"urn:schemas-microsoft-com:office:office#CLContractTotalOverdue\">{42}</SetVar>" +
                            "</Method>";

                var excludedMemberIDs = new HashSet<string>(f1Fieldses.Select(r => r.MemberNumber));
                var memberNumbersFoundInList = new List<string>();

                //build the CAML update commands
                if (items.Count > 0)
                {
                    for (var i = 0; i < items.Count; i++)
                    {
                        var memberId = items[i].ID;
                        memberNumbersFoundInList.Add(items[i].Title);
                        int i1 = i;
                        foreach (var member in f1Fieldses.Where(member => items[i1].Title == member.MemberNumber))
                        {
                            methodBuilder.AppendFormat(methodFormat, memberId, listGuid, memberId,
                                member.MemberNumber, member.ContractNumber, member.ClubName, member.EmailHome, member.EmailWork,
                                member.HistoricalNumber, member.FaxNumber, member.HomePhone, member.IdNumber, member.LegalCategory,
                                member.MemberEffectiveYear, member.MemberName, member.MemberStatus,
                                member.PassportNumber, member.PasswordRequired, member.PhysicalHomeAddress1,
                                member.PhysicalHomeAddress2, member.PhysicalHomeAddress3,
                                member.PhysicalHomeAddress4, member.PhysicalHomePostalCode,
                                member.PhysicalWorkAddress1, member.PhysicalWorkAddress2,
                                member.PhysicalWorkAddress3, member.PhysicalWorkAddress4,
                                member.PhysicalWorkPostalCode,
                                member.PostalHomeAddress1, member.PostalHomeAddress2, member.PostalHomeAddress3,
                                member.PostalHomeAddress4, member.PostalHomePostalCode, member.WorkPhone, member.CompanyKey,
                                member.PostalWorkAddress1, member.PostalWorkAddress2, member.PostalWorkAddress3, member.PostalWorkAddress4,
                                member.PostalWorkPostalCode, member.CellPhone, member.AnnualFeesTotal, member.ContractTotalOverdue
                                );

                        }
                        //memberToWriteToLog.Add(items[i].Title);
                    }
                }
                var result = f1Fieldses.Where(p => !memberNumbersFoundInList.Contains(p.MemberNumber));
                IEnumerable<f1fields> f1FieldsesUpdateNew = result as IList<f1fields> ?? result.ToList();
                //if (f2FieldsesUpdateNew.Any()) Debugger.Break();

                // New member numbers to be add to the list
                var newMembersWithoutDuplicates = new List<f1fields>();
                var duplicatesMemberNumber = new List<f1fields>();

                //Find duplicates before batch update
                foreach (var s in f1FieldsesUpdateNew)
                {
                    var temp = newMembersWithoutDuplicates.Find(x=>x.MemberNumber.Contains(s.MemberNumber));
                    if (temp == null)
                        newMembersWithoutDuplicates.Add(s);
                    else
                    {
                        duplicatesMemberNumber.Add(s);
                    }
                }

                if (newMembersWithoutDuplicates.Any())
                {
                    var memberId = 1;
                    foreach (var member in newMembersWithoutDuplicates)
                    {
                        methodBuilder.AppendFormat(methodFormat, memberId, listGuid, "New",
                                member.MemberNumber, member.ContractNumber, member.ClubName, member.EmailHome, member.EmailWork,
                                member.HistoricalNumber, member.FaxNumber, member.HomePhone, member.IdNumber, member.LegalCategory,
                                member.MemberEffectiveYear, member.MemberName, member.MemberStatus,
                                member.PassportNumber, member.PasswordRequired, member.PhysicalHomeAddress1,
                                member.PhysicalHomeAddress2, member.PhysicalHomeAddress3,
                                member.PhysicalHomeAddress4, member.PhysicalHomePostalCode,
                                member.PhysicalWorkAddress1, member.PhysicalWorkAddress2,
                                member.PhysicalWorkAddress3, member.PhysicalWorkAddress4,
                                member.PhysicalWorkPostalCode,
                                member.PostalHomeAddress1, member.PostalHomeAddress2, member.PostalHomeAddress3,
                                member.PostalHomeAddress4, member.PostalHomePostalCode, member.WorkPhone, member.CompanyKey,
                                member.PostalWorkAddress1, member.PostalWorkAddress2, member.PostalWorkAddress3, member.PostalWorkAddress4,
                                member.PostalWorkPostalCode, member.CellPhone, member.AnnualFeesTotal, member.ContractTotalOverdue
                                );
                        memberId++;
                    }
                }
                web.AllowUnsafeUpdates = true;
                batch = string.Format(batchFormat, methodBuilder.ToString());

                // Process the batch of commands
                web.ProcessBatchData(batch);
                //web.AllowUnsafeUpdates = false;
                methodBuilder.Length = 0;
                if (duplicatesMemberNumber.Any())
                {
                    SPQuery query2 = new SPQuery();
                    string createquery2 = "";
                    Dof1FieldsBatchUpdate(duplicatesMemberNumber, list, methodBuilder, web, query2, createquery2, batchFormat);
                }

            } while (query.ListItemCollectionPosition != null);
        }
        catch (Exception ex)
        {
            using (FileStream fs = new FileStream("c:\\error.txt", FileMode.Append, FileAccess.Write))
            using (StreamWriter sw = new StreamWriter(fs))
            {
                // Get stack trace for the exception with source file information
                var st = new StackTrace(ex, true);
                // Get the top stack frame
                var frame = st.GetFrame(0);
                // Get the line number from the stack frame
                var line = frame.GetFileLineNumber();
                sw.WriteLine(ex.Message + Environment.NewLine + ex.StackTrace + Environment.NewLine + frame + Environment.NewLine + line);
            }
        }
    }

A: I had the same exception and the reason was an unescaped <div> tag that was breaking the xml structure. Ensure that your data is properly inserted in the <SetVar> tags.
If this is not the case I have read that too big batch update xml may result in an exception.


Odyssey FZGSTKS4 ATA Flight Case for MIDI Traktor Kontrol S4/VMS4 With Sliding Laptop Platform. Condition: BRAND NEW IN ORIGINAL PACKAGING. The Odyssey Flight Zone FZGSTKS4 case is specially made for the Traktor Kontrol S4 DJ MIDI digital controller and can also fit the American Audio VMS4 DJ controller as well. It features our patented Glide Style laptop platform that slides forwards and backwards over the control unit to whatever position best suits you. Also features a lower storage/ventilation pit that has enough room for cables and other compact DJ essentials. Odyssey Flight Zone FZGSTKS4 Tractor Kontrol S4 / American Audio VMS4 Glide Style Case.
Removable Front Angled V-Cut Access Panel. Plenty of Cable Management Underneath & Behind the Controller. Controller Compartment is: 19-5/8" W x 12-5/8" D. Approximate Dimensions (exterior): 24.5" W x 8.75" H x 18.25 D.
Best prices - We sell all Odyssey Products at great prices. Lifetime Customer Service by Odyssey product experts. Guaranteed legitimate and authentic merchandise. If your item is defective or you want to return it for any reason within the first 30 days of when it was delivered to you; you have the following options. We will send you a.
To replace the item for a brand new one. All replacements and exchanges are free. This includes blown speakers with burned voice coils. The item "Odyssey FZGSTKS4 ATA Flight Case for S4/VMS4/IDJ3/MIXTRACK PRO + Laptop Tray" is in sale since Friday, January 26, 2018.
This item is in the category "Musical Instruments & Gear\Pro Audio Equipment\Cases, Racks & Bags". The seller is "audiosavings" and is located in Inwood, New York. This item can be shipped to United States, Canada, United Kingdom, Denmark, Romania, Slovakia, Bulgaria, Czech republic, Finland, Hungary, Latvia, Lithuania, Malta, Estonia, Australia, Greece, Portugal, Cyprus, Slovenia, Japan, China, Sweden, South Korea, Indonesia, Taiwan, South africa, Thailand, Belgium, France, Hong Kong, Ireland, Netherlands, Poland, Spain, Italy, Germany, Austria, Israel, Mexico, New Zealand, Philippines, Singapore, Switzerland, Norway, Saudi arabia, Ukraine, United arab emirates, Qatar, Kuwait, Bahrain, Croatia, Malaysia, Brazil, Chile, Colombia, Costa rica, Dominican republic, Panama, Trinidad and tobago, Guatemala, El salvador, Honduras, Jamaica, Bahamas, Viet nam, Uruguay.


text:
Why Avoiding the 'Fiscal Cliff' May Have Caused Increased Risks to CPAs
Accountant Malpractice Risk Management
We avoided the fiscal cliff. That is old news and, for most Americans, it is also good news. But, the developing fallout and the impact of Congresses' eleventh-hour solution has particular implications on accountants gearing up for tax season. On January 2, 2013 Congress enacted the American Taxpayer Relief Act of 2012; a fiscal cliff tax package whopper which effectively changed the rule-book. At a time of year when accountants across the country are typically saying "so long" to their families to prepare for the hibernation that is tax-season, this year's crop of tax-preparers is stuck in its tracks waiting for the IRS to issue updated software. From a professional liability and risk management standpoint, this is troublesome.
Professional Liability Monthly – January Edition is Now Available
Professional Liability Matters
For a free copy of this month's edition of Professional Liability Monthly, click here. To be added to our circulation list, where you will receive this publication for free each month via email, please contact Brian Biggie at [email protected]…
Cases for Professional Liability Monthly – January 2013 Edition
Cases provided courtesy of LexisNexis.
The Importance of Record Retention
All professionals must maintain and follow a clearly documented record retention policy. These policies are more stringent and regulated for some professions. Each of the 50 states maintain regulations governing work-paper ownership and record retention for accountants, for example. Attorneys, too, may be guided by fairly specific record retention policies pursuant to the applicable Rules of Professional Conduct governing lawyers state-by-state. Despite these regulations, all classes of professionals routinely face legal woes as a result of poor record retention compliance. This risk intensifies as a result of cyber risk and associated liability from electronically stored information.
Attorney Suspended for Operating a Foreclosure Mill
In a recent consent agreement reached with the Florida Bar Association, Attorney Marshall C. Watson, was suspended for 91 days and agreed to shut down his legal practice for his role in operating a foreclosure mill. The issue: may an attorney be held personally responsible for his oversight of a large foreclosure mill? The lesson: even when an attorney's work-product is not technically negligent, she may still be in violation of ethical rules and subject to strict discipline.
Chinese Walls Are No Longer High Enough
The New Mexico Supreme Court recently entered a decision with ramifications regarding conflicts of interest in law firms. The issue: may a firm cure a clear conflict of interest by erecting a "Chinese wall." The lesson: Chinese walls are not as strong as they used to be and some conflicts may only be cured through the disqualification of counsel, and maybe the entire law firm.
Colorado Shooter's Psychiatrist Sued for Medical Malpractice
Medical Malpractice Risk Management
The widow of a man killed in last year's mass shooting in Aurora, Colorado has filed a lawsuit against the alleged gunman's psychiatrist claiming she knew of his threats to harm others and failed to warn of the imminent danger. Issue: When is a psychiatrist obligated to warn the public of her client's threats to the public? Lesson: Threats of imminent harm cannot be taken lightly and preventive measures should be taken despite the application of doctor-patient confidentiality.
When Your Client Lies: What we can learn from Lance Armstrong
Legal Malpractice Risk Management
Lance Armstrong's legal team played a part in each of the racing metals, the Livestrong brand, the endorsements, the accusations, the denials and of course the many lawsuits he filed to defend his reputation. Frankly, in light of the recent confession on Oprah, Armstrong's attorneys may be feeling a bit uncomfortable.
Engagement Letters 101 – The Professional Rule Book
The first rule of engagement letters: obtain a signed engagement letter. The second rule of engagement letters: obtain a signed engagement letter. The remaining rules are a bit more complicated. A well written engagement letter is absolutely critical to managing risk. It defines the scope of the engagement and, as a result, sets appropriate expectations with the client. An engagement letter may help to discourage meritless malpractice claims and may serve as "Exhibit A" in a dispositive motion. On the other hand, the lack of an engagement letter may result in an undefined engagement and may promote meritless, protracted litigation.
Sleeping with the Enemy: When a Consensual Relationship = Medical Malpractice
New York's high court recently concluded that a consensual relationship between a patient and her family doctor constituted medical malpractice. Issue: Whether a consensual sexual relationship between a married patient and her physician is grounds for a medical malpractice claim. Lesson: When possible, avoid sleeping with your clients.
Previous Page«‹60616263›Next Page

redpajama_set_name: RedPajamaCommonCrawl


text:
Das Museum of the City of New York ist ein Museum für die Kunst aus und die Geschichte von New York City und dessen Bevölkerung.

Lage
Das Museum befindet sich am nördlichen Ende der Museum Mile an der 1220 Fifth Avenue in Manhattan zwischen der 103rd Street und 104th Streets gegenüber dem Central Park.

Geschichte
Das Museum of the City of New York ist eine Non-Profit-Organisation und wird öffentlich gefördert. Es wurde 1923 gegründet und war zunächst im Gracie Mansion untergebracht. Heute ist dies die Residenz des Bürgermeisters von New York City. Bereits wenige Jahre später wurde das heutige Zuhause an der Fifth Avenue von Joseph J. Freedlander im Georgianischen Stil entworfen und gebaut (Bauzeit: 1928 bis 1930), so dass das Museum hier 1932 seine Pforten öffnen konnte.

1982 erhielt das Museum von der The Hundred Year Association of New York den Gold Medal Award in Anerkennung für herausragende Beiträge über die Stadt New York.

 Tweed-Courthouse-Umzug

2000 wurde überlegt, das Museum in das historische Tweed Courthouse bei der City Hall in Lower Manhattan umzuziehen. Das in der Nähe befindliche Museum El Museo del Barrio hätte dann in das bisherige Gebäude des Museum of the City of New York einziehen können. Letztendlich entschied aber Bürgermeister Michael Bloomberg im Tweed Courthouse das neue New York City Department of Education anzusiedeln, was dazu führte, dass der damalige Direktor des Museum of the City of New York, Robert R. Mcdonald, seine Kündigung einreichte.

Erweiterung des Museums
Die neue Museumsdirektorin, Susan Henshaw Jones, nahm die Erweiterung und Renovierung des Museumgebäudes in Angriff und setzte damit auf die Aufwertung des Standorts an der Fifth Avenue am Übergang zwischen der Upper East Side und East Harlem. Der erste Spatenstich hierfür erfolgte am 2. August 2006. Der erste Teil der Museumserweiterung wurde am 13. August 2008 feierlich eröffnet. Es handelt sich dabei um die Pavilion Gallery, einen gläsernen Anbau mit einer Fläche von ca. 280 m², der auf zwei Ebenen archäologische Artefakte zeigt. Neben der Erweiterung des Museums wurde das Haupthaus renoviert und erhielt einen Tresorraum für dessen Silbersammlung, einen Raum für wissenschaftliches Arbeiten sowie einen Raum zur Bearbeitung und Untersuchung von Artefakten. Die Gesamtkosten für diese erste Renovierungsetappe beliefen sich auf 28 Millionen Dollar. Es schlossen sich weitere Renovierungsetappen an, die voraussichtlich im Herbst 2011 abgeschlossen sein werden. Letztendlich werden die gesamten Renovierungsvorhaben ca. 85 Millionen Dollar kosten.

Sammlung

Die Sammlung des Museum of the City of New York umfasst über 1,5 Millionen Exponate. Das Museum sammelt, bewahrt und präsentiert Gegenstände, die mit der Geschichte von New York City und dessen Bevölkerung zusammenhängen. Dazu gehören neben Gemälden, Zeichnungen, Drucken, Karten und Fotografien auch Kleidungsstücke, dekorative Objekte und Möbel, alte Spielsachen, seltene Bücher, Manuskripte, Erinnerungsstücke, Objekte aus Marine, Militär, Polizei, Feuerwehr etc.

Die Theatersammlung dokumentiert u. a. das Goldene Zeitalter des Broadway – darunter 3.500 Kostüme, Requisiten, Kostümzeichnungen, Bühnenbilder und -modelle, Theaterfotografien und -stücke, Programmhefte und Erinnerungsstücke aus dem Theaterbereich.

Die Sammlung von Kleidungsstücken aus der Geschichte New York Citys umfasst frühe Zeugnisse von Kleidern niederländischer Frauen aus dem 17. Jahrhundert sowie Taufkleider, Windeln, Sportkleidung und Oberbekleidung aus vier Jahrhunderten bis zur Gegenwart. Durch den Umfang und die Qualität dieser Sammlung, ist sie zu einer wichtigen Quelle für wissenschaftliche Forschungsarbeiten im Bereich Mode geworden.

Unter den Exponaten zu Transportmitteln befinden sich Schiffsgalionsfiguren, ein Omnibus, ein Krankenwagen des Bellevue Hospitals, ein Polizeiwagen aus dem 19. Jahrhundert und ein Checker Cab von 1980.

Die Sammlung von Silbergegenständen (New York Silver Collection) aus der Zeit zwischen 1678 und 1984 befindet sich im 1. Stock des Museumsgebäudes.

Bekannt ist das Museum auch für Räume, die im Stil unterschiedlicher historischer Epochen in der Geschichte New York Citys eingerichtet sind, wie etwa das Ankleide- und Schlafzimmer von John D. Rockefeller, das John D. Rockefeller, Jr. dem Museum spendete. Ein besonderes Sammlungsstück des Museums ist z. B. der Stuhl, der einst Sarah Rapelje gehörte, der Tochter von Joris Jansen Rapelje aus Nieuw Amsterdam, von der es heißt, sie wäre das erste Kind von Europäern gewesen, das im Staate New York geboren wurde. Der Stuhl ist eine Spende ihrer Brinckerhoff-Nachfahren.

Ein bedeutender Teil der Sammlung besteht aus Drucken, Fotografien und Zeichnungen. So zählt etwa die umfangreiche Fotosammlung, die u. a. auch Arbeiten von Jacob Riis und Berenice Abbott umfasst, zu den wichtigsten Fotosammlungen der Vereinigten Staaten.

Weitere Artefakte aus der Kultur und Geschichte von New York City sind Sitze aus dem Yankee Stadium, Hüte von Kongressabgeordneten oder der Frauenrechtlerin Bella Abzug, ein von Vera Maxwell entworfener Overall für Kriegsarbeiter ("war workers jumpsuit") oder ein Friseurstuhl aus einem Barbershop.

Greenwich Village war Brennpunkt des US-amerikanischen Folkmusik-Revivals in den 1950er- und 1960er-Jahren. Woody Guthrie, Pete Seeger, Leadbelly und Bob Dylan lebten in New York City und luden den Zeitgeist auch mit politischen Inhalten auf. Eine 2015er Ausstellung im Museum of the City of New York dokumentiert jene Zeitläufte. Zeitgleich erschien das Buch Folk City - New York and the American Folk Music Revival.

Förderung
Neben Spenden von Privatpersonen und Zuwendungen von Stiftungen und Firmen erhält das Museum öffentliche Förderung vom New York State Council on the Arts, der National Endowment for the Humanities und der National Endowment for the Arts. Die Stadt New York, Besitzerin des Museumsgebäudes, unterstützt das Museum in Form von Betriebsmitteln und Mitteln für Museumsangebote durch das Department of Cultural Affairs.

Siehe auch
Liste der Museen in New York City
 Museum Mile

Einzelnachweise

Weblinks
Museum of the City of New York (Homepage)
Museum of the City of New York auf www.nyc.com
Museum of the City of New York auf www.ny.com

Kunstmuseum in New York City
Museum in Manhattan
Fifth Avenue

redpajama_set_name: RedPajamaWikipedia


text:
Archives for Sarkozy
Merkel takes the fight directly to Hollande
The politics of the eurozone crisis took several new twists and turns over the weekend, including the news that Angela Merkel intends to step in and "actively" support Nicolas Sarkozy's Presidential re-election campaign (although he is yet to for…
crisis, eurozone, franco-german axis, Hollande, Merkel, presidential election, Sarkozy
Which candidate has the most to gain from France's downgrade?
The race to the Elysee took another turn on Friday when Standard & Poor's downgraded French debt. The decision had been widely anticipated by the markets since December, when the ratings agency conducted a review of Eurozone finances. Although al…
eurozone, France, Le Pen, poll, Sarkozy
Sarkozy's outbursts reveal an insecurity
A reconstruction by the Financial Times of what happened at the EU summit on 9 December reveals that it wasn't only a classic Franco-British dispute which raised the tensions of the discussions.The newspaper discloses that following French President Ni…
denmark, France, Le Pen, presidential election, Sarkozy
Why the 26 vs 1 narrative is simplistic (Part 2)
On Tuesday, we set out a country by country guide looking at the limited support in cabinets and parliaments around Europe for the main points of the deal agreed last week highlighting that the European match-up is far more complicated than "26 vs 1". …
britain in europe, Cameron, EU integration, European media, Merkel, Sarkozy
A busy day in Euroland
It's been another busy day in the eurozone crisis, with European Council President Herman van Rompuy putting out his report on the prospects for treaty change and greater eurozone fiscal integration and then German Chancellor Angela Merkel and French…
ECB, emu, euro, eurozone. bail-out, finance, FTT, germany, Merkel, Sarkozy, sovereign debt, sovereignty, summit, Van Rompuy
Scoring today's Merkozy summit
Today's meeting between German Chancellor Angela Merkel and French President Nicolas Sarkozy is over and they have announced their proposal for treaty change and tackling the sovereign debt crisis in the eurozone. To give them credit its more substanti…
crisis, ECB, ECJ, esm, eu, euro, eurozone. bail-out, France, franco-german axis, germany, Merkel, Sarkozy, sovereign debt, sovereignty
Super Mario Shows His Hand
The new Italian government has been in office for less than 20 days. That must have seemed an eternity given the record interest rates Italy has been forced to pay by the markets over the past few weeks, while uncertainty remained over what Mario Monti…
bail-out, berlusconi, crisis, italy, Merkel, Sarkozy
Sarko Has Spoken
The day after French President Nicolas Sarkozy's keynote speech (available here) on the state of French economy and the future of the eurozone, those who (like us) were expecting a bit more details on what exactly France is planning to change in the EU…
bailout, crisis, eurozone, Merkel, Sarkozy, sovereign debt, sovereignty
The Creaking Axis?
French President Nicolas Sarkozy is due to unveil France's plans to amend the EU Treaties and make yet another step towards his cherished gouvernement économique for the eurozone in a keynote speech on the state of French economy this evening (which w…
bailout, crisis, eurozone, Merkel, Sarkozy
A disturbing glance into the future of Europe?
As Europe waits for Germany and France to present their plans for EU treaty change – Bild has today published a rather disturbing photo of what a combination of Merkel and Sarkozy, i.e. 'Merkozy' might actually look like (it was only a matter of time b…
franco-german axis, Merkel, Sarkozy, sovereignty, treaty change


PRODUCTION AREA: in Val Tidone, with the vineyard on a gentle, east-facing slope on calcareous-marl soil.
GRAPE VARIETIES: 85% Marsanne – originating in the place of the same name in the northern Rhône region of France, introduced to the Piacenza area during the Napoleonic era – 15% Chardonnay, an international variety, with a density of 5000 vines/hectare.
GRAPE HARVEST: the grapes are ONLY picked when they reach maximum ripening. They are picked by hand, put in crates, the bunches being carefully selected from each vine in order to guarantee the highest quality. They are then gently destemmed, leaving 30-40% of the berries whole.
WINEMAKING: the whole grapes are gently crushed after a brief maceration in the press and first fermentation takes place in stainless steel vats at a controlled temperature of 16-18 °C.
AROMA: a pleasant opening of slightly unripe fruit, reminiscent of pineapple, yellow apple and summer pear, with floral notes (acacia and honeysuckle). It unfolds later, more complex, with hints of small fruits (redcurrant and gooseberry), spices (pink and white pepper) and mildly lemony with slight overtones of lime leaves.
FLAVOUR: good structure and rich on the palate, supporting a pleasant acidic sensation, long finish, lingering, dominated by an excellent balance between good sapidity and plushness. The aftertaste begins with a return of fruity and honeyed-lemony notes of white and yellow fruits with a hint of spice.
It goes well with fish, delicate white meat dishes and a selection of young cheeses.


text:
Victoria Weather Forecast
Sibiu, RO
Victoria Current weather report
Local Time: Thu 18th Jul 1:49 am
Sibiu Sibiu CAMPIA TURZII Targu Mures
Wind: 9 km/h from W
Rain: 69 %
Cloud: 100%
Today's weather is turning out to be heavy rain at times. The visibility is going to be around 10 km i.e. 6 miles and an atmospheric pressure of 1013 mb . The daytime temperature is going to reach 24 °c and the temperature is going to dip to 11 °c at night. We expect around 1.2 mm of precipitation to fall and cloud covering 37% of the sky, the humidity will be around 67%.
5 km/h SSE
5 km/h ENE
4 km/h S
Tomorrow weather is forecasted to be moderate or heavy rain shower. The visibility is going to be around 10 km i.e. 5 miles and an atmospheric pressure of 1016 mb. The daytime temperature is going to reach 26 °c and the temperature is going to dip to 13 °c at night. We expect around 2.8 mm of precipitation to fall and cloud covering 58% of the sky, the humidity will be around 66%.
4 km/h SE
5 km/h NNW
On Saturday weather will be moderate or heavy rain shower with daytime temperature reaching 28 °c. Night time temperature are expected to be 14 °c.We expect around 3.8 mm of precipitation to fall. The visibility is going to be around 10 km i.e. 6 miles and an atmospheric pressure of 1018 mb. We expect around 3.8 mm of precipitation to fall and cloud covering 56% of the sky, the humidity will be around 66%.
4 km/h E
Sunday seems to be heavy rain at times. Victoria, Romania visibility is going to be around 10 km i.e. 6 miles and an atmospheric pressure of 1020 mb. The daytime temperature is going to reach 29 °c and the temperature is going to dip to 16 °c at night. We expect around 1.3 mm of precipitation to fall and cloud covering 28% of the sky, the humidity will be around 65%.
4 km/h NE
Moderate or heavy rain shower will be the weather pattern for the Monday. The visibility is going to be around 10 km i.e. 6 miles and an atmospheric pressure of 1018 mb. The daytime temperature is going to reach 29 °c and the temperature is going to dip to 17 °c at night. We expect around 1.9 mm of precipitation to fall and cloud covering 31% of the sky, the humidity will be around 68%.
Weekly Weather Report for Victoria, Romania
Looking at the weather in Victoria, Romania over the next 7 days, the maximum temperature will be 29℃ (or 84℉) on Sunday 21st July at around 5 pm. In the same week the minimum temperature will be 11℃ (or 51℉) on Thursday 18th July at around 5 am.
The national weather service for Victoria, Romania is reporting Tuesday 23rd July to be the wettest day in the coming week with around 3.00mm (or 0.1 inches) of rainfall. Make sure to carry an umbrella if you are out and about in Victoria, Romania.
The windiest of all days will be Wednesday 17th July as wind will reach 9mph (or 14kmph) at around 5 pm.
Victoria Weather Video
Victoria Today, Tomorrow and next 14 day Weather Forecast
10 Day Weather Forecast Victoria
Victoria, Romania Yearly Monthly Climate Weather Averages
10 day hour by hour Victoria weather

10 day hour by hour Victoria weather
Please also visit Victoria Historical Weather, Text Weather and Weather Charts pages. Historical or past weather forecast page provides historical weather forecast from 1st July, 2008 till now in 3 hourly interval. Text weather page will allow you to get a weather text summary for next 14 days and weather chart page displays weather pattern like temperature, wind speed, gust, pressure, etc. in graphical mode for next 14 days. We hope you like it.
| Bucharest |
Looking to buy past/historical weather for Victoria, please visit Buy Historical Weather Data section.
Ucea
Sibiu International Airport
Târgu Mure? Transilvania Airport
Tractorul Brasov


What he meant was this. If you write your goals down, you will have much more of a chance of achieving them than if you do not.
Today, almost 30 years later, I remember this statement, and I use it in my business. At the beginning of each year I write down my goal for the turnover for my business for the year to come. This number sits at the top of my whiteboard in my office in BIG red letters and looks just like this - 2017-18 UPCYCLED & CO. TURNOVER GOAL - $ with the number to follow.
Now what's interesting here, is that when we set our goals they will often feel totally unachievable, and that's a good thing. Why is it a good thing? Because it makes you work to get there, it makes you think about how you can achieve that goal, it makes you continue to have to come up with new ways to market your business, with new products to sell and so on. Without this stretch, you will never get yourself into the frame of mind you need to be in. You need to be continually thinking about how you can improve, grow and develop your business - that is the life of a business owner.
In terms of business turnover goals, another thing I have started to do in the last six months is set a daily sales goal. This goal I have on my whiteboard, but I also have it as the name of a folder in my email inbox, so that I see it every day. There is nothing in that folder, it's just a place that I decided to write that goal to give myself visibility of it on a daily basis - it's just one of the crazy ideas I came up with!
If you're skeptical about writing goals down... why not try it? I dare you.
Take a whiteboard marker or a pen and paper and write down your annual financial goal for your business's turnover and put it where you can see it often.
1. Make it clear. Be sure to write down the year (2017-18 as above), what it is for (Upcycled & Co. Turnover Goal), and the amount in $.
2. Make it a stretch. Whilst you do need to be realistic, make sure it challenges you too.
3. Make it a habit. Remind yourself regularly of what your goals is.
Now, work out how much you will need to sell to achieve your goal - how many products or how many services. This will help you to see that it is achievable, and sometimes it will help you to see that maybe you could even increase your goal.
Your next step is to start to work on believing you can do it, and I will talk to that one in a blog post soon.
For now, let me ask you a question: What is stopping you writing down your business turnover goal?
Let me know in the comments. In the meantime, come over to join the conversation on Facebook.
p.s. Oh and by the way - I'm on track to smash my 2017-18 turnover goal by 50%!


text:
"""
Tests for the API /deploy_templates/ methods.
"""

import datetime
from http import client as http_client
from unittest import mock
from urllib import parse as urlparse

from oslo_config import cfg
from oslo_utils import timeutils
from oslo_utils import uuidutils

from ironic.api.controllers import base as api_base
from ironic.api.controllers import v1 as api_v1
from ironic.api.controllers.v1 import notification_utils
from ironic.common import exception
from ironic import objects
from ironic.objects import fields as obj_fields
from ironic.tests.unit.api import base as test_api_base
from ironic.tests.unit.api import utils as test_api_utils
from ironic.tests.unit.objects import utils as obj_utils

def _obj_to_api_step(obj_step):
    """Convert a deploy step in 'object' form to one in 'API' form."""
    return {
        'interface': obj_step['interface'],
        'step': obj_step['step'],
        'args': obj_step['args'],
        'priority': obj_step['priority'],
    }

class BaseDeployTemplatesAPITest(test_api_base.BaseApiTest):
    headers = {api_base.Version.string: str(api_v1.max_version())}
    invalid_version_headers = {api_base.Version.string: '1.54'}

class TestListDeployTemplates(BaseDeployTemplatesAPITest):

    def test_empty(self):
        data = self.get_json('/deploy_templates', headers=self.headers)
        self.assertEqual([], data['deploy_templates'])

    def test_one(self):
        template = obj_utils.create_test_deploy_template(self.context)
        data = self.get_json('/deploy_templates', headers=self.headers)
        self.assertEqual(1, len(data['deploy_templates']))
        self.assertEqual(template.uuid, data['deploy_templates'][0]['uuid'])
        self.assertEqual(template.name, data['deploy_templates'][0]['name'])
        self.assertNotIn('steps', data['deploy_templates'][0])
        self.assertNotIn('extra', data['deploy_templates'][0])

    def test_get_one(self):
        template = obj_utils.create_test_deploy_template(self.context)
        data = self.get_json('/deploy_templates/%s' % template.uuid,
                             headers=self.headers)
        self.assertEqual(template.uuid, data['uuid'])
        self.assertEqual(template.name, data['name'])
        self.assertEqual(template.extra, data['extra'])
        for t_dict_step, t_step in zip(data['steps'], template.steps):
            self.assertEqual(t_dict_step['interface'], t_step['interface'])
            self.assertEqual(t_dict_step['step'], t_step['step'])
            self.assertEqual(t_dict_step['args'], t_step['args'])
            self.assertEqual(t_dict_step['priority'], t_step['priority'])

    def test_get_one_with_json(self):
        template = obj_utils.create_test_deploy_template(self.context)
        data = self.get_json('/deploy_templates/%s.json' % template.uuid,
                             headers=self.headers)
        self.assertEqual(template.uuid, data['uuid'])

    def test_get_one_with_suffix(self):
        template = obj_utils.create_test_deploy_template(self.context,
                                                         name='CUSTOM_DT1')
        data = self.get_json('/deploy_templates/%s' % template.uuid,
                             headers=self.headers)
        self.assertEqual(template.uuid, data['uuid'])

    def test_get_one_custom_fields(self):
        template = obj_utils.create_test_deploy_template(self.context)
        fields = 'name,steps'
        data = self.get_json(
            '/deploy_templates/%s?fields=%s' % (template.uuid, fields),
            headers=self.headers)
        # We always append "links"
        self.assertCountEqual(['name', 'steps', 'links'], data)

    def test_get_collection_custom_fields(self):
        fields = 'uuid,steps'
        for i in range(3):
            obj_utils.create_test_deploy_template(
                self.context,
                uuid=uuidutils.generate_uuid(),
                name='CUSTOM_DT%s' % i)

        data = self.get_json(
            '/deploy_templates?fields=%s' % fields,
            headers=self.headers)

        self.assertEqual(3, len(data['deploy_templates']))
        for template in data['deploy_templates']:
            # We always append "links"
            self.assertCountEqual(['uuid', 'steps', 'links'], template)

    def test_get_custom_fields_invalid_fields(self):
        template = obj_utils.create_test_deploy_template(self.context)
        fields = 'uuid,spongebob'
        response = self.get_json(
            '/deploy_templates/%s?fields=%s' % (template.uuid, fields),
            headers=self.headers, expect_errors=True)
        self.assertEqual(http_client.BAD_REQUEST, response.status_int)
        self.assertEqual('application/json', response.content_type)
        self.assertIn('spongebob', response.json['error_message'])

    def test_get_all_invalid_api_version(self):
        obj_utils.create_test_deploy_template(self.context)
        response = self.get_json('/deploy_templates',
                                 headers=self.invalid_version_headers,
                                 expect_errors=True)
        self.assertEqual(http_client.NOT_FOUND, response.status_int)

    def test_get_one_invalid_api_version(self):
        template = obj_utils.create_test_deploy_template(self.context)
        response = self.get_json(
            '/deploy_templates/%s' % (template.uuid),
            headers=self.invalid_version_headers,
            expect_errors=True)
        self.assertEqual(http_client.NOT_FOUND, response.status_int)

    def test_detail_query(self):
        template = obj_utils.create_test_deploy_template(self.context)
        data = self.get_json('/deploy_templates?detail=True',
                             headers=self.headers)
        self.assertEqual(template.uuid, data['deploy_templates'][0]['uuid'])
        self.assertIn('name', data['deploy_templates'][0])
        self.assertIn('steps', data['deploy_templates'][0])
        self.assertIn('extra', data['deploy_templates'][0])

    def test_detail_query_false(self):
        obj_utils.create_test_deploy_template(self.context)
        data1 = self.get_json('/deploy_templates', headers=self.headers)
        data2 = self.get_json(
            '/deploy_templates?detail=False', headers=self.headers)
        self.assertEqual(data1['deploy_templates'], data2['deploy_templates'])

    def test_detail_using_query_false_and_fields(self):
        obj_utils.create_test_deploy_template(self.context)
        data = self.get_json(
            '/deploy_templates?detail=False&fields=steps',
            headers=self.headers)
        self.assertIn('steps', data['deploy_templates'][0])
        self.assertNotIn('uuid', data['deploy_templates'][0])
        self.assertNotIn('extra', data['deploy_templates'][0])

    def test_detail_using_query_and_fields(self):
        obj_utils.create_test_deploy_template(self.context)
        response = self.get_json(
            '/deploy_templates?detail=True&fields=name', headers=self.headers,
            expect_errors=True)
        self.assertEqual(http_client.BAD_REQUEST, response.status_int)

    def test_many(self):
        templates = []
        for id_ in range(5):
            template = obj_utils.create_test_deploy_template(
                self.context, uuid=uuidutils.generate_uuid(),
                name='CUSTOM_DT%s' % id_)
            templates.append(template.uuid)
        data = self.get_json('/deploy_templates', headers=self.headers)
        self.assertEqual(len(templates), len(data['deploy_templates']))

        uuids = [n['uuid'] for n in data['deploy_templates']]
        self.assertCountEqual(templates, uuids)

    def test_links(self):
        uuid = uuidutils.generate_uuid()
        obj_utils.create_test_deploy_template(self.context, uuid=uuid)
        data = self.get_json('/deploy_templates/%s' % uuid,
                             headers=self.headers)
        self.assertIn('links', data)
        self.assertEqual(2, len(data['links']))
        self.assertIn(uuid, data['links'][0]['href'])
        for link in data['links']:
            bookmark = link['rel'] == 'bookmark'
            self.assertTrue(self.validate_link(link['href'], bookmark=bookmark,
                            headers=self.headers))

    def test_collection_links(self):
        templates = []
        for id_ in range(5):
            template = obj_utils.create_test_deploy_template(
                self.context, uuid=uuidutils.generate_uuid(),
                name='CUSTOM_DT%s' % id_)
            templates.append(template.uuid)
        data = self.get_json('/deploy_templates/?limit=3',
                             headers=self.headers)
        self.assertEqual(3, len(data['deploy_templates']))

        next_marker = data['deploy_templates'][-1]['uuid']
        self.assertIn('/deploy_templates', data['next'])
        self.assertIn('limit=3', data['next'])
        self.assertIn(f'marker={next_marker}', data['next'])

    def test_collection_links_default_limit(self):
        cfg.CONF.set_override('max_limit', 3, 'api')
        templates = []
        for id_ in range(5):
            template = obj_utils.create_test_deploy_template(
                self.context, uuid=uuidutils.generate_uuid(),
                name='CUSTOM_DT%s' % id_)
            templates.append(template.uuid)
        data = self.get_json('/deploy_templates', headers=self.headers)
        self.assertEqual(3, len(data['deploy_templates']))

        next_marker = data['deploy_templates'][-1]['uuid']
        self.assertIn('/deploy_templates', data['next'])
        self.assertIn(f'marker={next_marker}', data['next'])

    def test_collection_links_custom_fields(self):
        cfg.CONF.set_override('max_limit', 3, 'api')
        templates = []
        fields = 'uuid,steps'
        for i in range(5):
            template = obj_utils.create_test_deploy_template(
                self.context,
                uuid=uuidutils.generate_uuid(),
                name='CUSTOM_DT%s' % i)
            templates.append(template.uuid)
        data = self.get_json('/deploy_templates?fields=%s' % fields,
                             headers=self.headers)
        self.assertEqual(3, len(data['deploy_templates']))
        next_marker = data['deploy_templates'][-1]['uuid']
        self.assertIn('/deploy_templates', data['next'])
        self.assertIn(f'marker={next_marker}', data['next'])
        self.assertIn(f'fields={fields}', data['next'])

    def test_get_collection_pagination_no_uuid(self):
        fields = 'name'
        limit = 2
        templates = []
        for id_ in range(3):
            template = obj_utils.create_test_deploy_template(
                self.context,
                uuid=uuidutils.generate_uuid(),
                name='CUSTOM_DT%s' % id_)
            templates.append(template)

        data = self.get_json(
            '/deploy_templates?fields=%s&limit=%s' % (fields, limit),
            headers=self.headers)

        self.assertEqual(limit, len(data['deploy_templates']))
        self.assertIn('/deploy_templates', data['next'])
        self.assertIn('marker=%s' % templates[limit - 1].uuid, data['next'])

    def test_sort_key(self):
        templates = []
        for id_ in range(3):
            template = obj_utils.create_test_deploy_template(
                self.context,
                uuid=uuidutils.generate_uuid(),
                name='CUSTOM_DT%s' % id_)
            templates.append(template.uuid)
        data = self.get_json('/deploy_templates?sort_key=uuid',
                             headers=self.headers)
        uuids = [n['uuid'] for n in data['deploy_templates']]
        self.assertEqual(sorted(templates), uuids)

    def test_sort_key_invalid(self):
        invalid_keys_list = ['extra', 'foo', 'steps']
        for invalid_key in invalid_keys_list:
            path = '/deploy_templates?sort_key=%s' % invalid_key
            response = self.get_json(path, expect_errors=True,
                                     headers=self.headers)
            self.assertEqual(http_client.BAD_REQUEST, response.status_int)
            self.assertEqual('application/json', response.content_type)
            self.assertIn(invalid_key, response.json['error_message'])

    def _test_sort_key_allowed(self, detail=False):
        template_uuids = []
        for id_ in range(3, 0, -1):
            template = obj_utils.create_test_deploy_template(
                self.context,
                uuid=uuidutils.generate_uuid(),
                name='CUSTOM_DT%s' % id_)
            template_uuids.append(template.uuid)
        template_uuids.reverse()
        url = '/deploy_templates?sort_key=name&detail=%s' % str(detail)
        data = self.get_json(url, headers=self.headers)
        data_uuids = [p['uuid'] for p in data['deploy_templates']]
        self.assertEqual(template_uuids, data_uuids)

    def test_sort_key_allowed(self):
        self._test_sort_key_allowed()

    def test_detail_sort_key_allowed(self):
        self._test_sort_key_allowed(detail=True)

    def test_sensitive_data_masked(self):
        template = obj_utils.get_test_deploy_template(self.context)
        template.steps[0]['args']['password'] = 'correcthorsebatterystaple'
        template.create()
        data = self.get_json('/deploy_templates/%s' % template.uuid,
                             headers=self.headers)

        self.assertEqual("******", data['steps'][0]['args']['password'])

@mock.patch.object(objects.DeployTemplate, 'save', autospec=True)
class TestPatch(BaseDeployTemplatesAPITest):

    def setUp(self):
        super(TestPatch, self).setUp()
        self.template = obj_utils.create_test_deploy_template(
            self.context, name='CUSTOM_DT1')

    def _test_update_ok(self, mock_save, patch):
        response = self.patch_json('/deploy_templates/%s' % self.template.uuid,
                                   patch, headers=self.headers)
        self.assertEqual('application/json', response.content_type)
        self.assertEqual(http_client.OK, response.status_code)
        mock_save.assert_called_once_with(mock.ANY)
        return response

    def _test_update_bad_request(self, mock_save, patch, error_msg=None):
        response = self.patch_json('/deploy_templates/%s' % self.template.uuid,
                                   patch, expect_errors=True,
                                   headers=self.headers)
        self.assertEqual('application/json', response.content_type)
        self.assertEqual(http_client.BAD_REQUEST, response.status_code)
        self.assertTrue(response.json['error_message'])
        if error_msg:
            self.assertIn(error_msg, response.json['error_message'])
        self.assertFalse(mock_save.called)
        return response

    @mock.patch.object(notification_utils, '_emit_api_notification',
                       autospec=True)
    def test_update_by_id(self, mock_notify, mock_save):
        name = 'CUSTOM_DT2'
        patch = [{'path': '/name', 'value': name, 'op': 'add'}]
        response = self._test_update_ok(mock_save, patch)
        self.assertEqual(name, response.json['name'])

        mock_notify.assert_has_calls([mock.call(mock.ANY, mock.ANY, 'update',
                                      obj_fields.NotificationLevel.INFO,
                                      obj_fields.NotificationStatus.START),
                                      mock.call(mock.ANY, mock.ANY, 'update',
                                      obj_fields.NotificationLevel.INFO,
                                      obj_fields.NotificationStatus.END)])

    def test_update_by_name(self, mock_save):
        steps = [{
            'interface': 'bios',
            'step': 'apply_configuration',
            'args': {'foo': 'bar'},
            'priority': 42
        }]
        patch = [{'path': '/steps', 'value': steps, 'op': 'replace'}]
        response = self.patch_json('/deploy_templates/%s' % self.template.name,
                                   patch, headers=self.headers)
        self.assertEqual('application/json', response.content_type)
        self.assertEqual(http_client.OK, response.status_code)
        mock_save.assert_called_once_with(mock.ANY)
        self.assertEqual(steps, response.json['steps'])

    def test_update_by_name_with_json(self, mock_save):
        interface = 'bios'
        path = '/deploy_templates/%s.json' % self.template.name
        response = self.patch_json(path,
                                   [{'path': '/steps/0/interface',
                                     'value': interface,
                                     'op': 'replace'}],
                                   headers=self.headers)
        self.assertEqual('application/json', response.content_type)
        self.assertEqual(http_client.OK, response.status_code)
        self.assertEqual(interface, response.json['steps'][0]['interface'])

    def test_update_name_standard_trait(self, mock_save):
        name = 'HW_CPU_X86_VMX'
        patch = [{'path': '/name', 'value': name, 'op': 'replace'}]
        response = self._test_update_ok(mock_save, patch)
        self.assertEqual(name, response.json['name'])

    def test_update_name_custom_trait(self, mock_save):
        name = 'CUSTOM_DT2'
        patch = [{'path': '/name', 'value': name, 'op': 'replace'}]
        response = self._test_update_ok(mock_save, patch)
        self.assertEqual(name, response.json['name'])

    def test_update_invalid_name(self, mock_save):
        self._test_update_bad_request(
            mock_save,
            [{'path': '/name', 'value': 'aa:bb_cc', 'op': 'replace'}],
            "'aa:bb_cc' does not match '^CUSTOM_[A-Z0-9_]+$'")

    def test_update_by_id_invalid_api_version(self, mock_save):
        name = 'CUSTOM_DT2'
        headers = self.invalid_version_headers
        response = self.patch_json('/deploy_templates/%s' % self.template.uuid,
                                   [{'path': '/name',
                                     'value': name,
                                     'op': 'add'}],
                                   headers=headers,
                                   expect_errors=True)
        self.assertEqual(http_client.METHOD_NOT_ALLOWED, response.status_int)
        self.assertFalse(mock_save.called)

    def test_update_by_name_old_api_version(self, mock_save):
        name = 'CUSTOM_DT2'
        response = self.patch_json('/deploy_templates/%s' % self.template.name,
                                   [{'path': '/name',
                                     'value': name,
                                     'op': 'add'}],
                                   expect_errors=True)
        self.assertEqual(http_client.METHOD_NOT_ALLOWED, response.status_int)
        self.assertFalse(mock_save.called)

    def test_update_not_found(self, mock_save):
        name = 'CUSTOM_DT2'
        uuid = uuidutils.generate_uuid()
        response = self.patch_json('/deploy_templates/%s' % uuid,
                                   [{'path': '/name',
                                     'value': name,
                                     'op': 'add'}],
                                   expect_errors=True,
                                   headers=self.headers)
        self.assertEqual('application/json', response.content_type)
        self.assertEqual(http_client.NOT_FOUND, response.status_int)
        self.assertTrue(response.json['error_message'])
        self.assertFalse(mock_save.called)

    @mock.patch.object(notification_utils, '_emit_api_notification',
                       autospec=True)
    def test_replace_name_already_exist(self, mock_notify, mock_save):
        name = 'CUSTOM_DT2'
        obj_utils.create_test_deploy_template(self.context,
                                              uuid=uuidutils.generate_uuid(),
                                              name=name)
        mock_save.side_effect = exception.DeployTemplateAlreadyExists(
            uuid=self.template.uuid)
        response = self.patch_json('/deploy_templates/%s' % self.template.uuid,
                                   [{'path': '/name',
                                     'value': name,
                                     'op': 'replace'}],
                                   expect_errors=True,
                                   headers=self.headers)
        self.assertEqual('application/json', response.content_type)
        self.assertEqual(http_client.CONFLICT, response.status_code)
        self.assertTrue(response.json['error_message'])
        mock_save.assert_called_once_with(mock.ANY)
        mock_notify.assert_has_calls([mock.call(mock.ANY, mock.ANY, 'update',
                                      obj_fields.NotificationLevel.INFO,
                                      obj_fields.NotificationStatus.START),
                                      mock.call(mock.ANY, mock.ANY, 'update',
                                      obj_fields.NotificationLevel.ERROR,
                                      obj_fields.NotificationStatus.ERROR)])

    def test_replace_invalid_name_too_long(self, mock_save):
        name = 'CUSTOM_' + 'X' * 249
        patch = [{'path': '/name', 'op': 'replace', 'value': name}]
        self._test_update_bad_request(
            mock_save, patch, "'%s' is too long" % name)

    def test_replace_invalid_name_not_a_trait(self, mock_save):
        name = 'not-a-trait'
        patch = [{'path': '/name', 'op': 'replace', 'value': name}]
        self._test_update_bad_request(
            mock_save, patch,
            "'not-a-trait' does not match '^CUSTOM_[A-Z0-9_]+$'")

    def test_replace_invalid_name_none(self, mock_save):
        patch = [{'path': '/name', 'op': 'replace', 'value': None}]
        self._test_update_bad_request(
            mock_save, patch, "None is not of type 'string'")

    def test_replace_duplicate_step(self, mock_save):
        # interface & step combination must be unique.
        steps = [
            {
                'interface': 'raid',
                'step': 'create_configuration',
                'args': {'foo': '%d' % i},
                'priority': i,
            }
            for i in range(2)
        ]
        patch = [{'path': '/steps', 'op': 'replace', 'value': steps}]
        self._test_update_bad_request(
            mock_save, patch, "Duplicate deploy steps")

    def test_replace_invalid_step_interface_fail(self, mock_save):
        step = {
            'interface': 'foo',
            'step': 'apply_configuration',
            'args': {'foo': 'bar'},
            'priority': 42
        }
        patch = [{'path': '/steps/0', 'op': 'replace', 'value': step}]
        self._test_update_bad_request(
            mock_save, patch, "'foo' is not one of")

    def test_replace_non_existent_step_fail(self, mock_save):
        step = {
            'interface': 'bios',
            'step': 'apply_configuration',
            'args': {'foo': 'bar'},
            'priority': 42
        }
        patch = [{'path': '/steps/1', 'op': 'replace', 'value': step}]
        self._test_update_bad_request(mock_save, patch)

    def test_replace_empty_step_list_fail(self, mock_save):
        patch = [{'path': '/steps', 'op': 'replace', 'value': []}]
        self._test_update_bad_request(
            mock_save, patch, '[] is too short')

    def _test_remove_not_allowed(self, mock_save, field, error_msg=None):
        patch = [{'path': '/%s' % field, 'op': 'remove'}]
        self._test_update_bad_request(mock_save, patch, error_msg)

    def test_remove_uuid(self, mock_save):
        self._test_remove_not_allowed(
            mock_save, 'uuid',
            "Cannot patch /uuid")

    def test_remove_name(self, mock_save):
        self._test_remove_not_allowed(
            mock_save, 'name',
            "'name' is a required property")

    def test_remove_steps(self, mock_save):
        self._test_remove_not_allowed(
            mock_save, 'steps',
            "'steps' is a required property")

    def test_remove_foo(self, mock_save):
        self._test_remove_not_allowed(mock_save, 'foo')

    def test_replace_step_invalid_interface(self, mock_save):
        patch = [{'path': '/steps/0/interface', 'op': 'replace',
                  'value': 'foo'}]
        self._test_update_bad_request(
            mock_save, patch, "'foo' is not one of")

    def test_replace_multi(self, mock_save):
        steps = [
            {
                'interface': 'raid',
                'step': 'create_configuration%d' % i,
                'args': {},
                'priority': 10,
            }
            for i in range(3)
        ]
        template = obj_utils.create_test_deploy_template(
            self.context, uuid=uuidutils.generate_uuid(), name='CUSTOM_DT2',
            steps=steps)

        # mutate steps so we replace all of them
        for step in steps:
            step['priority'] = step['priority'] + 1

        patch = []
        for i, step in enumerate(steps):
            patch.append({'path': '/steps/%s' % i,
                          'value': step,
                          'op': 'replace'})
        response = self.patch_json('/deploy_templates/%s' % template.uuid,
                                   patch, headers=self.headers)
        self.assertEqual('application/json', response.content_type)
        self.assertEqual(http_client.OK, response.status_code)
        self.assertEqual(steps, response.json['steps'])
        mock_save.assert_called_once_with(mock.ANY)

    def test_remove_multi(self, mock_save):
        steps = [
            {
                'interface': 'raid',
                'step': 'create_configuration%d' % i,
                'args': {},
                'priority': 10,
            }
            for i in range(3)
        ]
        template = obj_utils.create_test_deploy_template(
            self.context, uuid=uuidutils.generate_uuid(), name='CUSTOM_DT2',
            steps=steps)

        # Removing one step from the collection
        steps.pop(1)
        response = self.patch_json('/deploy_templates/%s' % template.uuid,
                                   [{'path': '/steps/1',
                                     'op': 'remove'}],
                                   headers=self.headers)
        self.assertEqual('application/json', response.content_type)
        self.assertEqual(http_client.OK, response.status_code)
        self.assertEqual(steps, response.json['steps'])
        mock_save.assert_called_once_with(mock.ANY)

    def test_remove_non_existent_property_fail(self, mock_save):
        patch = [{'path': '/non-existent', 'op': 'remove'}]
        self._test_update_bad_request(mock_save, patch)

    def test_remove_non_existent_step_fail(self, mock_save):
        patch = [{'path': '/steps/1', 'op': 'remove'}]
        self._test_update_bad_request(mock_save, patch)

    def test_remove_only_step_fail(self, mock_save):
        patch = [{'path': '/steps/0', 'op': 'remove'}]
        self._test_update_bad_request(
            mock_save, patch, "[] is too short")

    def test_remove_non_existent_step_property_fail(self, mock_save):
        patch = [{'path': '/steps/0/non-existent', 'op': 'remove'}]
        self._test_update_bad_request(mock_save, patch)

    def test_add_root_non_existent(self, mock_save):
        patch = [{'path': '/foo', 'value': 'bar', 'op': 'add'}]
        self._test_update_bad_request(
            mock_save, patch,
            "Cannot patch /foo")

    def test_add_too_high_index_step_fail(self, mock_save):
        step = {
            'interface': 'bios',
            'step': 'apply_configuration',
            'args': {'foo': 'bar'},
            'priority': 42
        }
        patch = [{'path': '/steps/2', 'op': 'add', 'value': step}]
        self._test_update_bad_request(mock_save, patch)

    def test_add_multi(self, mock_save):
        steps = [
            {
                'interface': 'raid',
                'step': 'create_configuration%d' % i,
                'args': {},
                'priority': 10,
            }
            for i in range(3)
        ]
        patch = []
        for i, step in enumerate(steps):
            patch.append({'path': '/steps/%d' % i,
                          'value': step,
                          'op': 'add'})
        response = self.patch_json('/deploy_templates/%s' % self.template.uuid,
                                   patch, headers=self.headers)
        self.assertEqual('application/json', response.content_type)
        self.assertEqual(http_client.OK, response.status_code)
        self.assertEqual(steps, response.json['steps'][:-1])
        self.assertEqual(_obj_to_api_step(self.template.steps[0]),
                         response.json['steps'][-1])
        mock_save.assert_called_once_with(mock.ANY)

class TestPost(BaseDeployTemplatesAPITest):

    @mock.patch.object(notification_utils, '_emit_api_notification',
                       autospec=True)
    @mock.patch.object(timeutils, 'utcnow', autospec=True)
    def test_create(self, mock_utcnow, mock_notify):
        tdict = test_api_utils.post_get_test_deploy_template()
        test_time = datetime.datetime(2000, 1, 1, 0, 0)
        mock_utcnow.return_value = test_time
        response = self.post_json('/deploy_templates', tdict,
                                  headers=self.headers)
        self.assertEqual(http_client.CREATED, response.status_int)
        result = self.get_json('/deploy_templates/%s' % tdict['uuid'],
                               headers=self.headers)
        self.assertEqual(tdict['uuid'], result['uuid'])
        self.assertFalse(result['updated_at'])
        return_created_at = timeutils.parse_isotime(
            result['created_at']).replace(tzinfo=None)
        self.assertEqual(test_time, return_created_at)
        # Check location header
        self.assertIsNotNone(response.location)
        expected_location = '/v1/deploy_templates/%s' % tdict['uuid']
        self.assertEqual(expected_location,
                         urlparse.urlparse(response.location).path)
        mock_notify.assert_has_calls([mock.call(mock.ANY, mock.ANY, 'create',
                                      obj_fields.NotificationLevel.INFO,
                                      obj_fields.NotificationStatus.START),
                                      mock.call(mock.ANY, mock.ANY, 'create',
                                      obj_fields.NotificationLevel.INFO,
                                      obj_fields.NotificationStatus.END)])

    def test_create_invalid_api_version(self):
        tdict = test_api_utils.post_get_test_deploy_template()
        response = self.post_json(
            '/deploy_templates', tdict, headers=self.invalid_version_headers,
            expect_errors=True)
        self.assertEqual(http_client.METHOD_NOT_ALLOWED, response.status_int)

    def test_create_doesnt_contain_id(self):
        with mock.patch.object(
                self.dbapi, 'create_deploy_template',
                wraps=self.dbapi.create_deploy_template) as mock_create:
            tdict = test_api_utils.post_get_test_deploy_template()
            self.post_json('/deploy_templates', tdict, headers=self.headers)
            self.get_json('/deploy_templates/%s' % tdict['uuid'],
                          headers=self.headers)
            mock_create.assert_called_once_with(mock.ANY)
            # Check that 'id' is not in first arg of positional args
            self.assertNotIn('id', mock_create.call_args[0][0])

    @mock.patch.object(notification_utils.LOG, 'exception', autospec=True)
    @mock.patch.object(notification_utils.LOG, 'warning', autospec=True)
    def test_create_generate_uuid(self, mock_warn, mock_except):
        tdict = test_api_utils.post_get_test_deploy_template()
        del tdict['uuid']
        response = self.post_json('/deploy_templates', tdict,
                                  headers=self.headers)
        result = self.get_json('/deploy_templates/%s' % response.json['uuid'],
                               headers=self.headers)
        self.assertTrue(uuidutils.is_uuid_like(result['uuid']))
        self.assertFalse(mock_warn.called)
        self.assertFalse(mock_except.called)

    @mock.patch.object(notification_utils, '_emit_api_notification',
                       autospec=True)
    @mock.patch.object(objects.DeployTemplate, 'create', autospec=True)
    def test_create_error(self, mock_create, mock_notify):
        mock_create.side_effect = Exception()
        tdict = test_api_utils.post_get_test_deploy_template()
        self.post_json('/deploy_templates', tdict, headers=self.headers,
                       expect_errors=True)
        mock_notify.assert_has_calls([mock.call(mock.ANY, mock.ANY, 'create',
                                      obj_fields.NotificationLevel.INFO,
                                      obj_fields.NotificationStatus.START),
                                      mock.call(mock.ANY, mock.ANY, 'create',
                                      obj_fields.NotificationLevel.ERROR,
                                      obj_fields.NotificationStatus.ERROR)])

    def _test_create_ok(self, tdict):
        response = self.post_json('/deploy_templates', tdict,
                                  headers=self.headers)
        self.assertEqual(http_client.CREATED, response.status_int)

    def _test_create_bad_request(self, tdict, error_msg):
        response = self.post_json('/deploy_templates', tdict,
                                  expect_errors=True, headers=self.headers)
        self.assertEqual(http_client.BAD_REQUEST, response.status_int)
        self.assertEqual('application/json', response.content_type)
        self.assertTrue(response.json['error_message'])
        self.assertIn(error_msg, response.json['error_message'])

    def test_create_long_name(self):
        name = 'CUSTOM_' + 'X' * 248
        tdict = test_api_utils.post_get_test_deploy_template(name=name)
        self._test_create_ok(tdict)

    def test_create_standard_trait_name(self):
        name = 'HW_CPU_X86_VMX'
        tdict = test_api_utils.post_get_test_deploy_template(name=name)
        self._test_create_ok(tdict)

    def test_create_name_invalid_too_long(self):
        name = 'CUSTOM_' + 'X' * 249
        tdict = test_api_utils.post_get_test_deploy_template(name=name)
        self._test_create_bad_request(
            tdict, "'%s' is too long" % name)

    def test_create_name_invalid_not_a_trait(self):
        name = 'not-a-trait'
        tdict = test_api_utils.post_get_test_deploy_template(name=name)
        self._test_create_bad_request(
            tdict, "'not-a-trait' does not match '^CUSTOM_[A-Z0-9_]+$'")

    def test_create_steps_invalid_duplicate(self):
        steps = [
            {
                'interface': 'raid',
                'step': 'create_configuration',
                'args': {'foo': '%d' % i},
                'priority': i,
            }
            for i in range(2)
        ]
        tdict = test_api_utils.post_get_test_deploy_template(steps=steps)
        self._test_create_bad_request(tdict, "Duplicate deploy steps")

    def _test_create_no_mandatory_field(self, field):
        tdict = test_api_utils.post_get_test_deploy_template()
        del tdict[field]
        self._test_create_bad_request(tdict, "is a required property")

    def test_create_no_mandatory_field_name(self):
        self._test_create_no_mandatory_field('name')

    def test_create_no_mandatory_field_steps(self):
        self._test_create_no_mandatory_field('steps')

    def _test_create_no_mandatory_step_field(self, field):
        tdict = test_api_utils.post_get_test_deploy_template()
        del tdict['steps'][0][field]
        self._test_create_bad_request(tdict, "is a required property")

    def test_create_no_mandatory_step_field_interface(self):
        self._test_create_no_mandatory_step_field('interface')

    def test_create_no_mandatory_step_field_step(self):
        self._test_create_no_mandatory_step_field('step')

    def test_create_no_mandatory_step_field_args(self):
        self._test_create_no_mandatory_step_field('args')

    def test_create_no_mandatory_step_field_priority(self):
        self._test_create_no_mandatory_step_field('priority')

    def _test_create_invalid_field(self, field, value, error_msg):
        tdict = test_api_utils.post_get_test_deploy_template()
        tdict[field] = value
        self._test_create_bad_request(tdict, error_msg)

    def test_create_invalid_field_name(self):
        self._test_create_invalid_field(
            'name', 42, "42 is not of type 'string'")

    def test_create_invalid_field_name_none(self):
        self._test_create_invalid_field(
            'name', None, "None is not of type 'string'")

    def test_create_invalid_field_steps(self):
        self._test_create_invalid_field(
            'steps', {}, "{} is not of type 'array'")

    def test_create_invalid_field_empty_steps(self):
        self._test_create_invalid_field(
            'steps', [], "[] is too short")

    def test_create_invalid_field_extra(self):
        self._test_create_invalid_field(
            'extra', 42, "42 is not of type 'object'")

    def test_create_invalid_field_foo(self):
        self._test_create_invalid_field(
            'foo', 'bar',
            "Additional properties are not allowed ('foo' was unexpected)")

    def _test_create_invalid_step_field(self, field, value, error_msg=None):
        tdict = test_api_utils.post_get_test_deploy_template()
        tdict['steps'][0][field] = value
        if error_msg is None:
            error_msg = "Deploy template invalid: "
        self._test_create_bad_request(tdict, error_msg)

    def test_create_invalid_step_field_interface1(self):
        self._test_create_invalid_step_field(
            'interface', [3], "[3] is not of type 'string'")

    def test_create_invalid_step_field_interface2(self):
        self._test_create_invalid_step_field(
            'interface', 'foo', "'foo' is not one of")

    def test_create_invalid_step_field_step(self):
        self._test_create_invalid_step_field(
            'step', 42, "42 is not of type 'string'")

    def test_create_invalid_step_field_args1(self):
        self._test_create_invalid_step_field(
            'args', 'not a dict', "'not a dict' is not of type 'object'")

    def test_create_invalid_step_field_args2(self):
        self._test_create_invalid_step_field(
            'args', [], "[] is not of type 'object'")

    def test_create_invalid_step_field_priority(self):
        self._test_create_invalid_step_field(
            'priority', 'not a number',
            "'not a number'")  # differs between jsonschema versions

    def test_create_invalid_step_field_negative_priority(self):
        self._test_create_invalid_step_field(
            'priority', -1, "-1 is less than the minimum of 0")

    def test_create_invalid_step_field_foo(self):
        self._test_create_invalid_step_field(
            'foo', 'bar',
            "Additional properties are not allowed ('foo' was unexpected)")

    def test_create_step_string_priority(self):
        tdict = test_api_utils.post_get_test_deploy_template()
        tdict['steps'][0]['priority'] = '42'
        self._test_create_ok(tdict)

    def test_create_complex_step_args(self):
        tdict = test_api_utils.post_get_test_deploy_template()
        tdict['steps'][0]['args'] = {'foo': [{'bar': 'baz'}]}
        self._test_create_ok(tdict)

@mock.patch.object(objects.DeployTemplate, 'destroy', autospec=True)
class TestDelete(BaseDeployTemplatesAPITest):

    def setUp(self):
        super(TestDelete, self).setUp()
        self.template = obj_utils.create_test_deploy_template(self.context)

    @mock.patch.object(notification_utils, '_emit_api_notification',
                       autospec=True)
    def test_delete_by_uuid(self, mock_notify, mock_destroy):
        self.delete('/deploy_templates/%s' % self.template.uuid,
                    headers=self.headers)
        mock_destroy.assert_called_once_with(mock.ANY)
        mock_notify.assert_has_calls([mock.call(mock.ANY, mock.ANY, 'delete',
                                      obj_fields.NotificationLevel.INFO,
                                      obj_fields.NotificationStatus.START),
                                      mock.call(mock.ANY, mock.ANY, 'delete',
                                      obj_fields.NotificationLevel.INFO,
                                      obj_fields.NotificationStatus.END)])

    def test_delete_by_uuid_with_json(self, mock_destroy):
        self.delete('/deploy_templates/%s.json' % self.template.uuid,
                    headers=self.headers)
        mock_destroy.assert_called_once_with(mock.ANY)

    def test_delete_by_name(self, mock_destroy):
        self.delete('/deploy_templates/%s' % self.template.name,
                    headers=self.headers)
        mock_destroy.assert_called_once_with(mock.ANY)

    def test_delete_by_name_with_json(self, mock_destroy):
        self.delete('/deploy_templates/%s.json' % self.template.name,
                    headers=self.headers)
        mock_destroy.assert_called_once_with(mock.ANY)

    def test_delete_invalid_api_version(self, mock_dpt):
        response = self.delete('/deploy_templates/%s' % self.template.uuid,
                               expect_errors=True,
                               headers=self.invalid_version_headers)
        self.assertEqual(http_client.METHOD_NOT_ALLOWED, response.status_int)

    def test_delete_old_api_version(self, mock_dpt):
        # Names like CUSTOM_1 were not valid in API 1.1, but the check should
        # go after the microversion check.
        response = self.delete('/deploy_templates/%s' % self.template.name,
                               expect_errors=True)
        self.assertEqual(http_client.METHOD_NOT_ALLOWED, response.status_int)

    def test_delete_by_name_non_existent(self, mock_dpt):
        res = self.delete('/deploy_templates/%s' % 'blah', expect_errors=True,
                          headers=self.headers)
        self.assertEqual(http_client.NOT_FOUND, res.status_code)

redpajama_set_name: RedPajamaGithub